PDA

View Full Version : DEVELOPERS! I have a simple question about Unreal Script.


KewlAzMe
2nd Apr 2003, 05:11 PM
I need to know the command for wait or delay. I want to delay an action by 1 second. For example... when i hit a button, I want there to be a 1 second delay before its action. Is there a command? or will i have to make a timer function. Do any of you happen to have a simple timer function?

Thwark
2nd Apr 2003, 06:22 PM
Technical forum pls thx

Curunir
2nd Apr 2003, 07:11 PM
Technical forum pls thx

Wow... Maybe he is leaving. He doesn't even finish his sentences anymore...

KewlAzMe
2nd Apr 2003, 10:58 PM
nah he finished it.. you just have to learn how to speak "thwarkanese"

Technical forum pls thx

translation"

Post these kinds of topics on the technical forum kewlazme you dumbass.

The_Dan
3rd Apr 2003, 02:34 PM
Hmm, it always helps to know exactly what you're trying to achieve, but if you want to wait for a defined period of seconds, the Timer function is normally best.

KewlAzMe
3rd Apr 2003, 03:18 PM
Hmm, it always helps to know exactly what you're trying to achieve, but if you want to wait for a defined period of seconds, the Timer function is normally best.

can you give me a simple little loops that waits 5 secs and then exits?

I want to run a timer () in the middle of another script..so i want to call that function.. loop for 5 seconds..then exit and return to the script. I dont know UScript that good yet but ive narrowed a problem down that needs a timer and I figured its just syntax that im missing.

Bloody-Reaper
3rd Apr 2003, 03:20 PM
Dispatcher owns j001

The_Dan
3rd Apr 2003, 03:40 PM
Ooh, just noticed:

Sleep( TimeInSeconds );

Pretty self-explanitory

Thx to BR, for pointing that one out.

KewlAzMe
3rd Apr 2003, 04:01 PM
Sweet! thanks.

-EDIT- Im getting "Sleep is not allowed here" error. I tried putting it in an 'If' function..and outside an 'if' function. Neither of them were "allowed". Are there special areas I have to put them?
[code:1:0d1d098660]
sleep(10);
if(blah != None)
{
Testvariable = nochange;

if (blurg == None)
ChangedBlah();
sleep(4);
else if ( Blurg != nochange )
ChangedBlurg();
sleep(5);
}[/code:1:0d1d098660]

Thats an example of a function Im trying to use it in.

!eduDageM
3rd Apr 2003, 04:23 PM
I always seem to get "sleep is not allowed here errors" in pubs and clubs around closing time.

The_Dan
3rd Apr 2003, 04:36 PM
Hmm, I'm too tired to work out why that doesn't work, so I'll just leave this method aswell:

SetTimer(x , false);

will cause the Timer function to be called in x seconds time

& then use:

function Timer() {
//Script goes here
}


to define what will happen after x seconds

KewlAzMe
3rd Apr 2003, 04:53 PM
hmm.. ok ill try that method....ill keep u info'd

ElJoelio
3rd Apr 2003, 05:18 PM
Sleep() is a latent function, which mean you can only call it from within in State code, e.g.:

[code:1:f66f3d70b3]
state DoSomething
{
function FunkyFunction()
{
// Your code here
}

function LesserFunkyFunction()
{
// Your code here
}

Begin:
FunkyFunction();
Sleep(5);
LesserFunkyFunction();
}
[/code:1:f66f3d70b3]

That will call the first function, wait 5 seconds, then call the 2nd function. Normal execution will continue while Sleep() is waiting.

If you're serious about unrealscripting, I suggest reading this (http://unreal.epicgames.com/UnrealScript.htm) document.

KewlAzMe
4th Apr 2003, 12:22 AM
Thanks Joelio.. yea that link is the first thing I looked at when searching for the sleep function but i just scanned thru it and didnt see any wait or sleep function mentioned so I wasn't sure what the syntax was.