Trouble with Line_SetBlocking

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
wereabbit
Posts: 53
Joined: Thu Mar 13, 2008 5:18 am

Trouble with Line_SetBlocking

Post by wereabbit »

Hello,
I have a trouble with these scripts :
The first block the line

Code: Select all

script 81 OPEN
{

 Line_SetBlocking (26, ON, BLOCKF_PLAYERS );

}
... and the second is supposed to unblock the line

Code: Select all

Script 90 (void)
{
	SetLineTexture (26, SIDE_FRONT, TEXTURE_MIDDLE, "-");
        Line_SetBlocking (26, OFF, BLOCKF_PLAYERS );
}
The first script works fine, sadely, the second script unblocked nothing (but he removed the texture ^^) .

So, what i have made wrong these scripts ?
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Trouble with Line_SetBlocking

Post by Jarewill »

Arguments in Line_SetBlocking work differently.
To set a blocking flag you need to specify which one in the second argument, like so: Line_SetBlocking (26, BLOCKF_PLAYERS , 0);
While if you want to clear it, you need to specify it in the third argument: Line_SetBlocking (26, 0, BLOCKF_PLAYERS );

Putting "OFF" instead of 0 seems to make it not work, but I am quite confused on why the first one works.
Talking about the first one, you don't even need it as you can set lines to block players in the map editor:
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Trouble with Line_SetBlocking

Post by ramon.dexter »

wereabbit wrote: Wed Aug 02, 2023 2:26 am Hello,
I have a trouble with these scripts :
The first block the line

Code: Select all

script 81 OPEN
{

 Line_SetBlocking (26, ON, BLOCKF_PLAYERS );

}
... and the second is supposed to unblock the line

Code: Select all

Script 90 (void)
{
	SetLineTexture (26, SIDE_FRONT, TEXTURE_MIDDLE, "-");
        Line_SetBlocking (26, OFF, BLOCKF_PLAYERS );
}
The first script works fine, sadely, the second script unblocked nothing (but he removed the texture ^^) .

So, what i have made wrong these scripts ?

Just to clarify, nothing is set and set off with words 'on' and 'off'. In IT, generally, when something is 'on', it is marked with 'true' or '1', but never 'on'. When something is 'off', it's 'false' or '0'.
wereabbit
Posts: 53
Joined: Thu Mar 13, 2008 5:18 am

Re: Trouble with Line_SetBlocking

Post by wereabbit »

Jarewill wrote: Wed Aug 02, 2023 2:53 am Arguments in Line_SetBlocking work differently.
To set a blocking flag you need to specify which one in the second argument, like so: Line_SetBlocking (26, BLOCKF_PLAYERS , 0);
While if you want to clear it, you need to specify it in the third argument: Line_SetBlocking (26, 0, BLOCKF_PLAYERS );
Thanks. Works fine now :D
ramon.dexter wrote: Wed Aug 02, 2023 4:07 am Just to clarify, nothing is set and set off with words 'on' and 'off'. In IT, generally, when something is 'on', it is marked with 'true' or '1', but never 'on'. When something is 'off', it's 'false' or '0'.
Thanks for the clarifications :D
User avatar
phantombeta
Posts: 2177
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Trouble with Line_SetBlocking

Post by phantombeta »

ramon.dexter wrote: Wed Aug 02, 2023 4:07 amJust to clarify, nothing is set and set off with words 'on' and 'off'. In IT, generally, when something is 'on', it is marked with 'true' or '1', but never 'on'. When something is 'off', it's 'false' or '0'.
This is not the case for ACS. ACS doesn't have a real boolean type, TRUE and FALSE are just defines. And zdefs.acs (included by zcommon.acs) happens to also have defines for ON/OFF and YES/NO that mean the same thing as TRUE/FALSE.
Post Reply

Return to “Scripting”