PDA

View Full Version : Timer


Furyshots
03-18-2008, 12:49 PM
Could anyone help me with making a timer script?
If you touch a npc in game there should be a timer (I would like a visible one, but an invisible one is good too), and if you touch another npc the timer needs to stop. I hope you guys can help me out :D.

Twinny
03-18-2008, 01:02 PM
Stuff

Please read the rules, found here (http://forums.graalonline.com/forums/announcement.php?f=8)


1. Be clear on your ability level. In other words, do not post asking for scripts, or asking people to fix scripts that are above your ability level. If you are writing a script to aid learning, then try writing a simpler script. If you are looking for a script for a server, then the best solution is probably to hire a scripter.

Basically: please don't ask for complete scripts. If you require such things, ask for a NAT in the playerworld hirings subforum but please adhere to the rules there.

Have you tried making such a script yourself?

Furyshots
03-18-2008, 01:08 PM
I can make really really simple scripts, but I dont know how to start on making a timer. Could you guys help me out or tell me what commands I need to use etc.

projectigi
03-18-2008, 01:10 PM
You've got PM

Furyshots
03-18-2008, 01:17 PM
What I forgot to mention it is for a school project so it needs to work on graal editor. Igi the script you send to me didnt work well:(.

Tigairius
03-18-2008, 06:01 PM
What I forgot to mention it is for a school project so it needs to work on graal editor. Igi the script you send to me didnt work well:(.


if (created) {
this.time = 0;
timeout = 0.05;
}
if (timeout) {
this.time++;
message #v(this.time);
timeout = 1;
}


You can also do:

while(1 == 1) {
this.time++;
message #v(this.time);
sleep 1;
}

Up to you really. If you need help with anything else feel free to forum PM me or contact me via AIM (Tigairius).

DustyPorViva
03-18-2008, 06:24 PM
if (created) {
timeout=3;
timershow;
}
if (timeout) {
message Tada, I'm done!;
}

Chompy
03-18-2008, 08:03 PM
NPC1

// NPC made by Chompi
//#CLIENTSIDE
if (created) {
setimg block.png;
level.timer = 0;
level.time = 0;
timeout = 0.05;
}
if (playertouchsme) {
if (level.timer == 0) {
level.timer = 1;
timeout = 0.05;
}
}
if (timeout) {
if (level.timer == 1) {
level.time += 0.05;
message Touch the other block, hurry!;
timeout = 0.05;
}else
message Touch me to start the timer!;
}


NPC2

// NPC made by Chompi
//#CLIENTSIDE
if (created) {
setimg block.png;
timeout = 0.05;
}
if (timeout) {
if (level.time > 0)
message #v(level.time);
timeout = 0.05;
}
if (playertouchsme) {
if (level.timer == 1) {
level.timer = 0;
message Player touched me in #v(level.time) seconds!;
level.time = 0;
}
}


Bah, long time since I did gs1 but they should work in the editor

Tigairius
03-18-2008, 08:16 PM
Bah, long time since I did gs1 but they should work in the editor

Geez, leave some room for him to learn XD

Chompy
03-18-2008, 08:22 PM
Geez, leave some room for him to learn XD

oh.. uh.. let me think.. i wonder.. no wait a min....
bah, making those scripts made me open the editor which I haven't done in months xD

Well, I guess he could learn from them? :o

Inverness
03-18-2008, 09:14 PM
You can also do:

while(1 == 1) {
this.time++;
message #v(this.time);
sleep 1;
}

Don't use a while loop, it will probably stop at the maxlooplimit which is 10,000 by default. If you want an unending loop always use timers or scheduled events.

Even if you did use a while loop it should be while (true) {}

cbk1994
03-18-2008, 10:03 PM
Please read the rules, found here (http://forums.graalonline.com/forums/announcement.php?f=8)



Basically: please don't ask for complete scripts. If you require such things, ask for a NAT in the playerworld hirings subforum but please adhere to the rules there.

Have you tried making such a script yourself?

nice sig

Chompy
03-18-2008, 10:21 PM
nice sig

huh, taco godzilla?

zokemon
03-18-2008, 11:07 PM
Don't use a while loop, it will probably stop at the maxlooplimit which is 10,000 by default. If you want an unending loop always use timers or scheduled events.

Even if you did use a while loop it should be while (true) {}

I'm pretty sure there isn't a loop limit offline. I may be thinking of the days pre v2 though.

DustyPorViva
03-18-2008, 11:09 PM
I don't really see why anything more than a timeout is needed.

Tigairius
03-18-2008, 11:31 PM
I'm pretty sure there isn't a loop limit offline. I may be thinking of the days pre v2 though.

There is.

Twinny
03-18-2008, 11:35 PM
huh, taco godzilla?

Tacosaur!

...I dunno ^^

Furyshots
03-21-2008, 07:18 PM
Thank you guys, Im going to try the scripts right now :D.