Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-06-2001, 07:39 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Thumbs up Show Number Function

I was bored .. again
and I decided to make a little function to help some people.
I might enhance it if people like it..
it shows any number anywhere on the screen..
the only problem is that the number cant be bigger then 9999999,
else the variable becomes a long and messes up x.x
bare with me since I made this in only like 15 minutes, so it might have some bugs..
oh and I think some1 had one before this .. but I tried and it didnt work well so here is one that works well.

here is the function:
NPC Code:

function LiquidNum() {
//hide if told
if (this.hideprevious=1) {
while (this.previousindex>this.startindex) {
hideimg this.previousindex;
this.previousindex-=1;
}
}
//end hide

//do showimg of the numbers
this.count=0;
while (this.count<strlen(#v(this.number))) {
showimg this.startindex,state.png,this.x,this.y;
//get current number
this.currentnum=strtofloat(#e(this.count,1,#v(this .number)));
//end get current number
changeimgvis this.startindex,4;
changeimgpart this.startindex,this.currentnum*14,81,14,16;
//add to variables
this.startindex+=1;
this.x+=this.space;
this.count+=1;
}
//end showimg

//set highest index if needed
this.previousindex=this.startindex;
//end set highest index
}


now ill explain how to use it.
anywhere in your code you can call it , in a timeout, if player enters. whatever.
Ill explain a if playerenters one ..

NPC Code:

if (playerenters) {
//index in which we should start
this.startindex=200;
//hide previous shown imgs? 1=yes 0=no
//this is usefull if your running it in a timeout and you need it to
//clear previous showimg's so they dont show unwanteds
this.hideprevious=1;
//begin x position
this.x=250;
//y position
this.y=100;
//number to display
this.number=123456;
//space in between numbers
this.space=10;
//run function
LiquidNum();
}



Enjoy
and please tell me if you find any bugs.

oh and i might also include the chars : / so if you need to do dates or something. btw this is extracted out of state.png
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)

Last edited by LiquidIce00; 07-07-2001 at 07:13 AM..
Reply With Quote
  #2  
Old 07-06-2001, 08:00 AM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
fun. You could also do:
NPC Code:

function shownumber() {
this.x = 100;
this.y = 250;
this.number = 12345;
showimg 600,@#v(this.number),this.x,this.y;
changeimgvis 600,5;
}

Reply With Quote
  #3  
Old 07-06-2001, 08:02 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by kyle0654
fun. You could also do:
NPC Code:

function shownumber() {
this.x = 100;
this.y = 250;
this.number = 12345;
showimg 600,@#v(this.number),this.x,this.y;
changeimgvis 600,5;
}

yes but its still different
your way uses normal font files my way uses the sprite.png which is prettier.
but still props to u

good idea tho I could make it so u can choose which way and also you can change the font and size and all that stuff
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)

Last edited by LiquidIce00; 07-06-2001 at 08:07 AM..
Reply With Quote
  #4  
Old 07-06-2001, 08:14 AM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
Actually, I think if you just use arial bold it looks the same. All you need to remember is that the font on sprites.png is made of white arial bold, with blue arial bold underneath, with an offset of (1,1) on the blue text. You could probably use layers 5 and 6 to separate the two...
Reply With Quote
  #5  
Old 07-06-2001, 08:18 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by kyle0654
Actually, I think if you just use arial bold it looks the same. All you need to remember is that the font on sprites.png is made of white arial bold, with blue arial bold underneath, with an offset of (1,1) on the blue text. You could probably use layers 5 and 6 to separate the two...
what if the player has a custom state.png ;\
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #6  
Old 07-06-2001, 12:50 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by kyle0654
Actually, I think if you just use arial bold it looks the same. All you need to remember is that the font on sprites.png is made of white arial bold, with blue arial bold underneath, with an offset of (1,1) on the blue text. You could probably use layers 5 and 6 to separate the two...
hehe, I learn more about graal everyday I has no idea changeimgvis could go past 4.
__________________
Reply With Quote
  #7  
Old 07-07-2001, 07:11 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
erm 2 questions..
any1 want me to update this and make more stuff avaible ?
and also what happens if your using timevar and it becomes a really high number. does that mean you cant make date/time nemore since it becomes a long or what ??
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 02:53 PM.


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