Hey, guys,
I'm having more trouble. I promise for every problem I drop here, I struggle through and solve 6 -on average- on my own, so I'm really making an effort and not just begging for help the first second I hit a wall.
My problem now is that I have an object that I'm having display lists of items “purchased” in the game. That's easy, and done. Problem is, the player might want to sell those objects back, and thus I need to set a cost for the Strings put into the Stringlist in game. I've decided to do that by creating a StringDictionary (game.purchases), and adding the Strings and associated costs there. However, when I do that:
Error running script: Error adding key '40mm-S, High Explosive [5]' to dictionary: Unable to cast object of type 'System.Int32' to type 'TextAdventures.Quest.Scripts.IScript'.
The code I'm using is:
list add (this.purchase, this.listalias + ", " + this.round + " [" + result + "]")
<b>dictionary add (game.purchases, this.listalias + ", " + this.round + " [" + result + "]", (this.cost*ToInt(result)))</b>
player.grace = player.grace-(this.cost*ToInt(result))
msg (result + " rounds of " + this.listalias + ", " + this.round + " ammunition purchased for " + (this.cost*ToInt(result)) + "G. " + player.grace + "G left.")
So, I want the specific caliber (this.listalias) + the type of ammo (this.round) + the number of rounds purchased (result) added to the dictionary and then associated with the actual item cost (this.cost*ToInt(result)).
All of this works great, except the dictionary part. Then I get the error. Do I have to convert this expression to a String, and if so, how?
Thanks again for the help, guys,
Unadept