Script arguments cannot be string?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Cjk10000
Posts: 98
Joined: Fri Jan 02, 2009 10:13 am

Script arguments cannot be string?

Post by Cjk10000 »

Code: Select all

str DefineMeTest; // Is there an error here? Nope :(
script 12 (str NameOfMonster) // <--- ERROR HERE
{
    print (s: NameOfMonster);
}
I tried using strings for other parts of my script and they didn't work [compiler said its invalid type]. So I made up this quick test procedure to call from Decorate and I wasn't able to use strings at all. I can use int and bool's, but why not string?

Am I coding it wrong?
Or can ACS not support string input? I tried searching the wiki for what scripts can accept in argument boxes but couldn't resolve my issue.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Script arguments cannot be string?

Post by NeuralStunner »

Cjk10000 wrote:Or can ACS not support string input?
Bingo.

In short, all strings in ACS are actually included in the compiled code. There's a list of strings, each with a number. "String variables" in ACS aren't that, in the technical sense: They're integer variables to tell which string in the table to return when that string is referenced.
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Re: Script arguments cannot be string?

Post by Isle »

you can pass "strings" to scripts, just do (int NameOfMonster).
User avatar
Salad Viking
Posts: 752
Joined: Tue Apr 20, 2010 8:58 pm
Location: In high orbit

Re: Script arguments cannot be string?

Post by Salad Viking »

I'm pretty sure you can't use string arguments for scripts because you can't have a string as the argument for a linedef (see [wiki]ACS_Execute[/wiki] and variants). You can use them all you want for functions, however.
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

Re: Script arguments cannot be string?

Post by Ceeb »

Not if you call ACS_Execute or one of it's variants from another script.
Locked

Return to “Editing (Archive)”