Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gauge thingie (https://forums.graalonline.com/forums/showthread.php?t=52379)

Loriel 04-19-2004 08:59 PM

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.

GoZelda 04-19-2004 09:40 PM

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

Alexander 04-19-2004 10:00 PM

1 Attachment(s)
Here

GoZelda 04-19-2004 10:04 PM

Quote:

Originally posted by Alexander
Here
Thanks. Hey Loriel, that looks sekc.

screen_name 04-19-2004 11:28 PM

I can see it now, Era will end up with speedometers.

Nice script btw.

Angel 04-20-2004 12:23 AM

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

EsCanavi 04-20-2004 12:40 AM

i thougt we couldn't post full script >.<
?!?!?

Fhqwhgads 04-20-2004 12:51 AM

Awesome! :cool: Its really cool! :)

Python523 04-20-2004 01:15 AM

Quote:

Originally posted by EsCanavi
i thougt we couldn't post full script >.<
?!?!?

You obviously misinterpret rules then

osrs 04-20-2004 03:16 AM

Quote:

Originally posted by EsCanavi
i thougt we couldn't post full script >.<
?!?!?

He is not telling people to fix it.

screen_name 04-20-2004 03:29 AM

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

napo_p2p 04-26-2004 02:46 AM

Yeah, this script is really nice.

WanDaMan 04-27-2004 05:11 PM

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 ^^

Dach 04-27-2004 05:17 PM

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.

WanDaMan 04-27-2004 05:19 PM

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 :rolleyes:

Loriel 04-27-2004 06:22 PM

Quote:

Originally Posted by WanDaMan
I believe it's not allowed to delete a post which gives some critisizm ^^

I warn you to stop spamming. It is not any useful critism.

WanDaMan 04-27-2004 06:27 PM

Quote:

Originally Posted by Loriel
I warn you to stop spamming. It is not any useful critism.

Does it have to be, I don't like it so I stated it so it isn't spamming.

Crono 04-27-2004 07:52 PM

Loriel said this-
Quote:

Comments?
And Wan said this-
Quote:

I don't like, it's very very very boring.
It's simply his comment, nothing wrong with that

My comment was deleted though :(!

That script looks so complicated that I dont think I want to learn XD! -dies- Looks handy.

zokemon 04-27-2004 08:21 PM

Quote:

Originally Posted by Gerami
Loriel said this-


And Wan said this-


It's simply his comment, nothing wrong with that

My comment was deleted though :(!

That script looks so complicated that I dont think I want to learn XD! -dies- Looks handy.

Not that complicated... *mumble*

Goboom 04-27-2004 11:48 PM

Its just a bit of math. I understand why you think it looks kind of intimidating.

WanDaMan 04-28-2004 07:44 AM

Quote:

Originally Posted by Goboom
Its just a bit of math. I understand why you think it looks kind of intimidating.

I can read it and have some meaning to me, but I mean what's the point in having it? what could you use it as?

Dach 04-28-2004 01:49 PM

Quote:

Originally Posted by WanDaMan
I can read it and have some meaning to me, but I mean what's the point in having it? what could you use it as?

erm...
Quote:

Originally Posted by screen_name
I can see it now, Era will end up with speedometers.

read the thread and context, the most obvious answer to that question is already given x_x

It has other uses, but that would be up to your ingenuity

GoZelda 04-28-2004 05:42 PM

Quote:

Originally Posted by WanDaMan
I can read it and have some meaning to me, but I mean what's the point in having it?

What's the point living? That seems a lot more significant to me.

WanDaMan 04-28-2004 05:58 PM

Quote:

Originally Posted by Dach
erm...

read the thread and context, the most obvious answer to that question is already given x_x

It has other uses, but that would be up to your ingenuity

when angel said it was made for era, with a question mark?. yeah sure read along :whatever:

i don't want to go head of heels but, i don't want to get into the crap about life. Give me one good reason why you'd use that? with the light effects?

Crono 04-28-2004 06:32 PM

Why are you so "aggressive" here Wan? It's just a fat script :[!

WanDaMan 04-28-2004 06:55 PM

Quote:

Originally Posted by Gerami
Why are you so "aggressive" here Wan? It's just a fat script :[!

Well because some ***** dosn't like my comments. I stated I hated it and said that it's pointless so it gets deleted. But since some other people said it's great and "o i love it" and all that crap it dosn't get deleted, why?

Crono 04-28-2004 07:04 PM

Because some people like to use their powers to make it better for themselves? I don't know. Loriel has always been one of the better staffers...

Loriel 04-28-2004 07:09 PM

Quote:

Originally Posted by WanDaMan
Well because some ***** dosn't like my comments. I stated I hated it and said that it's pointless so it gets deleted. But since some other people said it's great and "o i love it" and all that crap it dosn't get deleted, why?

You have a valid point when saying I do not attack "positive spam", but that is about it. I already warned you, no?

Stop being offtopic or I close the thread and delete all but the original post ;)

GoZelda 04-28-2004 07:24 PM

Quote:

Originally Posted by WanDaMan
i don't want to go head of heels but, i don't want to get into the crap about life.

Okay, what's the point of making love then?

Dach 04-28-2004 08:54 PM

Quote:

Originally Posted by WanDaMan
when angel said it was made for era, with a question mark?. yeah sure read along :whatever:

Welcome to sarcasm buddy

Quote:

Give me one good reason why you'd use that? with the light effects?
I don't need to, if you can't see it, don't spam here. Where the hell are you getting light effects from anyway? Just curious (P.S. he asked for comments on the script, not the premise)

WanDaMan 04-29-2004 07:34 AM

Quote:

Originally Posted by Loriel
You have a valid point when saying I do not attack "positive spam", but that is about it. I already warned you, no?

Stop being offtopic or I close the thread and delete all but the original post ;)

fine on topic

i luive it plesea mke mre.


All times are GMT +2. The time now is 02:19 PM.

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