Pukename cannot pass strings to scripts as arguments

Moderator: GZDoom Developers

Post Reply
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Pukename cannot pass strings to scripts as arguments

Post by Nash »

Code: Select all

script "Cheat_ChangeLevel" (str levelName) net
{
    PrintBold(s:levelName);
    _Level_Change(levelName, "");
}
 
When I try to invoke this script using PukeName, levelName will always be empty.

[EDIT]

Example WAD: https://dl.dropboxusercontent.com/u/473 ... t_test.pk3

ENTER script: works
Press the switch: works
From the console, pukename "Test" "test string": does not work
Last edited by Nash on Sat May 07, 2016 12:11 pm, edited 1 time in total.
User avatar
Zhs2
Posts: 1271
Joined: Fri Nov 07, 2008 3:29 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Maryland, USA, but probably also in someone's mod somewhere
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by Zhs2 »

Since when have we been able to pass strings from anything else into ACS?
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by Nash »

ACS_NamedExecuteAlways("Script_Blah", 0, "my test parameter"); perfectly works though.

In my example in the OP, the string is completely empty.
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by NeuralStunner »

Nash wrote:ACS_NamedExecuteAlways("Script_Blah", 0, "my test parameter"); perfectly works though.
From where?
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: Pukename cannot pass strings to scripts as arguments

Post by Edward-san »

Can you add the wad containing such script?
User avatar
Zhs2
Posts: 1271
Joined: Fri Nov 07, 2008 3:29 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Maryland, USA, but probably also in someone's mod somewhere
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by Zhs2 »

So far as I know, yes, strings created and indexed in ACS are perfectly capable of being referenced anywhere by ACS in the same session. However, it is not possible to pass along a string as an argument in DECORATE, and the only other valid location for strings are specialized line functions that take classnames as arguments (arg0str). I wouldn't believe the console has any power over the ACS string table either, considering the paradigm.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by Nash »

Added example file to the OP.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Pukename cannot pass strings to scripts as arguments

Post by Graf Zahl »

Moved to feature suggestions. This isn't really a bug.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by Nash »

Thanks! While this is being moved to feature suggestions, is it possible to allow passing string parameters to the script specials in UDMF? arg1str arg2str maybe?
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by NeuralStunner »

Nash wrote:arg1str arg2str maybe?
Might as well stringify all of 'em while we're at it. [wiki]ACS_ExecuteWithResult[/wiki] does use arg1 for the script name (and is useful on switches). And of course, full support for string arguments will need them, too.
User avatar
MartinHowe
Posts: 2022
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by MartinHowe »

Isn't this ultimately a duplicate or near-relative of the one I posted a while back? Being able to set arg?str from a line?
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by Nash »

Hey Graf why was this closed? You were the one who suggested it be a feature suggestion.

I'd still like this, if there's no other way to do it. I basically want to assign a line in the map editor whose the first string argument is the name of the map to teleport to...


D'oh I'm dumb, the other thread by MartinHowe is still open.

The thread tag confused me. Should've been [Duplicate]
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Pukename cannot pass strings to scripts as arguments

Post by Graf Zahl »

That tends to happen when you do mass-cleanup...
User avatar
Rachael
Posts: 13558
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Pukename cannot pass strings to scripts as arguments

Post by Rachael »

Fixed the tag.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”