Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   array[i] in array (https://forums.graalonline.com/forums/showthread.php?t=78004)

DustyPorViva 12-21-2007 08:31 PM

array[i] in array
 
Okay, I was helping someone with a script and came across a problem.
I load all the levels from the gmap file into an array. Good, done.
Then I have a set of levels the player has been in. Good, that works(sort of...).
Now it's time to compare the levels the player has been in, with the levels of the gmap. Not good, it won't work and I have no idea why.

This is part of the script, and variables that are loaded.
Quote:

Originally Posted by this.mapinfo[1]
be_a01.nw,be_b01.nw,be_c01.nw,be_d01.nw,be_e01.nw, be_f01.nw,be_g01.nw,be_h01.nw,be_i01.nw,be_j01.nw, be_k01.nw,be_l01.nw,

Quote:

Originally Posted by client.mapviewed[i]
be_a01.nw,be_k01.nw,be_l01.nw

PHP Code:

  for (i=0;i<client.mapviewed.size();i++) {
    if (
client.mapviewed[iin this.mapinfo[1]) {
      echo(
"test");
    }
  } 

It will not echo test. If I put an echo before the if check it fires correctly, so it's not the loop. Any idea what's going on?

coreys 12-21-2007 08:46 PM

maybe try...
PHP Code:

for (temp.lvlclient.mapviewed) {
  if (
temp.lvl in this.mapinfo[1]) {
    echo(
"test");
  }



DustyPorViva 12-21-2007 08:53 PM

Also, after some help we've deduced that reconnecting fixes it... BUT, I have to reconnect everytime client.mapviewed is updated to take effect, that doesn't make any sense.
And there's no reason that should work, but I'll try it.
EDIT: no, that doesn't change a thing.

DustyPorViva 12-21-2007 09:38 PM

Well, after a LONG time debugging, the problem was simple. Thanks to holysheepy for finding it.
It's not shown in the post, but I was using player.level. bzz, wrong.
Should have used player.level.name... sucks.


All times are GMT +2. The time now is 09:59 AM.

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