Hi. I'm trying to make a script that will basically keep track of my character's cash. For example, I want to have my character but a magazine. So, if he has the cash needed for it, He'll walk to the register and pay, then addthat magazine to his inventory. However, If he doesn'tr have enough money, He'll say, "I don't have enough money." I have everything there figured out, exept how to tell the computer how much money he has. My idea is a variable which I will increase by however much cash he recieves, and cash being his points with a coin symbol by them. But, alas, I am a newbie and do not know enough about text scripting to set this variable. Could somebody help me out?
Well declare your money variable somewhere near the top of global script like
money = 30;
(Player starts with 30 coins)
Then when the player recieves more money, for example by picking up a coin
money += 1;
(Adds one coin)
(BTW so far this is all in the begginers script tutorial)
Then in your dialog script when the player asks for the item
run-script 1
Then add the script in dialog request... I'm sure someone else can help you do that but I have to go...
Check out the BFAQ regarding the use of variables HERE (http://www.rain-day.com/harbinger/faq/index.html#coding01).
Then, as Scuthbert recommended, use variable += 1; or variable++; to increment by one. Following the BFAQ information strictly, you can access the variable anywhere in the game, so just check the value of the variable whenever you need it.
You see, I probably would've figured all that out, but I'm not sure of how to access the global script. That's all I need to know.
Main menu > Script > Edit global script... or simply Ctrl-G :)
YAY! It works! Thanks a bunch, guys.