Graal Forums  

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

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-28-2004, 07:22 AM
bloodpet bloodpet is offline
Gold / VIP Member
bloodpet's Avatar
Join Date: Mar 2004
Posts: 43
bloodpet is on a distinguished road
Post Free Time Script Example

NPC Code:

// This goes in the database (db)
if (created || initialized) {
t = s;
timeout = 1;
}
if (timeout) {
t++;
if (t>=86400)
t = 0; // resets time
s = t;

timeout = 1;
}



NPC Code:

// this goes in the weapon
i = s; // gets the curent time
h = int(i / 3600); // the hour
m = int((i - h * 3600) / 60); // the min
s = int((i - h * 3600) - (m * 60)); // the sec
if (h > 10) {
setstring this.p,AM; // changed to am and pm
}else {setstring this.p,PM;}
h ++;
if (h > 12) {
h -= 12; // 12 hour mode
}
if (m < 10) {
setstring this.m,0#v(m); // enables 01-09
}else {setstring this.m,#v(m);}

if (s < 10) {
setstring this.s,0#v(s); // enables 01-09
}else {setstring this.s,#v(s);}



*Note: you have to add something in here to show the time for instance:

NPC Code:

showimg 999,@ariel@bottom@#v(h):#s(this.m):#s(this.s) #s(this.p) #s,20,screenheight-30;
changeimgvis 999,5;
changeimgzoom 999,1;



If you find any bugs please post them here. Also if oy uhave any suggestions, suggest away. Im only here to help.

You need to stop the DB script befor you can set the time. Its scripted s oyou can shange server flags without disturbing the time, thank you for oyur support. ~bloodpet

I actualy thought the this.m and this.s were needed rather then doign some other if comands followed by multiple display scritps that get messy.....

Last edited by bloodpet; 06-28-2004 at 08:34 PM.. Reason: Added [CODE] tags
  #2  
Old 06-28-2004, 07:34 AM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
For starters, you don't need to set any strings what so ever to have a time script. Just use the variable for the total server time, which I can not recall at the current moment, but there is one, and some simply mathematics. No need for the complexity.
__________________
V$:CONFL16T
  #3  
Old 06-28-2004, 07:46 AM
bloodpet bloodpet is offline
Gold / VIP Member
bloodpet's Avatar
Join Date: Mar 2004
Posts: 43
bloodpet is on a distinguished road
Quote:
Originally Posted by WanDaMan
For starters, you don't need to set any strings what so ever to have a time script. Just use the variable for the total server time, which I can not recall at the current moment, but there is one, and some simply mathematics. No need for the complexity.

yep.. thats all i did some simple mathematics.. and good point about having it just run on variables lemem change that.. It would be a little more cleaner that way anyways...
  #4  
Old 06-28-2004, 11:10 AM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
I wasn't aiming the mathematics comment towards you, I just said it. But anyways... yeah, variables.

Anyways, how on earth have you changed your forums title after only eight posts? Also, please don't get me started on the title itself...
__________________
V$:CONFL16T
  #5  
Old 06-28-2004, 12:34 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
Please use code tags :/

Also, using timevar is far superior. It cuts out the need to use a db-npc.
__________________
Former Global Scripting Team Member


  #6  
Old 06-28-2004, 04:10 PM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by WanDaMan
I wasn't aiming the mathematics comment towards you, I just said it. But anyways... yeah, variables.

Anyways, how on earth have you changed your forums title after only eight posts? Also, please don't get me started on the title itself...

Timevar, and anyone can change their title/avatar at any time
__________________
  #7  
Old 06-28-2004, 04:18 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Did you actually test this? s = #v(this.t);
  #8  
Old 06-28-2004, 06:01 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally Posted by Loriel
Did you actually test this? s = #v(this.t);
twas what I was thinking

Timevar isn't very exact, but it does get the job done. Whatever happened to timevar2? Last time I tried to use it, it didn't work
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
  #9  
Old 06-28-2004, 06:20 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Maybe you should change your avatar title.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
  #10  
Old 06-28-2004, 06:25 PM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
Quote:
Originally Posted by Andy0687
Timevar, and anyone can change their title/avatar at any time
Oh, okay. Thanks
__________________
V$:CONFL16T

Last edited by WanDaMan; 06-28-2004 at 08:30 PM..
  #11  
Old 06-28-2004, 08:20 PM
bloodpet bloodpet is offline
Gold / VIP Member
bloodpet's Avatar
Join Date: Mar 2004
Posts: 43
bloodpet is on a distinguished road
Quote:
Originally Posted by Ningnong
Please use code tags :/

Also, using timevar is far superior. It cuts out the need to use a db-npc.
timevar? never head of it.. I think i should look into that, sounds like a great idea. And code tags.. um
NPC Code:
this?

__________________
bloodpet loaded the local ban info of stefan
bloodpet set the local ban info of stefan
*stefan: ...
  #12  
Old 06-28-2004, 08:21 PM
bloodpet bloodpet is offline
Gold / VIP Member
bloodpet's Avatar
Join Date: Mar 2004
Posts: 43
bloodpet is on a distinguished road
Quote:
Originally Posted by Loriel
Did you actually test this? s = #v(this.t);

No, I tested it befor I edited it whe ni used strings.. why? i cant really see without my glasses. When I get a new pair later today Ill check the script again and make sure its right..

ohh i forgot to take the #v( ) out fro mwhe ni had it as a string.. sorry.. lemem fix
__________________
bloodpet loaded the local ban info of stefan
bloodpet set the local ban info of stefan
*stefan: ...
  #13  
Old 06-28-2004, 08:30 PM
Nappa Nappa is offline
The Great Nappa
Nappa's Avatar
Join Date: Sep 2003
Location: Florida
Posts: 1,911
Nappa is on a distinguished road
Send a message via AIM to Nappa
I think you made something it a bit more complicated then it ever needed to be.
__________________
  #14  
Old 06-28-2004, 08:33 PM
bloodpet bloodpet is offline
Gold / VIP Member
bloodpet's Avatar
Join Date: Mar 2004
Posts: 43
bloodpet is on a distinguished road
Quote:
Originally Posted by Nappa
I think you made something it a bit more complicated then it ever needed to be.

and why do you say that?
__________________
bloodpet loaded the local ban info of stefan
bloodpet set the local ban info of stefan
*stefan: ...
  #15  
Old 06-28-2004, 08:33 PM
Nappa Nappa is offline
The Great Nappa
Nappa's Avatar
Join Date: Sep 2003
Location: Florida
Posts: 1,911
Nappa is on a distinguished road
Send a message via AIM to Nappa
I've made a far simpler time script with light effects and everything in about 4-5 minutes using timevar, all in one npc.
__________________
Closed Thread


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 11:31 PM.


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