ZScript Discussion

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Re: ZScript Discussion

Postby Rachael » Mon Dec 05, 2016 4:56 pm

@Graf: Do you want me to pull from your gz-zscript branch, or is that just experimental for you?
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: ZScript Discussion

Postby Graf Zahl » Mon Dec 05, 2016 5:12 pm

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby Nash » Mon Dec 05, 2016 5:39 pm

Xaser wrote:Oh, that's interesting. Could that function be used to set an actor's sprite property directly via something like:
Code: Select allExpand view
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.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: ZScript Discussion

Postby Rachael » Mon Dec 05, 2016 5:51 pm

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.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: ZScript Discussion

Postby Major Cooke » Mon Dec 05, 2016 6:03 pm

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.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript Discussion

Postby ZzZombo » Mon Dec 05, 2016 7:42 pm

Are overloaded functions planned?
ZzZombo
 
Joined: 16 Jul 2012

Re: ZScript Discussion

Postby Rachael » Mon Dec 05, 2016 8:26 pm

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.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: ZScript Discussion

Postby Graf Zahl » Tue Dec 06, 2016 2:36 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby Graf Zahl » Tue Dec 06, 2016 4:07 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby Rachael » Tue Dec 06, 2016 4:55 am

I've gone ahead and started the build for what might be the last GZZScript build then. :P
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: ZScript Discussion

Postby ZZYZX » Tue Dec 06, 2016 5:13 am

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.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

Re: ZScript Discussion

Postby Graf Zahl » Tue Dec 06, 2016 5:20 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby ZzZombo » Tue Dec 06, 2016 6:02 am

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.
ZzZombo
 
Joined: 16 Jul 2012

Re: ZScript Discussion

Postby Rachael » Tue Dec 06, 2016 6:24 am

https://devbuilds.drdteam.org/gzzscript/ if you can't/don't want to compile it yourself.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: ZScript Discussion

Postby ZZYZX » Tue Dec 06, 2016 6:42 am

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.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: Google [Bot] and 1 guest