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 05-22-2007, 11:51 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Insert()?

A question, when using insert does it shift everything over one entry? Or does it simply replace the value you've inserted into.

As I was using it this function is supposed to first insert a new string into the 0 entry of the client.messages array then delete the last entry if the last entry is over five. Isn't adding any new messages after I reach the 5 limit nor deleting them.

Any ideas?

PHP Code:
function onCreated()
{
  
setshape(13232);
}

//#CLIENTSIDE
function onCreated()
{
  
setshape(13232);
}
public function 
addPlayerNotification(message) {
  echo(
temp.message);
  
  
this.client.messages.insert(0temp.message);
  
this.checkNotifications();
}

public function 
checkNotifications() {
  if (
this.client.messages.size() > 5)
  {
    
this.deleteNotification();
  }
}

public function 
deleteNotification() {
  
this.client.messages.delete(6);
}

public function 
updateNotifications() {

__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #2  
Old 05-23-2007, 12:14 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Wiki
obj.replace(index,obj2)
obj.insert(index,obj2)
...
Indexes start at zero.
PHP Code:
public function addPlayerNotification(msg) {
  
client.messages.insert(0msg);
  if (
client.messages.size() > 5) {
    
client.messages.delete(5);
  }

__________________

Last edited by Inverness; 05-23-2007 at 12:36 AM..
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 03:02 PM.


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