ACS_ExecuteWithResult doesn't support named scripts

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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
CoderGrizzly
Posts: 8
Joined: Sun Jan 05, 2025 12:38 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: ATI/AMD (Modern GZDoom)

ACS_ExecuteWithResult doesn't support named scripts

Post by CoderGrizzly »

Hello everyone, 🖖

it seems that ACS_Execute supports script numbers as well as named scripts - but ACS_ExecuteWithResult does not.
Not sure if it is a bug or simply an inconsistency, but I want to bring it to everyone's attention.

Code: Select all

#include "zcommon.acs"

script "test1" OPEN {
	int value = ACS_ExecuteWithResult("test2", 1, 2);
	Log(s:"Value : ", d:value);
}

script "test2" (int x, int y) {
	int result = x + y;
	SetResultValue(result);
}
The script above gives me the following message in the GZDoom console:
P_StartScript: Unknown script 2
Value : 0
Interestingly - also it can't call the script, even says it is unknown - it is able to identify that "test2" is actually the 2nd script. 😉
Also the checks of the Script Editor in the Ultimate Doom Editor says that the above script is valid (but maybe it simply due to the fact that it's checks don't cover such a case 🤷 ).

Any thoughts on this?
User avatar
CoderGrizzly
Posts: 8
Joined: Sun Jan 05, 2025 12:38 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: ACS_ExecuteWithResult doesn't support named scripts

Post by CoderGrizzly »

Okay, I take everything back about ACS_Execute. It also doesn't support named script and gives exactly the same error message. 😔
Somehow I thought it would support it... Anyway, then I extend my report to all execution functions. 😏
User avatar
Enjay
 
 
Posts: 27047
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: ACS_ExecuteWithResult doesn't support named scripts

Post by Enjay »

All the ACS_* commands have named execute alternatives. e.g. ACS_NamedExecute, ACS_NamedExecuteWithResult and so on. Does that cover what you need?

https://zdoom.org/wiki/Category:ACS_Script_functions
User avatar
CoderGrizzly
Posts: 8
Joined: Sun Jan 05, 2025 12:38 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: ACS_ExecuteWithResult doesn't support named scripts

Post by CoderGrizzly »

Enjay wrote: Sun Jan 05, 2025 7:20 am All the ACS_* commands have named execute alternatives. e.g. ACS_NamedExecute, ACS_NamedExecuteWithResult and so on. Does that cover what you need?

https://zdoom.org/wiki/Category:ACS_Script_functions
I'm sorry, I'm so dump. 🤦
Yeah, those functions are even one of the first Built-in ACS functions.
Very embarrassing... Guess I was fighting my other problems so much, I somehow didn't see it. 😑

But anyway, thanks @Enjay a lot. Much appreciated. 🙏
Post Reply

Return to “Scripting”