Global and Public Varibles

Discuss all aspects related to modding Zandronum here.
Post Reply
Elias79
New User
Posts: 7
Joined: Fri Mar 10, 2017 6:39 pm

Global and Public Varibles

#1

Post by Elias79 » Sat Mar 11, 2017 9:55 pm

Is there a way to store information even after the map is reset?

It tried to use a script to prevent player movement before the countdown in Co-op Survival but i cant prevent the OPEN and ENTER from running twice,
also the RETURN does not get triggered and REOPEN does not even want to compile, so how would i store mod data across maps and levels?

Code: Select all

#library "CVARS"
#include "zcommon.acs"

int counter = 0;

script 1001 OPEN
{
while (counter < 1000)
   {
   Delay(3);
   counter++;
   print(d:counter);
   Delay(3);
   }   
}
Last edited by Elias79 on Sat Mar 11, 2017 10:01 pm, edited 1 time in total.

User avatar
Fused
Contributor
Posts: 663
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

Re: Global and Public Varibles

#2

Post by Fused » Sat Mar 11, 2017 10:01 pm

I believe it's
global int 1:counter;

Just be sure to reset it back to 0 the second time or whatever so it doesnt mess up the third time.
My mods
Image Image

My socials
Image Image

Elias79
New User
Posts: 7
Joined: Fri Mar 10, 2017 6:39 pm

Re: Global and Public Varibles

#3

Post by Elias79 » Sat Mar 11, 2017 10:07 pm

Fused wrote:I believe it's
global int 1:counter;

Just be sure to reset it back to 0 the second time or whatever so it doesnt mess up the third time.
Im getting this error:

Code: Select all

CVARS.acs:4: Missing semicolon.
> global int 1:counter = 
>                      ^
And this is my code:

Code: Select all

#library "CVARS"
#include "zcommon.acs"

global int 1:counter = 0;

while (counter < 1000)
	{
	Delay(3);
	counter++;
	print(d:counter);
	Delay(3);
	}	
}
The while loop game me an Invalid declarator but when i put it in the OPEN script it worked, thank you.

User avatar
Fused
Contributor
Posts: 663
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

Re: Global and Public Varibles

#4

Post by Fused » Sat Mar 11, 2017 11:20 pm

You can't define zero to it. it has to be like I have it. That's why you have to reset it inside the script basically.
And yeah, you have to define you start a script or it will throw an error like that for example.
My mods
Image Image

My socials
Image Image

Post Reply