by Tdarcos » Wed Sep 19, 2012 7:29 pm
Roody_Yogurt wrote:Yeah, name has to return a dictionary entry, so you could either add every conceivable dollar-amount-phrase to the dictionary table (I wouldn't do this) or go a different route altogether.
Personally, I would use the "inv_desc" property instead:
Code: Select all
property CashOnHand
object cash "cash"
{
Cashonhand 10
in you
inv_desc
{
print "You have $" number self.cashonhand " cash."
return true
}
is static
}
Now, when the player checks his inventory, he'll get:
You have $10 cash.
You are also carrying (rest of inventory).
Thank you, it was perfect, with one exception. With yours, the output is
You have
$10
cash
It needed to be
print "You have $"; number self.cashonhand; " cash."
I had no idea it would insert newlines between items, I only thought it did that if you didn't
end the line with a semi-colon, not if you didn't put one after each item.
But thank you otherwise, it's perfect and exactly what I wanted.
[quote="Roody_Yogurt"]Yeah, name has to return a dictionary entry, so you could either add every conceivable dollar-amount-phrase to the dictionary table (I wouldn't do this) or go a different route altogether.
Personally, I would use the "inv_desc" property instead:[code]property CashOnHand
object cash "cash"
{
Cashonhand 10
in you
inv_desc
{
print "You have $" number self.cashonhand " cash."
return true
}
is static
}
[/code]
Now, when the player checks his inventory, he'll get:
[quote]You have $10 cash.
You are also carrying (rest of inventory).[/quote][/quote]
Thank you, it was perfect, with one exception. With yours, the output is
[color=red]You have
$10
cash[/color]
It needed to be
print "You have $"; number self.cashonhand; " cash."
I had no idea it would insert newlines between items, I only thought it did that if you didn't [i]end[/i] the line with a semi-colon, not if you didn't put one after each item.
But thank you otherwise, it's perfect and exactly what I wanted.