Cacodemon
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 > "X" Switches to go
 
Author
All times are GMT. The time now is 02:49. Post New Thread    Post A Reply
Tormentor667
Senior Member


Posts: 1986
Registered: 10-00


Hello again, I have a new script request for my ZDoom map. This time I'm looking for a script with which I can do these nice //"x" more to go// effects. What I mean? You place 3 switches in a map and you have to activate all of them to execute another operation. Each time you push one, a hudmessage appears, telling you how many switches are still left do push :)

I need 3 of them. I hope somebody here will be that kind to tell me how to do this (plz. complete script :D)

Old Post 12-22-02 21:41 #
Tormentor667 is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
rf`
Dr. Nosign


Posts: 8217
Registered: 11-01


Mind you, I'm not really good, and this is partly guesswork, but I understand the basics enough to to this. (and I'm not sure on setting up some things)

code:
script 0 OPEN { int var switch1; switch=0; { if switch1=1; hudmessage(c:Two more to go;); { if switch=2; hudmessage(c:One more to go;); { if switch=3; hudmessage(c:Sequence complete!;); switch 1++ { if switch=4; break; { else; repeat; } } } } } } script 1 void { switch1 1++ }


Mind you, I haven't had much practice, but you get the idea. (some of the syntax is iffy, like the addition)

__________________
Released wads and other doom crap

Old Post 12-22-02 21:57 #
rf` is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3630
Registered: 05-00


Assign each switch line the special "ACS_Execute" with script 1 as first argument. This will work for 3 switches. If you want more switches, just increase the number in count[2] and add more strings between the { }. I.e. for 4 swtiches you would write str count[3]={"three", "two", "one"};. Oh, and don't forget to also increase the number in if(c == 2) to the number you need.

code:
#include "zcommon.acs" str count[2]={"two", "one"}; int c; script 1 (void) { if(c == 2) { print(s:"do some fancy stuff here"); } else { print(s:count[c], s:" more to go"); c++; } }

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

Old Post 12-22-02 22:17 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Tormentor667
Senior Member


Posts: 1986
Registered: 10-00


Thx alot guys, works fine :)

Old Post 12-22-02 22:45 #
Tormentor667 is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
deep
as in Deepsea


Posts: 1066
Registered: 09-01


Use "switch" and "case" statements - easier to read, modify, etc.

//=== start example ==
switch(switch1) // just using the name you used
{

case 1: // doesn't have to start at 1
blahblah // nor in sequence
break; // this exits switch code
case 2: // and goes to "next"
more stuff
break;
case ...:
whatever
break;
}

"next" code

//=== end example

You can also put all the strings in one set (as I did with the clock). use messages[switch1] instead of "stringtext". Again cleaner:)

str messages[12]=
{ "first message",
"second message",
"third message",
and so on till you have 12 or whatever
};

In your original, be sure to use "==" not "=" if you want to compare.

Old Post 12-23-02 17:18 #
deep is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 02:49. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > "X" Switches to go

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.