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 08-04-2011, 03:54 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Helping with arrays in showtext

Well, I can't get this showtext to update to the array I want, the array should include multiple nicknames but it only shows one in the level.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.set NULL;
}
function 
onUpdateText()
  {
  
showtext(1this.x+0.5this.y-0.05"Arabic""b"this.text);
  
changeimgzoom(11);
  
changeimgcolors(11111);
  
drawunderplayer;
  }
function 
onPlayerEnters()
  {
  
onTimeOut();
  }
function 
onTimeOut()
  {
  if (
this.set != NULL)
    {
    
this.text this.set;
    }
  else
    {
    
this.text "Lineup: ";
    }
  
onUpdateText();
  
setTimer(.5);
  }
function 
onPlayerChats()
  {
  if (
player.guild == "Events Team")
    {
    if (
player.chat == ":lineup")
      {
      for (
temp.0temp.playerscounttemp.++)
        {
        
this.lineup NULL;
        
this.lineup.add(players[(@temp.p)].nick);
        
player.chat this.lineup;
        
this.set "Lineup: "@this.lineup;
      }
    }
  }

__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #2  
Old 08-04-2011, 04:22 AM
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're setting the array to NULL then adding a player to it.
__________________
Quote:
Reply With Quote
  #3  
Old 08-04-2011, 04:24 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Also, this

PHP Code:
this.lineup NULL

for (
temp.0temp.playerscounttemp.++) 

  
this.lineup.add(players[(@temp.p)].nick); 
  
player.chat this.lineup
  
this.set "Lineup: "@this.lineup

would be better written as

PHP Code:
this.lineup NULL

for (
temp.pl players

  
this.lineup.add(temp.pl.nick);
}

player.chat this.lineup
this.set "Lineup: "@this.lineup
__________________
Reply With Quote
  #4  
Old 08-04-2011, 04:25 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Quote:
Originally Posted by fowlplay4 View Post
You're setting the array to NULL then adding a player to it.
I removed onCreated nothing different
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #5  
Old 08-04-2011, 04:27 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Astram View Post
I removed onCreated nothing different
The issue is in the loop, not in onCreated.

PHP Code:
for (temp.0temp.playerscounttemp.++) 
        { 
        
this.lineup NULL
        
this.lineup.add(players[(@temp.p)].nick); 
        
player.chat this.lineup
        
this.set "Lineup: "@this.lineup
      } 
You're setting this.lineup to null then adding the player to it. The null assignment should be before the loop.
__________________
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 05:53 AM.


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