Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Nickname script. (Help Please) (https://forums.graalonline.com/forums/showthread.php?t=87508)

Mattehy 08-20-2009 05:38 PM

Nickname script. (Help Please)
 
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.img1 = findimg(1);
  
with (this.img1) {
    
font = "Comic Sans MS";
    
style = "cb";
    
zoom = 1;
  }
  
setTimer( 0.05 );
}

function 
onTimeout() {
  
with (this.img1) {
    
text = player.nick;
    
x = player.x + 1.5;
    
y = player.y + 3;
  }
  
setTimer( 0.05 );
} 

/\ My Current Nick Name Script.
Would their be a way to showunderplayer(); and change the color as well?

fowlplay4 08-20-2009 06:06 PM

You can change the color in findimg, with the variables: red, green, blue

I.e:

PHP Code:

with (findimg(1)) {
  
text = player.nick;
  
x = player.x + 1.5;
  
y = player.y + 3;
  
layer = 1; // Play around with this, to determine where it draws anything.
  
red = 1;
  
green = 0;
  
blue = 0;
} 

However I would suggest you take a different route with your nickname script, and this would be for better as players would be able to disable them and such as.

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
setTimer(0.05);
}

function 
onTimeout() {
  
hideimgs(200, 1000); // This will need to be re-optimized as hiding then redrawing every frame is bad :(
  
drawNicknames();
}

function 
drawNicknames() {
  
// Loop through Players
  
for (temp.p: players) {
    
// Draw Text under Player
    
with (findimg(200 + temp.p.id)) {
      
x = temp.p.x + 1.5;
      
y = temp.p.y + 3;
      
style = "bc";
      
text = temp.p.nick;
    }
  }
} 

I didn't include the enablefeatures part of the script because I assume you already know how to use it, also I noticed you deleted your thread when you had your problem fixed. Don't do that!

Mattehy 08-20-2009 06:22 PM

thanks that helped alot


All times are GMT +2. The time now is 10:23 AM.

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