EDuke32 Scripting "CON coding help"
#2328 Posted 25 September 2018 - 06:57 AM
This post has been edited by thisbecasper: 25 September 2018 - 07:34 AM
#2329 Posted 29 September 2018 - 06:50 AM
Trooper Dan, on 24 September 2018 - 05:08 PM, said:
I think I almost got what I want, but now I'm unable to change the player's position. I'm using setplayer[THISACTOR].posx and posy, but it doesn't seem to affect the position. Do I need something more or something completely different to change the position?
#2330 Posted 29 September 2018 - 06:59 AM
Perro Seco, on 29 September 2018 - 06:50 AM, said:
If that's all you need, then don't make extra sprites and don't do the calculations all the time. Just do the calculation once when the player exits the vehicle and move the player to those coordinates.
Perro Seco, on 29 September 2018 - 06:50 AM, said:
Changing the player coordinates is usually all you need for changing the player's actual position. It's better if you also update the player's sector, in case the new coordinates are in a new sector. You can feed your new coordinates into the updatesector or updatesectorz command, then set the player's cursectnum to the outputed sector (but don't set it if the output is -1 for some reason).
As for why it's not working when you set posx and posy, it could be because you aren't setting the sector but I think it's more likely something else which is blocking your attempt. The first thing I would check is make sure that Lezing's bike code is not setting the player's coords at that point, since it could be overriding your attempt. Also, you should verify 100% that you have calculated the new coordinates correctly. You can do a visual confirmation by espawning a sprite there and setting it to those coordinates; do so in F7 view mode so that you can see it in game and verify it is in the right place.
#2331 Posted 30 September 2018 - 02:10 PM
Also, the same thing but with messages displaying the name of the room the player has entered?
#2332 Posted 30 September 2018 - 03:08 PM
#2333 Posted 30 September 2018 - 03:18 PM
CON does have a huge number of commands which often do complex things. Want some money sprites to spawn and float realistically to the ground? Easy: use the money command. Want to make an earthquake? Easy: use the quake command. And so on. Those sorts of commands are like a vending machine -- you just press the right button and the thing you want comes out, already packaged for you. But in addition to the vending machine, CON also has a kitchen fully stocked with raw ingredients where you can make pretty much anything you want.
I think some people get caught up on the convenience of the vending machine and never learn how to cook. If you are making a mod that has non-trivial coded features, you should learn how to cook.
#2334 Posted 30 September 2018 - 04:30 PM
Trooper Dan, on 30 September 2018 - 03:18 PM, said:
Programming can be a very scary thing for some people. I've seen professional designers get scared, looking at scripting systems like Lua, but work just fine in a visual script language such as UE4 Blueprint. CON coding can be intimidating for people that want to do design work.
Is there a library somewhere with a bunch of general use CON script functions, that anyone can just grab and include in there projects? I've seen people put some fantastic things together, when they have something just above "raw ingredients".
This post has been edited by icecoldduke: 30 September 2018 - 04:34 PM
#2335 Posted 30 September 2018 - 05:20 PM
icecoldduke, on 30 September 2018 - 04:30 PM, said:
No, there should be a library like that, but there isn't. So each of us who has done a lot of scripting has essentially built our own library. One complication is that CON does not allow local variables. So, if my function uses a variable named "TEMPVAR", then it won't compile in your project unless you have a variable of that same name. I could include the variable declaration with my provided function, but then your project will have that global variable in it, just because you use my function. Worse, you might already have a variable of that name but with different flags, so it will actually conflict and not work the same. Another issue we used to have is that you couldn't append new event code. So, if I wanted to share something cool to do in EVENT_GAME, the user would have to know how to integrate it with any existing EVENT_GAME code they may have.
Given the obstacles and how few people are using the scripting language at any given time, it just never seemed worth it to try to make a public library.
#2336 Posted 30 September 2018 - 07:08 PM
#2337 Posted 30 September 2018 - 07:31 PM
Mark, on 30 September 2018 - 07:08 PM, said:
Man that would be awesome - I've been trying to get my head around CON coding these last few weeks and I'm finding the learning curve VERY steep!
#2338 Posted 30 September 2018 - 07:42 PM
conoklast, on 30 September 2018 - 07:31 PM, said:
i wouldn't even try to figure out con aside from changing sounds & episodes/maps. Some of the effects people pull off are pretty amazing.
Gotta be dedicated to learn it.
The major downside to me seems like eduke32 updates are always inadvertently breaking things. Pretty good deterrent for someone with a lack of patience.
This post has been edited by Forge: 30 September 2018 - 07:48 PM
#2339 Posted 30 September 2018 - 07:48 PM
#2340 Posted 30 September 2018 - 07:52 PM
nvm, I did not know this existed
http://wiki.eduke32.com/wiki/Scripting
people should read this & the references first, & show the code they tried to use - before they ask questions
I can kinda see Dan's point now. Asking "how do I...", instead of, "I did...but I didn't get the results I wanted" are two different things.
Almost reminds me of those people that used to randomly show up and declare some massive project and wanting everyone to join - to do all the work for them so they can sit back and see their vision come to life with zero effort on their part.
This post has been edited by Forge: 30 September 2018 - 08:02 PM
#2341 Posted 30 September 2018 - 07:55 PM
This post has been edited by Mark: 30 September 2018 - 07:56 PM
#2342 Posted 30 September 2018 - 09:37 PM
#2343 Posted 01 October 2018 - 12:38 AM
Mblackwell, on 30 September 2018 - 09:37 PM, said:
Yes, and that's very useful.
Note that I was careful to use the past tense in my post and said we "used to" not be able to append events.
#2344 Posted 01 October 2018 - 06:12 AM
Forge, on 30 September 2018 - 07:42 PM, said:
Gotta be dedicated to learn it.
The major downside to me seems like eduke32 updates are always inadvertently breaking things. Pretty good deterrent for someone with a lack of patience.
I have no intention of writing custom scripts, I just want to be able to understand chunks of other people's code so that I can adapt it for my own TC... but yes even to get an elementary understanding is testing my dedication
#2345 Posted 01 October 2018 - 06:38 AM
Mark, on 30 September 2018 - 07:55 PM, said:
Con coders like to flaunt their knowledge, not write tutorials.

exhibit 1A:
Trooper Dan, on 30 September 2018 - 03:08 PM, said:
Sure. But do you know how to field-dress a deer?
This post has been edited by Forge: 01 October 2018 - 06:40 AM
#2346 Posted 01 October 2018 - 07:35 AM
Trooper Dan, on 30 September 2018 - 03:18 PM, said:
CON does have a huge number of commands which often do complex things. Want some money sprites to spawn and float realistically to the ground? Easy: use the money command. Want to make an earthquake? Easy: use the quake command. And so on. Those sorts of commands are like a vending machine -- you just press the right button and the thing you want comes out, already packaged for you. But in addition to the vending machine, CON also has a kitchen fully stocked with raw ingredients where you can make pretty much anything you want.
I think some people get caught up on the convenience of the vending machine and never learn how to cook. If you are making a mod that has non-trivial coded features, you should learn how to cook.
That's true, but the wikia is not as exhaustive as it could have been. For comparison, when creating Cosmetic Doom I barely asked the community any questions regarding coding, since the zDoom wikia is packed with all the information one could need. Yes, I am constantly looking at mods and their code if they have features that interest me, but that alone can only get one so far.
conoklast, on 01 October 2018 - 06:12 AM, said:
This x 100.
This post has been edited by December Man: 01 October 2018 - 07:39 AM
#2347 Posted 01 October 2018 - 10:15 AM
#2349 Posted 01 October 2018 - 11:20 AM
#2350 Posted 01 October 2018 - 12:32 PM
Trooper Dan, on 01 October 2018 - 10:15 AM, said:
Thank you very much.
Mblackwell, on 01 October 2018 - 10:56 AM, said:
Yes, but the fact that you had to learn it the hard way does not mean that everyone else should. Expanding the wiki could potentially expand the community as well and the mod quantity / quality.
#2351 Posted 01 October 2018 - 12:48 PM
December Man, on 01 October 2018 - 12:32 PM, said:
Yes, but....
People should also take it upon themselves to try things out and be willing to experiment and learn the hard way, instead of being spoon-fed the answers and not really learning anything except how to ask someone to do it for them.
give a person a fish vs. teaching them to fish, blah-blah-blah......
try first, ask second
This post has been edited by Forge: 01 October 2018 - 12:49 PM
#2352 Posted 01 October 2018 - 12:50 PM
Here's the main page of the scripting wiki:
https://wiki.eduke32.../wiki/Scripting
It starts by linking to some old guides which cover the basics of the scripting language from the 1996 version (which is still applicable to the enhanced version). It then talks about important enhancements and how to use them, including game variables, game structures, game events, and formatting. At the top there are links to documentation on the various commands, events and structures within the game.
Everything I listed above could be improved. But, for those of us who are already familiar with the system, it's not obvious what the biggest deficiencies are. If people want to chime in about what most needs improvement, that would be helpful.
#2353 Posted 01 October 2018 - 01:18 PM
#2354 Posted 01 October 2018 - 01:43 PM
December Man, on 01 October 2018 - 12:32 PM, said:
The hard way? The FAQs cover things that were available at the time in a good amount of detail and with clear explanations. I mostly just went "can I?" and then searched to see if a command or set of commands existed that would let me do that in some way. And often I did NOT code things in bespoke ways (based on Duke3D's vanilla CON files for example) when I thought of easier ways of doing the same thing based on the available commands. Saying that scripting is easy would be lying, but only because of the variety of functions now available and the kinds of things you can do. But the basic stuff is very simple. And when you are starting out you should stick to the basics.
#2355 Posted 01 October 2018 - 02:22 PM
Trooper Dan, on 01 October 2018 - 12:50 PM, said:
Here's the main page of the scripting wiki:
https://wiki.eduke32.../wiki/Scripting
It starts by linking to some old guides which cover the basics of the scripting language from the 1996 version (which is still applicable to the enhanced version). It then talks about important enhancements and how to use them, including game variables, game structures, game events, and formatting. At the top there are links to documentation on the various commands, events and structures within the game.
Everything I listed above could be improved. But, for those of us who are already familiar with the system, it's not obvious what the biggest deficiencies are. If people want to chime in about what most needs improvement, that would be helpful.
I think what the wiki really needs are examples of using functions, events etc. within code. In zDoom wikia there are action functions:
https://zdoom.org/wi...ction_functions
Notice that each one has an example of how to use it within the code, even if they seem redundant at times. There are a few exceptions with no examples, but these have this note added:
Quote
Furthermore, many new functions e.g. events have no pages added. Notice how many hyperlinks are red here:
https://wiki.eduke32...wiki/Event_list
I guess I can assume which some of them do, but having clear verified info about it would save a lot of time.
This post has been edited by December Man: 01 October 2018 - 02:23 PM
#2356 Posted 01 October 2018 - 02:31 PM
Hendricks266, on 01 October 2018 - 01:18 PM, said:
That implies that all con documentation and references are shit, and all of the knowledgeable people would rather horde their little gems just so they could tell new people they don't have time to help.
I have a hard time believing that about my favorite Duke community members.
This post has been edited by Forge: 01 October 2018 - 02:32 PM

Help
Duke4.net
DNF #1
Duke 3D #1


