Oops...
I should have read your post more carefully:
Samus wrote:So I tried the code "player.Money = player.Money + 20" (as Money is the set attribute and 20 being the amount of gold) and it says "Error running script: Error compiling expression 'player.Money = player.Money + 20': ArithmeticElement: Operation 'Add' is not defined for types 'Object' and 'Int32'" Any idea why?
because, noobs to quest or to coding, commonly use the actual objects, not yet understanding the concept and usage of "virtual amounts" via the use of Attributes (and their adjustments).
So, I'm certain that your "player.Money" is an actual Object, that you added to the "player" Player Object, correct? Yes (99%)
hence the Error of "int32 <-> object" :
Object.Object = Object + int // "computer does not compute" (and us too ~ it makes sense to us that this doesn't work too)
player(Object).Money(Object) = player(Object).Money(Object) + 5(Int)
see, the problem with this?
what you got to do:
(if you can actually use an Object ~ if there is indeed a way to do so, then I did not know this!, lol)
1. delete your "Money" Object from your "player" Player Object
2. and instead, do this:
"player" -> Attributes (Tab) -> Attributes -> Add ->
Name: Money // or gold or whatever you want // also, a helpful tip, don't use capital letters unless you need or really want to do so! it'll save you a lot of time if you don't use them, lol!
Type: int (integer)
Value: 0 // or whatever amount you want to start with, lol
now, in your (likely) Verb (Tab) of whatever the Object (for example: "atm_machine", lol):
"atm_machine" -> Verb (Tab) -> Add ->
name: give_me_more_money // lol
box: [RUN A SCRIPT]
Add a~new script -> Output -> Print a message -> Print [EXPRESSION] HK.Money = HK.Money + 1000000000000 // oh ya!
(you wouldn't use "HK" of course, lol. You'd use "player" or whatever you named your Player Object as instead)
Also, if you don't realize:
using for example only: "player" and "cash" and "5"
For Addition:
player.cash = player.cash + 5
For Subtraction:
player.cash = player.cash - 5
For Multiplication:
player.cash = player.cash * 5
For Division:
player.cash = player.cash / 5
Also, here's some other ideas for you:
player.cash = player.cash + orc.cash // like after you kill the monster Object: "orc"
player.experience_points = player.experience_points + orc.experience_points // like after you kill the monster Object: "orc"
Also, if you're doing a transaction, then you need a transaction of scripts:
You Buy something from a shop owner:
player.cash = player.cash - 100 // you lose money due to buying something from the shop owner
shop_owner.cash = shop_owner.cash + 100 // shop owner gains money as you're buying something from him
You Sell something to a shop owner:
player.cash = player.cash + 100 // you gain money due to selling something to the shop owner
shop_owner.cash = shop_owner.cash - 100 // shop owner loses money as you're selling something to him
see, "virtual amounts", in action by "adjusting the attributes". No need for having, using, and moving actual Objects around! (thank goodness!)