Spider Mastermind
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > ACS switch question.
 
Author
All times are GMT. The time now is 00:43. Post New Thread    Post A Reply
neubejiita
Forum Regular


Posts: 673
Registered: 02-09


Hello. I have a switch in a Zdoom UDMF map that triggers a Blue key specific script.

code:
script 2 (void) { if (CheckInventory("BlueSkull")) { Elevator_RaiseToNearest(17, 8); Floor_LowerToLowest(18, 8); // More code here } else Print(s:"You need the Blue skull key to enter."); }
.

But if I do not have the key, the switch will trigger and then I cannot trigger it again once I have the key. Is there a way to make this triggerable once only; but put in a condition where the Script_Execute() function will check for a key? This function must not be repeatable.

Old Post 04-01-13 06:26 #
neubejiita is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
pablogener
Mini-Member


Posts: 87
Registered: 11-12


you could set up a global variable, and give it a value the first time you run through your function. if it's the second or forth-on time you're in for the function, you would exit it without doing anything. I would do sth like this:

int myFlag = 0

script 1 (void)
{
if (myFlag == 0)
{
myFlag = 1;
//loads of code here...
}


}

Old Post 04-01-13 06:42 #
pablogener is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Graf Zahl
Why don't I have a custom title by now?!


Posts: 7734
Registered: 01-03


You should use ACS_LockedExecute for stuff like this. If you want a different message than the standard one you can define a new lock in LOCKDEFS for that purpose.

Then you won't have to check the key yourself in your script.

Old Post 04-01-13 07:43 #
Graf Zahl is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Blue Shadow
Member


Posts: 293
Registered: 09-12



neubejiita said:
Is there a way to make this triggerable once only; but put in a condition where the Script_Execute() function will check for a key? This function must not be repeatable.
There is, with ACS_ExecuteWithResult (see the paragraph above the second example in the page).

-----

Edit: I should've mentioned that this is just an alternate solution, and on second thought, I think it's easier to go with what Graf suggested above.

Last edited by Blue Shadow on 04-01-13 at 15:40

Old Post 04-01-13 14:23 #
Blue Shadow is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 00:43. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > ACS switch question.

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.