Epyo Posted June 18, 2003 Ok so normally I'd figure this out myself but all the Zdoom wads with timers have the scripts locked away. SO, I want to make a script, that keeps time for how long the player has been in the level. So when the end of the level comes, I can make a hudmessage with your time in it. I was thinking of making some kind of variable? Like, poop? Then a script would add 1 to poop everysecond, and in the hudmessage at the end of the level I'd have poop. But I have no idea how to add to poop, or create poop, or put poop in the hudmessage. Is there anywhere I can learn this? Is this even possible? 0 Share this post Link to post
Fredrik Posted June 18, 2003 Ugh, I haven't done ACS in like two years, so this is probably all wrong, but it should be as simple as this: int poop; script 1 OPEN { poop = 0; while(1) { delay(35); poop++; } }Then just print poop at the exit, I don't know what the parameters for hudmsg are. 0 Share this post Link to post
Epyo Posted June 18, 2003 That's ok, I know hudmsg stuff, I'll go try this. 0 Share this post Link to post
boris Posted June 18, 2003 Or you could simply use the "timer()" function, which returns the level time in tics (i.e. to get seconds, divide the return value by 35). 0 Share this post Link to post
Fredrik Posted June 18, 2003 boris said:Or you could simply use the "timer()" function, which returns the level time in tics (i.e. to get seconds, divide the return value by 35). :) That was guessable. 0 Share this post Link to post
Epyo Posted June 18, 2003 So here's what I got:script 10 OPEN { int poop; poop = timer(); poop = poop/35; str poopfill; int rootbeer; rootbeer = thingcount(250, 0); if(rootbeer == 0) { hudmessage (s:"Your time is", s:poopfill, s:"seconds"; HUDMSG_FADEOUT , 0, CR_green, 0.5, 0.5, 16.0); hudmessage (s:"Par is 90 seconds"; HUDMSG_FADEOUT , 0, CR_brick, 0.5, 0.6, 16.0); delay(595); exit_normal(0); } delay(1); restart; }but then it always says at the level's end: "Your time is bullets seconds". What's up? 0 Share this post Link to post
Graf Zahl Posted June 18, 2003 Simple! You want to print poopfill as an integer not a string. It must read: hudmessage (s:"Your time is", i:poopfill, s:"seconds"; HUDMSG_FADEOUT , 0, CR_green, 0.5, 0.5, 16.0); 0 Share this post Link to post
The Ultimate DooMer Posted June 18, 2003 How would you do a counter that went up by 1 (or down by 10) every time you picked something up? 0 Share this post Link to post
boris Posted June 18, 2003 Well, you'd have to give all things' special to ACS_Execute and let it call a script that increments or decrements some value. 0 Share this post Link to post
Epyo Posted June 18, 2003 Or what if the special of each item was to spawn a monster in a secret room far from the rest of the map. Each item would have it's own monster tid and spawnpoint tid. A "thingcount(monster, 0)" would count the monsters in the secret room, and the answer to the thingcount would be put into a hudmessage. There's your counter! Well I guess that's too complicated, boris's idea is probably easier and better. The monsters would start something likescript 666 (void) { counter++; } Yep, when you want the counter to go down you'd use something like counter--, wow there's so much to do with this ++ -- /x == *x stuff, this is all new to me! 0 Share this post Link to post
Cyb Posted June 19, 2003 c++ is the same as c = c + 1; c-- is the same as c = c - 1; c += x; is the same as c = c + x; c -= x; is the same as c = c - x; (same works for *= and /=) so naturally, c += 1; and c++; are the same thing. then there's also ++c; which incriments c before it's been used (preincriment, c++ is called a postincriment) in a loop (for instance: c = 1; while(++c < 10) {} will start the while loop with c == 2 and then you have stuff like || which means 'or' and && which means 'and' which are very useful for whiles and ifs and stuff more still, there's == which is equivalent (not to be confused with =, which is assignment) and also != which is 'not equal to', and you can also use ! to negate things so if(!var) would only execute the statements in the if block if var is 0. got it?! :P btw: int poop = timer() / 35; is perfectly valid 0 Share this post Link to post