Page 54 of 123

Re: ZScript Discussion

Posted: Mon Dec 05, 2016 4:56 pm
by Rachael
@Graf: Do you want me to pull from your gz-zscript branch, or is that just experimental for you?

Re: ZScript Discussion

Posted: Mon Dec 05, 2016 5:12 pm
by Graf Zahl
No, that's just the latest version from yesterday merged into ZDoom so that I could do a compile myself for some actual playing. But you should do an update from ZDoom before compiling.

Re: ZScript Discussion

Posted: Mon Dec 05, 2016 5:39 pm
by Nash
Xaser wrote:Oh, that's interesting. Could that function be used to set an actor's sprite property directly via something like:

Code: Select all

self.sprite = GetSpriteIndex("SHTG");
?

(Can't test that code presently but that seems to be way thingdef_states.cpp is using said function internally. This would be extremely useful for a thing I'm planning on making).
Graf Zahl wrote:Yes, that should work.
YOOOOO that is amazing. :O :O :O
D2JK wrote:Suggestion: could someone please make a wiki page or section about iterators, documenting any of the following:

- brief introduction, their purpose, and how they work
- iterator types (ActorIterator, ThinkerIterator, anything else?)
- what sort of task does each type excel at
- perhaps a brief explanation of the performance cost
- usage instructions, the options available, example code

Yes please; I would like a noob-friendly tutorial on how to use the scripted iterators.

Re: ZScript Discussion

Posted: Mon Dec 05, 2016 5:51 pm
by Rachael
Graf Zahl wrote:No, that's just the latest version from yesterday merged into ZDoom so that I could do a compile myself for some actual playing. But you should do an update from ZDoom before compiling.
My auto-update script usually takes care of that. As of now, it's up-to-date.

Re: ZScript Discussion

Posted: Mon Dec 05, 2016 6:03 pm
by Major Cooke
Nash wrote:
D2JK wrote:Suggestion: could someone please make a wiki page or section about iterators, documenting any of the following:

- brief introduction, their purpose, and how they work
- iterator types (ActorIterator, ThinkerIterator, anything else?)
- what sort of task does each type excel at
- perhaps a brief explanation of the performance cost
- usage instructions, the options available, example code

Yes please; I would like a noob-friendly tutorial on how to use the scripted iterators.
I'll do it when I get home. It's actually pretty easy. And BlockThingsIterator too.

Re: ZScript Discussion

Posted: Mon Dec 05, 2016 7:42 pm
by ZzZombo
Are overloaded functions planned?

Re: ZScript Discussion

Posted: Mon Dec 05, 2016 8:26 pm
by Rachael
Actually - I had asked this before.

Subject: ZScript Discussion
Graf Zahl wrote:Function overloading is an ugly can of worms I won't touch. I think named arguments will be more than enough to handle such things.

Re: ZScript Discussion

Posted: Tue Dec 06, 2016 2:36 am
by Graf Zahl
To elaborate on that, function overloading is one of the most problematic things because it needs to make some educated decisions which overload to use if the parameters do not match 100%. And this can turn ugly. Even C++ has its share of misses here that would cause some non-trivial bugs. In 99% of all use cases you are better off naming the functions differently (like ZDoom already did internally with the SpawnMissile family) and the rest can be dealt with with named and default arguments.

Re: ZScript Discussion

Posted: Tue Dec 06, 2016 4:07 am
by Graf Zahl
Quick note:

I just fixed a major bug with the chainsaw in the scripting branch, so I think I am pulling up the merge because that one's too important and I see no point applying the same fix to the old code a few days before it goes away. I'm giving this a few more hours but this evening I''ll merge it back to master.

Re: ZScript Discussion

Posted: Tue Dec 06, 2016 4:55 am
by Rachael
I've gone ahead and started the build for what might be the last GZZScript build then. :P

Re: ZScript Discussion

Posted: Tue Dec 06, 2016 5:13 am
by ZZYZX
Graf Zahl wrote:To elaborate on that, function overloading is one of the most problematic things because it needs to make some educated decisions which overload to use if the parameters do not match 100%.
No 100% match for overloaded method = compiler error.

Re: ZScript Discussion

Posted: Tue Dec 06, 2016 5:20 am
by Graf Zahl
That's not possible because some types can be implicitly converted. And the rules for this are some of the most obtuse in C++, it's a mess I'd like to avoid.

Re: ZScript Discussion

Posted: Tue Dec 06, 2016 6:02 am
by ZzZombo
Eh, eh eh eh. I hope you at least won't declare it set in stone for the week, as per your previous post, should a design issue arise. BTW, where am I supposed to grab the latest ZScript build? ZDoom/GZDoom, no difference for me.

Re: ZScript Discussion

Posted: Tue Dec 06, 2016 6:24 am
by Rachael
https://devbuilds.drdteam.org/gzzscript/ if you can't/don't want to compile it yourself.

Re: ZScript Discussion

Posted: Tue Dec 06, 2016 6:42 am
by ZZYZX
Graf Zahl wrote:That's not possible because some types can be implicitly converted. And the rules for this are some of the most obtuse in C++, it's a mess I'd like to avoid.
I meant disabling this specifically for the overloaded methods. People should use proper types anyway.