Weird impy thing
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 > 1 Time Only Script
 
Author
All times are GMT. The time now is 11:23. Post New Thread    Post A Reply
cyber-menace
Forum Regular


Posts: 922
Registered: 03-03


How do I make a script activate only once even if it is activated at different times by different triggers?

EDIT: 250 POSTS! Now I can use my own avatar. Phew, that took quite awhile.

Old Post 08-20-03 15:16 #
cyber-menace is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3743
Registered: 05-00


ACS_Execute will only allow one instance of the script to run at a time.
ACS_ExecuteAlways allows more than one instance of the script to run at a time.

__________________
this sig is in my pants | WIP - WADs In Progress: post your WADs!

Old Post 08-20-03 15:29 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
cyber-menace
Forum Regular


Posts: 922
Registered: 03-03


No, I mean once it has activated it will never activate again! That's what I meant.

Old Post 08-20-03 15:30 #
cyber-menace is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Cyb


Posts: 2726
Registered: 07-02


code:
int scr01 = 0; script 1 (void) { if(!scr01) { //do stuff here scr01 = 1; } }


that's about the most simple way, a more elegant way (I suppose) would be to give all the switches a lineid (via setlineid();) and then in an open script set their special (with setlinespecial();, they'd all have the same lineid and the same specials) and then do this:

code:
script 1 (void) { //do stuff setlinespecial(1, 0); }


which would set all the lines with lineid 1 to have special 0 (which is nothing)

Old Post 08-20-03 15:50 #
Cyb is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
cyber-menace
Forum Regular


Posts: 922
Registered: 03-03


That'll do. Thanks Cyb.

Old Post 08-20-03 16:10 #
cyber-menace is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
The Ultimate DooMer
(former) /newstuff Chronicler


Posts: 4449
Registered: 03-02


Or you could use a sector action thing (eg. Actor enters sector), give it a tid and then remove that thing at the start of the script.

Old Post 08-20-03 17:25 #
The Ultimate DooMer is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Epyo
Dude


Posts: 2921
Registered: 06-02


I tried that once. It didn't work.

__________________
Pacman Doom 2 Play with latest version of ZDoom!

Old Post 08-20-03 17:35 #
Epyo is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Cyb


Posts: 2726
Registered: 07-02


I do that all the time and it works just fine, Epyo, maybe you removed the wrong tid?

Old Post 08-20-03 18:04 #
Cyb is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Enjay
ASK ME ABOUT FOOTBALL / STEAM / DEAD CELEBRITIES / THE BLAIR WITCH PROJECT


Posts: 5595
Registered: 12-00



Cyb said:
a more elegant way (I suppose) would be to give all the switches a lineid (via setlineid();) and then in an open script set their special (with setlinespecial();



Elegant? Heh, I've been doing it that way for ages. I assumed it was a clunky "mechanical" way to do it. The reason I did it that way was I didn't really understand variables, so simply "switching off" the lines by changing their special was a surefire way for me to understand and know what was going on in my level. I didn't realise I was being elegant. :-)

__________________
Meek

Old Post 08-20-03 20:29 #
Enjay is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Cyb


Posts: 2726
Registered: 07-02


well it's all a matter of opinion I guess, using less vars is generally better than using them (less memory) plus if you clear the line then the switch can't be hit again. with the if(!scr01) method you can still hit the switch after you've used it the first time it's just that nothing happens. Actually, that's not true since it still runs the script and does comparison to check if scr01 is 0 (taking a couple extra cpu cycles, albeit not noticable to most if not all computers), so yeah, the clear line way is more elegant :) though it takes a bit more effort

Old Post 08-20-03 22:12 #
Cyb is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 11:23. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > 1 Time Only Script

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.

Forums Directory