Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Array problems (https://forums.graalonline.com/forums/showthread.php?t=76082)

DustyPorViva 08-03-2007 07:40 PM

Array problems
 
I'm working with arrays and having a bit of problems:
PHP Code:

echo(this.itemdb.(@temp.list[i])); 

Echoes:
Quote:

Checking inventory...
{vs_icon-arrow.png,Weapons,6,0,Traditional arrows crafted for efficient archery}
{wbomb1.png,Weapons,6,0,An explosive fuse bomb}
{wboom0.png,Weapons,6,0,Deadly weapon, crafted to always return}
{wbowi1.png,Weapons,6,0,A simple wooden bow}
{wham1.png,Tools,6,0,Hammer capable of breaking small rocks}
But...
PHP Code:

echo(this.itemdb.(@temp.list[i])[0]); 

Echoes the same exact thing, not the subarray. Any idea what I'm doing wrong?

xXziroXx 08-03-2007 07:58 PM

You might want to tell us how the array's are set.

DustyPorViva 08-03-2007 08:07 PM

Nevermind, I fixed it. It's because of the way I had the variables in the .arc file.
I had:
PHP Code:

ItemName={imagefile,catagory,weight,size³,description}
Bow={wbowi1.png,Weapons,6,0,A simple wooden bow}
Bomb={wbomb1.png,Weapons,6,0,An explosive fuse bomb}
Arrow={vs_icon-arrow.png,Weapons,6,0,Traditional arrows crafted for efficient archery}
Boomerang={wboom0.png,Weapons,6,0,Deadly weapon crafted to always return}
Shovel={door.png,Tools,6,0,Simple shovel capable of digging small holes}
Hammer={wham1.png,Tools,6,0,Hammer capable of breaking small rocks

which needed to be:
PHP Code:

ItemName=imagefile,catagory,weight,size³,"description"
Bow=wbowi1.png,Weapons,6,0,"A simple wooden bow"
Bomb=wbomb1.png,Weapons,6,0,"An explosive fuse bomb"
Arrow=vs_icon-arrow.png,Weapons,6,0,"Traditional arrows crafted for efficient archery"
Boomerang=wboom0.png,Weapons,6,0,"Deadly weapon crafted to always return"
Shovel=door.png,Tools,6,0,"Simple shovel capable of digging small holes"
Hammer=wham1.png,Tools,6,0,"Hammer capable of breaking small rock"


xXziroXx 08-03-2007 10:43 PM

:p

zokemon 08-04-2007 07:28 AM

It's probably because it loaded as a string not an array and string[0] is the same as string (while string[1] would be NULL).


All times are GMT +2. The time now is 11:59 PM.

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