Jump to content
  • 0

Scriptproblem/Bug (?) with counters in ACS.


Lanie

Question

Posted (edited)

Dear Doomers,

 

i have a problem. I made a barrier that should open by pushing three separate buttons. For this i used a script in ACS. Map is in UDMF/GZDOOM.

 

Here is one example for one the three buttons:

 

script (31) (void) {

a = a +1;

if(a == 3)
    {
        SetLineTexture(10, SIDE_BACK, TEXTURE_BOTTOM, "Red");
        Floor_LowerToNearest(21,100);

        }

}

 

Of course the map/script starts with global int 0:a;

 

So far so good. So where is the problem? Well, if i start my map right in the room where the buttons are, there is no problem and everything works fine. But if i start my map from the beginning and fight my way to the part with the three buttons, the script does not seem to work.

 

Can you help me out? Got any ideas?

 

Have a good day,

Lanie.

Edited by Lanie

Share this post


Link to post

5 answers to this question

Recommended Posts

  • 0
Posted (edited)
6 hours ago, Lanie said:

Of course the map/script starts with global int 0:a;

 

Global varables aren't reset even in between hubs. If you really need one make sure you aren't using it elsewhere.

 

You could do self diagnostics tests :P Either add an this extra line in all your switch scripts to show the value after triggering one:

 

script (31) (void) {

a = a +1;
print(d:a);

if(a == 3)
...


Or monitor the value all the time:

 

global int 0:a;

 

script 200 OPEN {
print(d:a); delay(35);

restart;
}

Edited by redEYE
typo

Share this post


Link to post
  • 0
On 6/8/2024 at 3:42 PM, redEYE said:

 

Global varables aren't reset even in between hubs. If you really need one make sure you aren't using it elsewhere.

  

You could do self diagnostics tests :P Either add an this extra line in all your switch scripts to show the value after triggering one:

 

script (31) (void) {

a = a +1;
print(d:a);

if(a == 3)
...


Or monitor the value all the time:

 

global int 0:a;

 

script 200 OPEN {
print(d:a); delay(35);

restart;
}

 

Hey! I will try this at the weekend! Thank you.

Share this post


Link to post
  • 0
Posted (edited)
On 6/8/2024 at 3:42 PM, redEYE said:

 

Global varables aren't reset even in between hubs. If you really need one make sure you aren't using it elsewhere.

 

You could do self diagnostics tests :P Either add an this extra line in all your switch scripts to show the value after triggering one:

 

script (31) (void) {

a = a +1;
print(d:a);

if(a == 3)
...


Or monitor the value all the time:

 

global int 0:a;

 

script 200 OPEN {
print(d:a); delay(35);

restart;
}

 

What would be the alternative to a global value in this case?

 

Anyway, i used your method and i found out that the numbers are going up after the first 5 or 10 seconds of the map. This is odd.

Edited by Lanie

Share this post


Link to post
  • 0
Posted (edited)

I got clue - and another mistery! The global value >a< is raised when the player is crossing a linedef that does raise the global value of >b<. But...why is this so? Is this a topic for another thread? I need some help. :(

Edited by Lanie

Share this post


Link to post
  • 0
Posted (edited)

Solved! I changed the global values to int a = 0.

Edited by Lanie

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...