Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Problem displaying multiple arrays (https://forums.graalonline.com/forums/showthread.php?t=134267483)

sssssssssss 12-02-2012 05:38 AM

Problem displaying multiple arrays
 
the array is set up like this:
PHP Code:

client.system.messages="""[System Message]: Welcome To Armageddon."",1,1,1,pmbubble_admin.png","""[System Message]: Say /help for some commands!"",1,1,1,pmbubble_admin.png","""[System Message]: Say /news for the Main Info H 

Im trying to simply show any arrays that are already set up on onCreated and so forth, then simple add new ones in as they come. New ones do get added in, but ALL values are duplicated every time a new one is added.

PHP Code:

// set total size of all except system
  
temp.totalSize client.mass.messages.size() + client.tell.messages.size() + client.guild.messages.size() + client.system.messages.size();

  
// add new items to category all after init
  
while (this.tempChatSize temp.totalSize && this.active == "all")
  {
    if (
client.mass.messages.size() > 0)
    {
      
ChatBox_WindowText.addtext("<img src=" @client.mass.messages[this.tempChatSize][4]@ " id=sendImg" @client.mass.messages[this.tempChatSize]@ "/>" @client.mass.messages[this.tempChatSize][0] @ "<br>"false);
    }
    if (
client.tell.messages.size() > 0)
    {
      
ChatBox_WindowText.addtext("<img src=" @client.tell.messages[this.tempChatSize][4]@ " id=sendImg" @client.tell.messages[this.tempChatSize]@ "/>" @client.tell.messages[this.tempChatSize][0] @ "<br>"false);
    }
    if (
client.guild.messages.size() > 0)
    {
      
ChatBox_WindowText.addtext("<img src=" @client.guild.messages[this.tempChatSize][4]@ " id=sendImg" @client.guild.messages[this.tempChatSize]@ "/>" @client.guild.messages[this.tempChatSize][0] @ "<br>"false);
    }
    if (
client.system.messages.size() > 0)
    {
      
ChatBox_WindowText.addtext("<img src=" @client.system.messages[this.tempChatSize][4]@ " id=sendImg" @client.system.messages[this.tempChatSize]@ "/>" @client.system.messages[this.tempChatSize][0] @ "<br>"false);
    }
    
    
// add to total added
    
this.tempChatSize++;
    
    
// force scroll to bottom
    
ChatBox_WindowText.scrolltobottom();
  } 


fowlplay4 12-02-2012 06:03 AM

Re-script your system to use triggerclient (preferably via a player public function) and public functions for client-side messages instead of adding messages to client variables and looping on the client-side.

cbk1994 12-02-2012 06:05 AM

Quote:

Originally Posted by fowlplay4 (Post 1708430)
Re-script your system to use triggerclient instead of adding messages to client variables and looping on the client-side.

example of triggerclient for a similar system

sssssssssss 12-02-2012 03:29 PM

Thanks guys.
:)

sssssssssss 12-02-2012 06:25 PM

I still did need to use either client vars or a npc db to hold what has been since since the player was on, and to not worry about load I continued to use client vars.

However I completely eliminated any need for a time out for this system to work outside of a count down doing what you guys said along with the client vars so I appreciate it very much!

fowlplay4 12-02-2012 08:23 PM

Quote:

Originally Posted by sssssssssss (Post 1708457)
I still did need to use either client vars or a npc db to hold what has been since since the player was on, and to not worry about load I continued to use client vars.

There should be one central function where all messages go through on the client-side. You can just put script there to remember the last 10 or so messages.

DustyPorViva 12-02-2012 08:41 PM

Could always store the chat history in a txt file clientside and load on login and append on receive.


All times are GMT +2. The time now is 08:42 AM.

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