I was searching for this, but there's just so much information around, I'm not sure how to pin point the solution, if there's one...
Something like that?
script "window" (str NAME)
{
SetLineTexture(100,SIDE_FRONT,TEXTURE_MIDDLE,"textures/NAME.png");
SetLineTexture(100,SIDE_BACK,TEXTURE_MIDDLE,"textures/NAME.png");
}
Gives me an error, int works well ofc.
Can ACS take strings from the linedef panel?
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!)
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!)
-
- Posts: 59
- Joined: Wed Feb 03, 2016 1:45 pm
- Location: Sweden
-
-
- Posts: 1707
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
Re: Can ACS take strings from the linedef panel?
First of all, I'm pretty sure you don't have to explicitly add the folder name and extension when supplying a texture name to SetLineTexture: e.g. "textures/NAME.png" instead of just "NAME".
And second, I'm also quite sure that ACS scripts do not support string arguments. I'm afraid this cannot be worked around entirely, but depending on your use case, you may want to use a function instead of a script. This will work:
Obviously, you can only call this function from other scripts, and not directly from the map, but perhaps you don't even need the latter? In case you do, you are still limited to passing ints as arguments to your script, but you can create a mapping from integer constants to texture names:
Note that this is still not very convenient, as you have to use the raw numerical values for arguments when setting up the "script execute" special in the map editor, instead of the named constants you've #defined in your ACS code. But at least it works.
And second, I'm also quite sure that ACS scripts do not support string arguments. I'm afraid this cannot be worked around entirely, but depending on your use case, you may want to use a function instead of a script. This will work:
Code: Select all
function void window(str textureName)
{
SetLineTexture(100,SIDE_FRONT,TEXTURE_MIDDLE,textureName);
SetLineTexture(100,SIDE_BACK,TEXTURE_MIDDLE,textureName);
}
Code: Select all
#define TEX_SOMETEX1 1
#define TEX_SOMETEX2 2
...
script "window" (int textureIndex)
{
str textureName;
switch (textureIndex)
{
case TEX_SOMETEX1:
textureName = "SOMETEX1";
break;
case TEX_SOMETEX2:
textureName = "SOMETEX2";
break;
...
default:
terminate; // Or use some default texture name instead
}
SetLineTexture(100,SIDE_FRONT,TEXTURE_MIDDLE,textureName);
SetLineTexture(100,SIDE_BACK,TEXTURE_MIDDLE,textureName);
}