Author Topic: Time issue  (Read 3009 times)

0 Members and 1 Guest are viewing this topic.

Offline gennadiy

Time issue
« on: March 23, 2004, 02:56:09 AM »
Is it possible to add time to your game, like you have 5 minutes to complete the quest or sth?, so what I mean is that time counts from 5 minutes to zero and when it reaches zero then the quest or mission is failed?  ???



Offline Brian Provinciano

Re:Time issue
« Reply #1 on: March 23, 2004, 02:57:58 AM »
Yes, you can look in the docs at the time variables. As well, you can look in such games as Space Quest for how it's done.

Offline Allen

Re:Time issue
« Reply #2 on: March 23, 2004, 03:12:20 AM »
For a timer counting down, try something like this. This code is buggy, because I have no reference right now.
Code: [Select]

if(v12 == 0){   // where v12 is minutes
v30 = 5;        // where 5 is the time you want to count down from
}

if(v11 >= 1){  //v11 is seconds
v31--;          //minuses 1 every second.
}

if(v31 == 0){
v30--;         //takes one minute
v31 = 60;    //sets the seconds back to 60.
}

if(v30 == 0){ // if the minutes are zero
print("THE END");
}
You could also try,
Code: [Select]

if(v12 == 5){
print("THE END");
}
http://www.mizpro.co.uk
The new home of Mizar Productions.

It is a sign!

Offline Sami Tervo

Re:Time issue
« Reply #3 on: March 23, 2004, 05:09:30 AM »
Here's lil modification of timecode from my own project.

if(f5){
  load.pic(v0);
  draw.pic(v0);
  discard.pic(v0);
  show.pic();

  reset(f40);
  reset(f41);
  v40 = 0;
  v41 = 0;

  v42 = 5; // Time left (minutes)
  v43 = 0; // Time left (seconds)
}
// Minutes
if(v12 != v40){
  v40 = v12;
  set(f40);
}
if(f40){
  v41--;
  v43 = 60;
}
reset(f40);

// Seconds
if(v11 != v42){
  v42 = v11;
  set(f41);
}
if(f41){
  v43--;
}
reset(f41);

display(24,2," Time remaining [ %v41:%v43 ]  ");

if(v41 == 0 && v43 == 0){print("You ran out of time!");}

return();
« Last Edit: March 23, 2004, 05:17:04 AM by Sami Tervo »
Apocalyptic Quest [ http://apocalypticquest.cjb.net ] No Mutants Allowed [ http://www.nma-fallout.com ] Batmud [ http://www.bat.org ]


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.027 seconds with 17 queries.