Register an account now to get access to all board features. After you've registered and logged in, you'll be able to create topics, post replies, send and receive private messages, disable the viewing of ads and more!

EDuke32 Scripting
"CON coding help"

There is a wiki but a lot of entries are empty or have an entry thats too technical for a noob. Some newer features IIRC haven't even been listed there yet. Even so, it has a lot of good info and I reference it often.

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.

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

There is a wiki but a lot of entries are empty or have an entry thats too technical for a noob. Some newer features IIRC haven't even been listed there yet. Even so, it has a lot of good info and I reference it often.

Con coders like to flaunt their knowledge, not write tutorials.

https://thechive.files.wordpress.com/2018/09/cshxndt.jpg

exhibit 1A:

Trooper Dan, on 30 September 2018 - 03:08 PM, said:

There are many examples of this from different mods -- it's not particularly difficult but I don't plan to write a tutorial.

As an aside, I hope this doesn't offend anyone but I've noticed something about a lot of CON scripting questions. A lot of questions are of the form "Is it possible to do X?" but what they really mean is "Is there a command to do X?"

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:

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

@December Man: dedicate a couple of tiles to being your effect sprites. Using the eventloadactor command, make sprites of those tile numbers run code at map load time. The code should read hitag and lotag into gamevars, set hitag and lotag back to zero and turn the sprites invisible. Then during gameplay, use EVENT_GAME to make the sprites do things such as detect whether the player has entered their sector and then trigger an effect based on the variables. For example, the hitag variable might be a quote number.

@December Man: dedicate a couple of tiles to being your effect sprites. Using the eventloadactor command, make sprites of those tile numbers run code at map load time. The code should read hitag and lotag into gamevars, set hitag and lotag back to zero and turn the sprites invisible. Then during gameplay, use EVENT_GAME to make the sprites do things such as detect whether the player has entered their sector and then trigger an effect based on the variables. For example, the hitag variable might be a quote number.

Thank you very much.

Mblackwell, on 01 October 2018 - 10:56 AM, said:

I learned using the CON FAQ and the EDuke FAQ (which is inaccurate in some cases, also another EDuke reference which doesn't exist anymore and had inaccurate information, but was a good start anyway).

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.

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.

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.

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 don't consider the current state of CON coding functionality to be sufficient for new users to learn easily. Everything is bespoke and ad hoc to the extreme. About the only good ways to learn how to do things are to look at existing code or to ask publicly and have it spoonfed to you. Even then, you end up with every mod having its own versions of boilerplate like weapon drawing functions that can never be modified by improved source port development without updating the mod, and which require the source port to painfully maintain old, flawed ways of doing things.

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.

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.

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:

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

Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contibutions are greatly appreciated.

Furthermore, many new functions e.g. events have no pages added. Notice how many hyperlinks are red here:

About the only good ways to learn how to do things are to look at existing code or to ask publicly and have it spoonfed to you.

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.

Take the question "How can I add a new weapon through CON coding?". There are no existing tutorials on the subject. Even for modifying an existing weapon beyond tinkering with WEAPONx_* and projectile stuff, there is nothing beyond "Download weapons.sample.con and change it." Such a tutorial would require covering many fragile/brittle unintuitive small items that must be implemented, all on top of the fact that EDuke32 does not truly support new weapons in a way that integrates them into existing systems like gotweapon, ammo_amount, tossweapon, status bar / mini-HUD drawing, and the weapon sprite that hovers over the player in co-op. If you have to completely reimplement these systems to add new weapons, not only is that yet another bar to clear for a beginner, but it also leads to the creation of single-use suboptimal code that future source port-side development of the original game's systems will never benefit. For example, if someone wanted to add a new weapon, shouldn't a hypothetical revival of EDuke32 for Android show it in the weapon selection circle?

Even then, you end up with every mod having its own versions of boilerplate like weapon drawing functions that can never be modified by improved source port development without updating the mod, and which require the source port to painfully maintain old, flawed ways of doing things.

This is getting off the topic of documentation, but I think it would be reasonable to end EDuke32 development and shift everything over to a port with a new name. What I mean is, make sure that EDuke32 is in a good place, fix known bugs, and then just leave it. Start a new project called "EDuke Pro" (not really because that name sucks) and use the opportunity to prune all of the deprecated or just bad commands, and make things work better in general with worrying about old mods. The old mods would still work with "EDuke32" as intended, and those of us who care could port our old mods to "Eduke Pro" or whatever it's called without too much trouble.

I know it must be hard to stay motivated to work on EDuke32 if you feel that you can't make it what it should be because of maintaining compatibility with old projects.

I don't have an issue with the documentation per se; in fact the scripting wiki seems to explain fairly clearly what each .CON primitive does.

I suppose like 95% of noobs I want to go straight to "create a custom weapon". If I'm going to test my sanity learning something very foreign to me I want to at least be motivated to do it.

However, I realise that I'm turning several pages at once, and that I'll just have to persist with the pain learning lots of seemingly pointless and trivial things until I actually make something cool.

This is a good example of what I was up against early in my con code learning. There are many just like this.

The command seems very simple. Fill in a number for a sector and a sector tag. But where do I get those numbers from? It can't be as easy as taking the sector number shown in Mapster because those numbers are dynamic and can change. That leads me to believe there are more con commands that need to be included to get those 2 numbers to enter and to make use of the command. If so, the wiki should explain it right there and provide a small example.

Take the question "How can I add a new weapon through CON coding?". There are no existing tutorials on the subject.

there should be - nuances and all.
It's something a lot of first time script modders aspire to do. That and new enemies. Modified huds and equipment items are probably high on the wish-list as well.

I find it strange that after all these years, nobody has put together an extensive how-to for eduke32 script modding.
If I had two brain cells to rub together I would have got into scripting instead of making crappy maps.

This is a good example of what I was up against early in my con code learning. There are many just like this.

The command seems very simple. Fill in a number for a sector and a sector tag. But where do I get those numbers from? It can't be as easy as taking the sector number shown in Mapster because those numbers are dynamic and can change. That leads me to believe there are more con commands that need to be included to get those 2 numbers to enter and to make use of the command. If so, the wiki should explain it right there and provide a small example.

Hank: Somebody would have to keep me in check. There is a good chance I could become "the blind leading the blind" by posting wrong info. I noticed a number of times that when I was working with Mblackwell on my projects I would code something that worked but may not have been the "proper" way to do it. I don't want to pass on my bad habits.

there's more than one way to get results in script.
same as making a sloped sector in mapster - depends on which wall is the first wall. Opposite opposing walls of equal angles get the same result & both ways can be explained.

An example popped into my head. In Mapster I made it so a sound plays when the player enters a certain sector. Later on I wanted some more stuff to happen at the same time. I had recently looked in the wiki about game events. I decided to use an event to watch for when that sound played and then run my little block of code. It worked fine but for reasons I have forgotten, I was told it wasn't the proper way to accomplish my goal. So I'm afraid of putting more of that kind of thing in the wiki.