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 04-19-2004, 08:59 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
Gauge thingie

A nifty analogous display of percentages, pretty customisable I hope. Comments?

The functions:
NPC Code:
function show_scale() {
range = this.ANGLES[1] - this.ANGLES[0];
dist = this.POINTERLENGTH * 1.2;
for (i = this.MIN; i <= this.MAX; i += this.SCALE) {
angle = this.ANGLES[0] + i * range / (this.MAX - this.MIN);
showpoly index, {
sx + sin(angle) * dist * 1.4, sy + cos(angle) * dist * 1.4,
sx + sin(angle+pi*0.01) * dist * 1.3, sy + cos(angle+pi*0.01) * dist * 1.3,
sx + sin(angle) * dist * 1.1, sy + cos(angle) * dist * 1.1,
sx + sin(angle-pi*0.01) * dist * 1.3, sy + cos(angle-pi*0.01) * dist * 1.3
};
changeimgvis index, 4;

colouredness = 1 - abs(gauge - i) / (this.MAX - this.MIN) * this.SCALEFADE;
changeimgcolors index, this.SCALECOLOURS[0]*colouredness,
this.SCALECOLOURS[1]*colouredness,
this.SCALECOLOURS[2]*colouredness,
this.SCALECOLOURS[3];
index ++;
}
}
function show_gauge() {
range = this.ANGLES[1] - this.ANGLES[0];
angle = this.ANGLES[0] + gauge * range / (this.MAX - this.MIN);
showpoly index, {
sx, sy,
sx + sin(angle+pi*0.05) * dist * 0.2, sy + cos(angle+pi*0.05) * dist * 0.2,
sx + sin(angle) * dist * 1.0, sy + cos(angle) * dist * 1.0,
sx + sin(angle-pi*0.05) * dist * 0.2, sy + cos(angle-pi*0.05) * dist * 0.2
};
changeimgvis index, 4;
changeimgcolors index, this.POINTERCOLOURS[0],
this.POINTERCOLOURS[1],
this.POINTERCOLOURS[2],
this.POINTERCOLOURS[3];
index ++;
}



Example usage:
NPC Code:
if (created) {
this.MAX = 100;
this.MIN = 0;
this.SCALE = 10;
this.ANGLES = {pi * 0.5, pi * 1.5};
this.POINTERLENGTH = 32;
this.POINTERCOLOURS = {0.8, 1, 0.2, 1};
this.SCALECOLOURS = {0.8, 1, 0.5, 0.8};
this.SCALEFADE = 0.5;

timeout = 0.05;
}
if (created || timeout) {
index = 200;

sx = 140;
sy = 140;
gauge = abs(mousex - playerx-1.5) * 5;
if (gauge > this.MAX) gauge = this.MAX;
else if (gauge < this.MIN) gauge = this.MIN;

// Calling the magic functions
show_scale();
show_gauge();

hideimgs index, this.lastimgindex;
this.lastimgindex = index;

timeout = 0.05;
}



I figure the api sucks, and how I use gauge as variable name but this.OMGCAPITALS for most things, but dunno.
Reply With Quote
  #2  
Old 04-19-2004, 09:40 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Re: Gauge thingie

Quote:
Originally posted by Loriel
Comments?
It's damn annoying to put in a level because the positions of the letters will screw up. So send us a level...
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #3  
Old 04-19-2004, 10:00 PM
Alexander Alexander is offline
Registered User
Join Date: Apr 2003
Location: California
Posts: 246
Alexander is on a distinguished road
Send a message via AIM to Alexander
Here
Attached Files
File Type: nw loriels_gauge_thingie.nw (2.1 KB, 194 views)
Reply With Quote
  #4  
Old 04-19-2004, 10:04 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Quote:
Originally posted by Alexander
Here
Thanks. Hey Loriel, that looks sekc.
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #5  
Old 04-19-2004, 11:28 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
I can see it now, Era will end up with speedometers.

Nice script btw.
__________________
[signature]insert here[/signature]
Reply With Quote
  #6  
Old 04-20-2004, 12:23 AM
Angel Angel is offline
Registered User
Join Date: Dec 2002
Posts: 562
Angel is on a distinguished road
Send a message via AIM to Angel
Quote:
Originally posted by screen_name
I can see it now, Era will end up with speedometers.

Nice script btw.
?!? Loriel made this for era x-x
__________________
Have a account problem? Playerworld Problem? Forum Problem?

Reply With Quote
  #7  
Old 04-20-2004, 12:40 AM
EsCanavi EsCanavi is offline
No Longer Graalian.
EsCanavi's Avatar
Join Date: Oct 2003
Location: ..:: Lassomption/Quebec/Canada ]::...
Posts: 214
EsCanavi is on a distinguished road
Send a message via AIM to EsCanavi Send a message via MSN to EsCanavi
i thougt we couldn't post full script >.<
?!?!?
__________________
:: Free Gift... 40$ ::
:: WrsHosting ::
:: Need a webhost, contact me ( free ) 99.9% Online ::
Contact me: [email protected] (msn|mailbox)
Reply With Quote
  #8  
Old 04-20-2004, 12:51 AM
Fhqwhgads Fhqwhgads is offline
Registered User
Join Date: Nov 2003
Location: Chicago
Posts: 57
Fhqwhgads is on a distinguished road
Send a message via AIM to Fhqwhgads
Awesome! Its really cool!
Reply With Quote
  #9  
Old 04-20-2004, 01:15 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by EsCanavi
i thougt we couldn't post full script >.<
?!?!?
You obviously misinterpret rules then
Reply With Quote
  #10  
Old 04-20-2004, 03:16 AM
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
Quote:
Originally posted by EsCanavi
i thougt we couldn't post full script >.<
?!?!?
He is not telling people to fix it.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #11  
Old 04-20-2004, 03:29 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by Angel

?!? Loriel made this for era x-x
I was just making a statement. Since Era is a modern-based server, just... oh nevermind.

<3
__________________
[signature]insert here[/signature]
Reply With Quote
  #12  
Old 04-26-2004, 02:46 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Yeah, this script is really nice.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #13  
Old 04-27-2004, 05:11 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
I don't like, it's very very very boring.
Don't delete my post, I believe it's not allowed to delete a post which gives some critisizm
__________________
V$:CONFL16T
Reply With Quote
  #14  
Old 04-27-2004, 05:17 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
That isn't critiquing, that is your opinion, which happens to be unbased. This is a tool for use within other scripts, it's not going to be big and flashy and neat looking on it's own.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #15  
Old 04-27-2004, 05:19 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 Dach
That isn't critiquing, that is your opinion, which happens to be unbased. This is a tool for use within other scripts, it's not going to be big and flashy and neat looking on it's own.
So Napo's post is nothing like mine? I'm just stating what in hell could a variation of light effects be used for, decpite kaimetsu's amazing 3d model?, bravo online
__________________
V$:CONFL16T
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 11:19 PM.


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