Computer Science Canada

Delays

Author:  Mr. T [ Sun Jan 30, 2005 3:52 pm ]
Post subject:  Delays

How do you cancel a delay?

Author:  Neo [ Sun Jan 30, 2005 3:59 pm ]
Post subject: 

What do you mean cancel? Confused
If you mean take out the delay while the program is running then you could put the delay inside an if statement.

Author:  Mr. T [ Sun Jan 30, 2005 4:08 pm ]
Post subject: 

ya sorry, can u give me an example of using an if statement to stop a delay?

Author:  basketball4ever [ Sun Jan 30, 2005 4:16 pm ]
Post subject: 

Pwned wrote:
ya sorry, can u give me an example of using an if statement to stop a delay?


hmm... why would you want a delay to stop. You can set the delay right... so why would you want it to stop while the program in running... can you give like a piece of code so i can see what you're trying to do

Author:  person [ Sun Jan 30, 2005 4:25 pm ]
Post subject: 

u can probably do:

if (something) then
x := 0
end if
delay (x)

Author:  Mr. T [ Sun Jan 30, 2005 4:38 pm ]
Post subject: 

basketball4ever wrote:
Pwned wrote:
ya sorry, can u give me an example of using an if statement to stop a delay?


can you give like a piece of code so i can see what you're trying to do



<<anything above needs a delay of 10>>
delay (10)
cls
delay (0)
<<anythinmg below needs no delay>>

Author:  basketball4ever [ Sun Jan 30, 2005 4:45 pm ]
Post subject: 

k ...
so
code:
% all your code before that
var num:int
get num
if num >10 then
delay(10)
%you don't need an else delay (0) cos... thats like  :? :P
end if

that should work fine.

Author:  Cervantes [ Sun Jan 30, 2005 4:51 pm ]
Post subject: 

Is this inside a loop? If so, chances are you should only have one delay.

Author:  [Gandalf] [ Mon Jan 31, 2005 5:33 pm ]
Post subject: 

How about this question:
How would you let the user input something while a delay is running?

Author:  Cervantes [ Mon Jan 31, 2005 5:50 pm ]
Post subject: 

You don't. A delay is like getch: it halts the program until it's done. So, while the delay is on, the program is halted. Thus, you can't be running an Input.KeyDown line while the delay is on.

Author:  1337_brad [ Mon Jan 31, 2005 6:31 pm ]
Post subject:  But...

But a get statement would do the trick... it would delay until the user inputs a value.. or if you need the delay set to a specific time you could have the get statement and then the delay like so:
code:

var theget : string


put "enter something here"
get theget
Time.Delay(10)

Author:  ssr [ Mon Jan 31, 2005 8:37 pm ]
Post subject: 

How about just hasch
however, I got a question
ok how would u like enter a cheat while the program is running
like you can make teh program run
but if u enter something, it wont show, but it will print do the cheat after the code is fully entered

Author:  1337_brad [ Mon Jan 31, 2005 9:23 pm ]
Post subject:  You would have to...

Do it with processes... and then fork them, so that the game, and the getcheat command can run at the same time...

Author:  ssr [ Mon Jan 31, 2005 9:31 pm ]
Post subject: 

Quote:

Do it with processes... and then fork them, so that the game, and the getcheat command can run at the same time...

oh ya Thanx man, 1337_brad
helped out a lot

Author:  basketball4ever [ Mon Jan 31, 2005 10:41 pm ]
Post subject: 

ssr wrote:
Quote:

Do it with processes... and then fork them, so that the game, and the getcheat command can run at the same time...

oh ya Thanx man, 1337_brad
helped out a lot


do note that processes will cause alot of trouble.... you might wanna stay away from em... if i were you, i would just use a cheat menu...

Author:  Bacchus [ Mon Jan 31, 2005 11:10 pm ]
Post subject: 

you could try something like this:
code:
proc d(time:int)
    var t:int:=Time.Elapsed
    loop
        exit when Time.Elapsed-t >= time
        %stick whatever else you want in here
    end loop
end d
dunno about that might work, who knows Razz

Author:  [Gandalf] [ Tue Feb 01, 2005 12:19 pm ]
Post subject: 

I don't know if you already know this, but you would also need something like this so that what the user types doesn't show up on the screen.

setscreen("nocursor,noecho")

Author:  Bacchus [ Tue Feb 01, 2005 3:54 pm ]
Post subject: 

you only need noecho if your using getch so that it wont show then


: