Page 1 of 1

Alternating Line Textures

Posted: Fri Jan 29, 2021 3:47 am
by Moebius
I created a console and assigned the first of three textures to it. The three textures are from D3 Textures Set and are nearly identical except for some small lights. Using Zscript I can get it to change from TXT1 to TXT2 to TXT3, but then it stops. How do I make it loop back and repeat the script?

script 4 (void) {
SetLineTexture (222, SIDE_FRONT, TEXTURE_BOTTOM, "CPNL3K0");
delay (17);
SetLineTexture (222, SIDE_FRONT, TEXTURE_BOTTOM, "CPNL3K1");
delay (17);
SetLineTexture (222, SIDE_FRONT, TEXTURE_BOTTOM, "CPNL3K2");
delay (17);
What do I need here to make it go back to the beginning of the script and repeat????
}

Re: Alternating Line Textures

Posted: Fri Jan 29, 2021 5:12 am
by Virathas
You could just add a "while" loop for it

Code: Select all

script 4 (void) 
{
while(1) // This will be a permanent loop, there are no conditions for it to stop, ever
{
SetLineTexture (222, SIDE_FRONT, TEXTURE_BOTTOM, "CPNL3K0");
delay (17);
SetLineTexture (222, SIDE_FRONT, TEXTURE_BOTTOM, "CPNL3K1");
delay (17);
SetLineTexture (222, SIDE_FRONT, TEXTURE_BOTTOM, "CPNL3K2");
delay (17);
}

}

Re: Alternating Line Textures

Posted: Fri Jan 29, 2021 5:12 am
by Gez
This looks like [wiki]ACS[/wiki], not [wiki]ZScript[/wiki]. You can put a [wiki]restart[/wiki] to have the script go back to its beginning, or put the whole set of instructions inside a [wiki]while[/wiki] (1) loop.

However, you could also remove the script entirely and instead use [wiki]ANIMDEFS[/wiki] to handle the animation cycle automatically.

Re: Alternating Line Textures

Posted: Fri Jan 29, 2021 1:24 pm
by Moebius
Thanks, Virathas and Gez. The while(1) works like I want it to. I'll have to explore ANIMDEF's for future maps.