Graal Forums

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

wild8900 04-16-2006 10:38 PM

Hat system problems
 
Ok, so im new to gs1 and I dont knwo how to use arrays.....
Well I think hat systems use arrays (right?). Well, Once I set an array how do I add another var to it? And how do I read parts of the array (like when showing what hats you have).

contiga 04-17-2006 04:56 PM

You could do:
thiso.hatzlist = { 0, 1, 2, 3}; -> as standard hats
Then when you buy a hat, like: hat number 50.. you make the buy script do: client.hat_50 += 1; so for example client.hat_50 is 2 when you bought 2 times hat 50.

After that, to add the hat to the array you do:
for ( i: getstringkeys( "client.hat_"))
thiso.hatzlist.add( client.( "hat_" @ i));

Then thiso.hatzlist would be 0,1,2,3,50

To read a part of the array, do: thiso.hatzlist[ index], the index of an array starts with 0, so thiso.hatzlist[ 4] would say: 50 in this case.. :)

Bl0nkt 04-17-2006 06:32 PM

getstringkeys? Never heard of it.

Anyway, you need to note this is GS2. You may not be familiar with a lot of what he showed you.

excaliber7388 04-17-2006 08:53 PM

I use this.hat++ and this.hat -- along with a setting function so that when set, hat#v(this.hat).png is a hat (in gs1)

ApothiX 04-19-2006 02:24 PM

Hat systems are usually string lists. I've seen in another thread of yours that you are not using the new engine, so you should be using the basic stringlist functions:
addstring, removestring, insertstring.


All times are GMT +2. The time now is 08:51 AM.

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