View Single Post
  #1  
Old 04-01-2006, 09:58 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Wtf!? Passing arrays

Alright, so..
I have an NPC weapon that parses a string into a multi-dimensional array, then sends it to the serverside.
It was working fine.
I relogged and it broke.

PHP Code:
function onActionServerside() {
  
player.chat params[1];
}
//#CLIENTSIDE
triggeraction(0,0,"serverside",name,"useitem",ParseMods(emods(item)),item);
function 
ParseMods(mods) {
  
temp.mods.tokenize();
  
temp.willreturn = new[temp.t.size()];
  for (
temp.modcounttemp.t) {
    
temp.newmod temp.modcount.tokenize(":");
    for (
temp.addmodtemp.newmod) {
      
temp.willreturn[temp.t.index(modcount)].add(temp.addmod);
    }
  }
  return 
temp.willreturn;

If I set my chat to ParseMods(emods(item))[0] in the clientside, it sets my chat to 'addhpp,.3'
ParseMods(emods(item))[0][0] returns 'addhp'
It's parsing it fine.

However, when it tries to read params[1] in the serverside, it gives me 1.
Just 1. There's nothing else. params[1].size() is 0.
I know it's possible to pass arrays through triggeractions, as I've done it before.

Any help?
Reply With Quote