String from ACS to DECORATE?

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!)
User avatar
Bilbö Bägginson
Posts: 30
Joined: Mon Nov 30, 2020 11:11 pm
Graphics Processor: nVidia with Vulkan support

String from ACS to DECORATE?

Post by Bilbö Bägginson »

Is there any way to pass a string from ACS to an action function in DECORATE?

I am trying to control the "state" parameter in a_jump function via ACS:
Something like this:

DECORATE:

Code: Select all

NULL A 0 A_Jump(256, callacs("GetStateName"))
ACS:

Code: Select all

script "GetStateName" (void)
{
 int Result = "Ready";
 SetResultValue(Result);
}
User avatar
TDRR
Posts: 824
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

Re: String from ACS to DECORATE?

Post by TDRR »

No, this isn't possible (you can't really return a string from ACS to DECORATE, nor can you even pass in a dynamic value to A_Jump's target). You can just use SetActorState to achieve the same effect, though.
User avatar
Bilbö Bägginson
Posts: 30
Joined: Mon Nov 30, 2020 11:11 pm
Graphics Processor: nVidia with Vulkan support

Re: String from ACS to DECORATE?

Post by Bilbö Bägginson »

You can just use SetActorState to achieve the same effect, though.
Yes, but I want to do it for weapon actor, and SetActorState doesn't work for them. Thanks anyway
nor can you even pass in a dynamic value to A_Jump's target

Got it
User avatar
TDRR
Posts: 824
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

Re: String from ACS to DECORATE?

Post by TDRR »

This is kind of an evil hack, but the Held state (which I believe is also available on the Weapon class) allows you to call action functions on the weapon/item. You could maybe wrangle that in some way to use SetActorState on the weapon. The challenge here is that in this context, you don't have access to the player.
User avatar
Bilbö Bägginson
Posts: 30
Joined: Mon Nov 30, 2020 11:11 pm
Graphics Processor: nVidia with Vulkan support

Re: String from ACS to DECORATE?

Post by Bilbö Bägginson »

What's the Held state? Couldn't find anything on wiki.
User avatar
TDRR
Posts: 824
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

Re: String from ACS to DECORATE?

Post by TDRR »

It's a state literally called "held". It's run every tic you have the item. Like Pickup/Use on CustomInventory but instead run every tic an actor has said item.

Return to “Scripting”