![]() |
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). |
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.. :) |
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. |
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)
|
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.