Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-18-2008, 12:49 PM
Furyshots Furyshots is offline
Part of the project
Furyshots's Avatar
Join Date: May 2007
Location: Somewhere
Posts: 21
Furyshots is on a distinguished road
Timer

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 .
__________________
Reply With Quote
  #2  
Old 03-18-2008, 01:02 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Furyshots View Post
Stuff
Please read the rules, found here

Quote:
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?
Reply With Quote
  #3  
Old 03-18-2008, 01:08 PM
Furyshots Furyshots is offline
Part of the project
Furyshots's Avatar
Join Date: May 2007
Location: Somewhere
Posts: 21
Furyshots is on a distinguished road
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.
__________________
Reply With Quote
  #4  
Old 03-18-2008, 01:10 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
You've got PM
__________________
Reply With Quote
  #5  
Old 03-18-2008, 01:17 PM
Furyshots Furyshots is offline
Part of the project
Furyshots's Avatar
Join Date: May 2007
Location: Somewhere
Posts: 21
Furyshots is on a distinguished road
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.
__________________
Reply With Quote
  #6  
Old 03-18-2008, 06:01 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Furyshots View Post
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.
NPC Code:

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



You can also do:
NPC Code:

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).
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #7  
Old 03-18-2008, 06:24 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
PHP Code:
if (created) {
  
timeout=3;
  
timershow;
}
if (
timeout) {
  
message TadaI'm done!;

Reply With Quote
  #8  
Old 03-18-2008, 08:03 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
NPC1
PHP Code:
// 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 blockhurry!;
    
timeout 0.05;
  }else
    
message Touch me to start the timer!;

NPC2
PHP Code:
// 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
__________________
Reply With Quote
  #9  
Old 03-18-2008, 08:16 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Chompy View Post
Bah, long time since I did gs1 but they should work in the editor
Geez, leave some room for him to learn XD
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #10  
Old 03-18-2008, 08:22 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Tigairius View Post
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
__________________
Reply With Quote
  #11  
Old 03-18-2008, 09:14 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Tigairius View Post
You can also do:
PHP Code:
while(== 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) {}
__________________
Reply With Quote
  #12  
Old 03-18-2008, 10:03 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Twinny View Post
Please read the rules, found here



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
__________________
Reply With Quote
  #13  
Old 03-18-2008, 10:21 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbkbud View Post
nice sig
huh, taco godzilla?
__________________
Reply With Quote
  #14  
Old 03-18-2008, 11:07 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Inverness View Post
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.
__________________
Do it with a DON!
Reply With Quote
  #15  
Old 03-18-2008, 11:09 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I don't really see why anything more than a timeout is needed.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:43 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.