neko
New Member
Posts: 5
|
Post by neko on Mar 20, 2007 17:15:52 GMT
OK, I've run into a small problem...
At one point in my book, the player finds a revolver and six bullets. I add these items to the variable $items with the following:
<EVENT event="&addtolist $items, 'Colt Cobra', 6, 'Bullets'"></EVENT>
Now, when the player uses the gun, I obviously deduct one of the bullets. To achieve this I'm using,
<EVENT event="&removefromlist $items, 1, 'Bullets'"></EVENT>
Now, my problem is when I try to show this change on the player's equipment list, which I have on the character sheet. I'm using,
<SCRIPT script="&display_compact_list('\n',$items)"></SCRIPT>
to display the contents of $items on the character sheet.
I want the number of bullets to change on this equipment list; for example, from 6 to 5. However, what happens after I use,
<EVENT event="&removefromlist $items, 1, 'Bullets'"></EVENT>
is that the number "6" remains visible and the word "Bullets" disappears altogether!
Have I missed something obvious here? How can I get the value that's displayed on the character sheet to change without having the word "Bullets" disappear?
Hope that my question is clear!
Thanks!
Neko.
|
|
|
Post by Zaphod Beeblbrox on Mar 21, 2007 5:53:12 GMT
I'm afraid to say that this is because &addtolist is not as friendly in this respect as &removefromlist - there is no counter to add items repeatedly to a list - so what's happening with your statement: <EVENT event="&addtolist $items, 'Colt Cobra', 6, 'Bullets'"></EVENT> ...is you are adding 3 entries to $items, 'Colt Cobra', the number 6, and 'Bullets'. To add 6 'Bullets' to the list at the present time you have to simply say &addtolist($items,'Bullets','Bullets','Bullets','Bullets','Bullets','Bullets'); It's a heck of a mouthful I know. I hadn't considered this eventuality - so thank you for raising this issue. I will see if I can get round to making a second version of &addtolist to make this sort of thing easier in the next few days. Hope that's some help Jason
|
|
neko
New Member
Posts: 5
|
Post by neko on Mar 21, 2007 18:04:49 GMT
OK, will just write it out in duplicate...no problem!
Cheers.
|
|