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
  #31  
Old 01-06-2010, 05:27 AM
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
Quote:
Originally Posted by cbk1994 View Post
temp variables are specific to the function, so no.
Good point! Completely forgot about that.
Reply With Quote
  #32  
Old 10-02-2010, 07:18 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Hey, I'm getting an error sometimes that 'shared.roundto()' not found. Any thought as to why?
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #33  
Old 10-02-2010, 07:20 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
Quote:
Originally Posted by MrOmega View Post
Hey, I'm getting an error sometimes that 'shared.roundto()' not found. Any thought as to why?
Are you using it clientside?
Reply With Quote
  #34  
Old 10-02-2010, 10:06 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by DustyPorViva View Post
Are you using it clientside?
Yes
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #35  
Old 04-17-2011, 09:27 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
sorry for this... but bump, why do I sometimes get this error?
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #36  
Old 04-17-2011, 05:25 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You could try referencing the weapon directly: (@"-Shared").roundto()

Then maybe just make a copy of the function so your code looks a little neater:

PHP Code:
function roundto() {
  return (@
"-Shared").roundto();

__________________
Quote:
Reply With Quote
  #37  
Old 04-17-2011, 11:07 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Skyld View Post

shared.getAlignmentColor(ap)
Returns an array of {red, green, blue} for the given AP color, allowing you to recreate the default nickname colors.
PHP Code:
shared.getAlignmentColor(player.ap); 
shared.getAlignmentShadowColor(red, green, blue)
Returns an array of {red, green, blue} for the shadow of the given color, allowing you to recreate the default nickname shadows.
PHP Code:
shared.getAlignmentShadowColor(0.750.10.3); 
I recently did some testing comparing the time it takes to loop through 0-100 between these shared functions and what we were using to calculate it on Classic.
It turns out that Classic's method was roughly twice as fast as the shared function, though some (wouldn't rule out all) of this time may have been down to the fact that public functions take a little bit longer.

Me/WhiteDragon then decided to try storing all of the values within an array like this:

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
this.apv = {
    {
64,0,0},
    {
128,64,64},
    {
133,62,62},
    {
138,59,59},
    {
143,57,57},
    {
148,54,54},
    {
153,52,52},
    {
158,49,49},
    {
163,47,47},
    {
168,44,44},
    {
173,41,41},
    {
178,39,39},
    {
183,36,36},
    {
188,34,34},
    {
194,31,31},
    {
199,29,29},
    {
204,26,26},
    {
209,24,24},
    {
214,21,21},
    {
219,18,18},
    {
224,16,16},
    {
229,13,13},
    {
234,11,11},
    {
239,8,8},
    {
244,6,6},
    {
249,3,3},
    {
255,0,0},
    {
255,10,10},
    {
255,21,21},
    {
255,31,31},
    {
255,42,42},
    {
255,53,53},
    {
255,63,63},
    {
255,74,74},
    {
255,85,85},
    {
255,95,95},
    {
255,106,106},
    {
255,116,116},
    {
255,127,127},
    {
255,138,138},
    {
255,148,148},
    {
255,159,159},
    {
255,170,170},
    {
255,180,180},
    {
255,191,191},
    {
255,201,201},
    {
255,212,212},
    {
255,223,223},
    {
255,233,233},
    {
255,244,244},
    {
255,255,255},
    {
255,255,255},
    {
255,255,255},
    {
255,255,255},
    {
255,255,255},
    {
255,255,255},
    {
230,255,230},
    {
205,255,205},
    {
179,255,179},
    {
154,255,154},
    {
128,255,128},
    {
128,255,128},
    {
116,255,140},
    {
103,255,153},
    {
90,255,166},
    {
77,255,178},
    {
64,255,191},
    {
52,255,204},
    {
39,255,216},
    {
26,255,229},
    {
13,255,242},
    {
0,247,255},
    {
0,238,255},
    {
0,229,255},
    {
0,220,255},
    {
0,212,255},
    {
0,203,255},
    {
0,194,255},
    {
0,185,255},
    {
0,176,255},
    {
0,168,255},
    {
0,159,255},
    {
0,150,255},
    {
0,141,255},
    {
0,132,255},
    {
0,124,255},
    {
0,115,255},
    {
0,106,255},
    {
0,97,255},
    {
0,88,255},
    {
0,80,255},
    {
0,71,255},
    {
0,62,255},
    {
0,53,255},
    {
0,44,255},
    {
0,36,255},
    {
0,27,255},
    {
0,18,255},
    {
0,9,255},
    {
0,0,255},
    {
231,199,0}
  };
}

public function 
getAlignmentColors(temp.ap) {
  
temp.ac this.getAlignmentColor(temp.ap);
  if(
temp.ap == 100){
    
temp.sc = {2552550};
  }
  else{
    
temp.255 * !(temp.ac[0]>191.25 || temp.ac[1]>191.25);
    
temp.sc = {temp.ctemp.ctemp.ac[2]};
  } 
  return {
temp.actemp.sc};
  
//Alignment Color, Shadow Color


public function 
getAlignmentColor(temp.ap) {
  return 
this.apv[temp.ap];

I guess this would be exchanging some memory and an increased amount of weapon data sent to the client for a save on script time. This turned out to be significantly faster than what we were previously using if the class is joined within the script using it. It is also still slightly faster than our previous method if used as a public function.
Reply With Quote
  #38  
Old 04-20-2011, 08:16 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
does shared.getAlignmentShadowColor(r, g, b) even work? What are the expected values? A float 0-1 or an int 0-255?

I have tried

PHP Code:
temp.shared.getAlignmentColor(player.ap);
temp.cs shared.getAlignmentShadowColor(c[0], c[1], c[2]);

temp.shared.getAlignmentColor(player.ap);
temp.cs shared.getAlignmentShadowColor(c[0]/255c[1]/255c[2]/255);

temp.cs shared.getAlignmentShadowColor(player.ap); 
and all are returning an array of {0, 0, 0}

The few times I've gotten it to return something besides that (by first methodology), it returns something entirely wrong, like {0, 0, 255} should the player's AP be 90 (which appears to be a white outline, while the returned is just blue)

seems as if both of these functions need work, I'm not sure why different params are passed to one versus the other anyway
Reply With Quote
  #39  
Old 04-22-2011, 05:22 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
What's wrong with rgbtohex()? shared.rgbtohex(1, 0, 0) returns #0F0000 for me; should be #FF0000 instead. Also, how come rgbtohex() and hextorgb() seem to return more than they should using v6? I always get stuff like "#0F0000 1 0 1" as a return value.
__________________
Reply With Quote
  #40  
Old 06-17-2012, 11:48 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by Crow View Post
What's wrong with rgbtohex()? shared.rgbtohex(1, 0, 0) returns #0F0000 for me; should be #FF0000 instead. Also, how come rgbtohex() and hextorgb() seem to return more than they should using v6? I always get stuff like "#0F0000 1 0 1" as a return value.
rgbtohex() returns the wrong hex for me too.
__________________
Testbed user: I figured since I can never find any scripters it was time to take desperate measures...and...TEACH MYSELF 0.0
Reply With Quote
  #41  
Old 06-18-2012, 07:59 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by DrakilorP2P View Post
rgbtohex() returns the wrong hex for me too.
Well, however it is written, it should probably just use format() instead:
PHP Code:
function RGBtoHex(redgreenblue)
  return 
format("#%.2x%.2x%.2x"red 255green 255blue 255); 
__________________
Reply With Quote
  #42  
Old 06-18-2012, 12:31 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Crow View Post
What's wrong with rgbtohex()? shared.rgbtohex(1, 0, 0) returns #0F0000 for me; should be #FF0000 instead. Also, how come rgbtohex() and hextorgb() seem to return more than they should using v6? I always get stuff like "#0F0000 1 0 1" as a return value.
I'll investigate this afternoon.

Edit: should be fixed now.
__________________
Skyld

Last edited by Skyld; 06-18-2012 at 01:53 PM..
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 10:15 AM.


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