Creating the Money Variable

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Creating the Money Variable

Postby onyxeye2004 » Thu May 06, 2010 8:59 pm

I'm trying to make a game where you have a bank. But I can't get the money variable to work... I tried following these instructions:

Just create an "integer" variable called for example Money, and then use the following code to increase it:
Money = Money + 1
To display it on the screen, create a new textbox (by right-clicking on the frame background), and then use the following code:
Text(1) = Money


But nothing is working...

Where do I go to make a Money Variable AND where do I go to type "Money = Money + 1" and how does that work? :shock:
And how do I get the money to appear on screen? The "Text(1) = Money" isn't working. :x

Forgive me I don't know this stuff very well.
onyxeye2004
Member
 
Posts: 17
Joined: Thu Jan 21, 2010 4:47 am

Postby Lyberodoggy » Thu May 06, 2010 9:34 pm

You may want to try this sample project over here: http://www.adventuremaker.com/phpBB2/vi ... php?t=2945
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby onyxeye2004 » Thu May 06, 2010 9:50 pm

thanks!

is there a way to show your balance at all times? instead of checking your balance? i tried the "text(1) = money" code from the help page with my own experimenting and nothing showed up...
onyxeye2004
Member
 
Posts: 17
Joined: Thu Jan 21, 2010 4:47 am

Postby Mystery » Thu May 06, 2010 10:22 pm

Doggy, your demo doesn't work for me - guess due to the Greek letters used.

@onyxeye2004

I don't know what exactly you wish to do, but to answer your questions:

Right click on the frame, and make a text box.

Create a hotspot on which the player has to click to get money.
On the Advanced Tab of the Hotspot Properties add:
Code: Select all
money=money+1
Text(1) = money


If you have different hotspots in your bank, e.g. to take a 5 Dollar bill or a 50 Dollar bill, you'd need to add to the Advanced Tab of the Hotspot Properties:

Code: Select all
money=money+5
Text(1) = money

for the 5 Dollar bill

Code: Select all
money=money+50
Text(1) = money

for the 50 Dollar bill

Does this help?

EDIT
I see that you have edited your previous post.

Would you like your balance (value of your money variable) to show up on 1 screen or on several screens?
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

to mystery

Postby onyxeye2004 » Thu May 06, 2010 10:29 pm

ok mystery..

for example i want to create a game where you can see your balance without having to click a hotspot.. like a chart showing your account balance. i know it has something to do with right clicking to create a text box on the frame but i dont know what to type in the text box...
onyxeye2004
Member
 
Posts: 17
Joined: Thu Jan 21, 2010 4:47 am

Postby Mystery » Thu May 06, 2010 10:40 pm

If you create a textbox by right clicking, you can just press the Space key a few times or type 00, this will be just the place holder for the display of the variable values :)

However, with my above described method, you won't see a chart, but just the value of your money variable (0 or 25 or 50 etc.).
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

worked

Postby onyxeye2004 » Thu May 06, 2010 10:46 pm

WOW thanks so much it works for me now. I didn't know you had to put the Text(1) = money code in the VBS code box.. thanks
onyxeye2004
Member
 
Posts: 17
Joined: Thu Jan 21, 2010 4:47 am

Postby Mystery » Thu May 06, 2010 10:47 pm

Great to hear that you got it working :D
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby onyxeye2004 » Thu May 06, 2010 10:48 pm

ONE MORE THING.. is there a way to show your beginning blance (before clicking anything), like 0?
onyxeye2004
Member
 
Posts: 17
Joined: Thu Jan 21, 2010 4:47 am

Postby Mystery » Thu May 06, 2010 10:50 pm

Doesn't it show 0 automatically?
For me it does, but maybe you have done it differently.
In that case just type in where you have right clicked on the screen to enter text: 0
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby onyxeye2004 » Thu May 06, 2010 10:53 pm

DUH!
Thanks
onyxeye2004
Member
 
Posts: 17
Joined: Thu Jan 21, 2010 4:47 am

Postby Mystery » Thu May 06, 2010 10:58 pm

You're most welcome :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Fri May 07, 2010 1:04 pm

What you can also do to simulate a bank is to use AM dialogues instead of inputboxes. The rest of the code can be the same
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

another frame

Postby onyxeye2004 » Fri May 07, 2010 6:18 pm

ok im having a problem.. how can i get a hotspot to change a balance (number/money) on another frame?
onyxeye2004
Member
 
Posts: 17
Joined: Thu Jan 21, 2010 4:47 am

Postby Mystery » Fri May 07, 2010 6:47 pm

Hehe, I suspected that this question would come, this is why I asked your earlier:

Mystery wrote:
Would you like your balance (value of your money variable) to show up on 1 screen or on several screens?


Let me check my demo project to provide you information how you can do that - will be back soon :)


EDIT

Create a frame called Money or Stats.
Right click on it, and add some text as a place holder (just like you did before on the Bank frame, but there please remove the text now).

In the Advanced Tab of the Hotspot Properties which should change the value of your Money variable, add something like:

Code: Select all
Money=Money+10
i = Action.GetMergedTextIndex
Text(i).Caption="Money: "+CStr(Money)


Then go to
Project Properties -> Advanced Tab -> Execute some VBScript code every time that a frame is loaded
and add:

Code: Select all
i = Action.GetMergedTextIndex
Text(i).Caption="Money: "+CStr(Money)


Then click Runtime Frames Merging (on your Project Menu), and highlight/select all the frames on which you would like to display the value of the Money variable.
From the drop-down menu (Merge With) on the right, choose your Money or Stats frame.
Then click Assign.


I hope I haven't forgotten anything, if something doesn't work, let me know what, and I'll check my code.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby onyxeye2004 » Sat May 08, 2010 1:10 am

thanks it works! and sorry i missed that yesterday...
onyxeye2004
Member
 
Posts: 17
Joined: Thu Jan 21, 2010 4:47 am

Postby Mystery » Sat May 08, 2010 3:48 pm

Glad to hear that it works, you're welcome :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron