Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Wtf!? Passing arrays (https://forums.graalonline.com/forums/showthread.php?t=65137)

Yen 04-01-2006 09:58 PM

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?

Yen 04-01-2006 10:01 PM

Nevermind, I placed params[1] in a new variable when it caught the trigger and it worked.


All times are GMT +2. The time now is 08:10 PM.

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