How to create a "score" system

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

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

How to create a "score" system

Postby Candle » Fri Feb 09, 2007 5:44 am

16. How to create a "score" system?

First you need to create a new integer variable that will hold the score. To do so, click the "Variables..." button that is under the VBScript text field in the "Hotspot Properties" window and click "New Integer Variable...". Let's call the new variable MYSCORE.

To increase the value of the score by 1, simply use the following code:
MYSCORE = MYSCORE + 1

If you want to tell the player what his or her score is, use the following code:
msgbox MYSCORE

If you want to use a sentence such as "Your score is:", then use the following code:
msgbox "Your score is: " + cstr(MYSCORE)

The reason why the cstr function is used is that you can only add two variables of the same type. Since "Your score is:" is a string and MYSCORE is an integer, you need to convert it to string (with the cstr function) before you can use the "+" operation.

If you want to say "You have not completed the game" if the score is lower than, say, 1000 points, use the following code:
if MYSCORE < 1000 then msgbox "You have not completed the game."



17. How to make the score appear on all the frames?

This question assumes that you have already created a variable contains the score (see the previous question), and that the variable is called MYSCORE.

The following steps will show you how to display the value of MYSCORE on all the frames.

1. Create a new frame, called for example MyScoreFrame.
2. Double-click to get to the frame editor.
3. Right-click to create text.
4. Type the text: "score". Position it where you want the score to appear on all the frames. Close the frame.
5. Click the link for Runtime Frames Merging.
6. You must select each frame that you want to merge with the hotspot in the frame. Use <shift> or <ctrl> to select multiples. Next use the pull-down menu to the frame called MyScoreFrame.
7. Now each of the frames will share the text box, but they don't know what to do with it. Open the Project Properties, go to the Advanced tab, check the option "Execute some VBScript code every time that a frame is loaded", and type in the following code:

i = Action.GetMergedTextIndex
Text(i).Caption="Score: "+CStr(MYSCORE)


See project files zip how to do one.
Attachments
How to create a score system.zip
(778.75 KiB) Downloaded 828 times
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3051
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby ShadowHunter » Fri Feb 09, 2007 9:26 am

Great tutorial Candle :D

Writing scores to an ini file or to the registery in case more players play the game would complete this tutorial 8)

Kind regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby Candle » Fri Feb 09, 2007 6:38 pm

I'll let you do that part of it. lol
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3051
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby ShadowHunter » Fri Feb 09, 2007 8:23 pm

Hi Candle,

Hehe... got me there :D

For now I'll gues the Tic-Tac-Death demo script will provide all needed information...

Anyway good job Candle !

Kind regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Re: How to create a "score" system

Postby dan » Thu Jan 03, 2008 2:09 am

can u do this in the free version? plz answer candle :roll: and if you could do this can you do things like having 100 points then accidentlly hurting your self costing you score?
dan
Junior Member
 
Posts: 10
Joined: Tue Jan 01, 2008 9:02 am

Postby Candle » Thu Jan 03, 2008 2:44 am

No you can't.
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3051
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby dan » Fri Jan 04, 2008 12:01 am

aww that sucks :x
dan
Junior Member
 
Posts: 10
Joined: Tue Jan 01, 2008 9:02 am

Postby Lyberodoggy » Mon Mar 03, 2008 2:05 pm

ShadowHunter wrote:Great tutorial Candle :D

Writing scores to an ini file or to the registery in case more players play the game would complete this tutorial 8)

Kind regards,

ShAdOwHuNtEr


LOL! I hadn't seen this tutorial :P
If you go in my naming system tutorial, you will see a way of doing so.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Taretia » Thu Mar 20, 2008 10:16 pm

hey!!

Is there a way to display a hotspot only if the score is lets say 10?? I mean the hotspot becomes visible when you gain your 10th point and disappears when you gain more...
Taretia
Taretia
Active Member
 
Posts: 97
Joined: Fri Jul 22, 2005 4:23 pm
Location: Ireland

Postby Candle » Thu Mar 20, 2008 11:00 pm

Taretia wrote:hey!!

Is there a way to display a hotspot only if the score is lets say 10?? I mean the hotspot becomes visible when you gain your 10th point and disappears when you gain more...

yes, just use the variables to do it .
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3051
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Taretia » Thu Mar 20, 2008 11:09 pm

Candle wrote:
Taretia wrote:hey!!

Is there a way to display a hotspot only if the score is lets say 10?? I mean the hotspot becomes visible when you gain your 10th point and disappears when you gain more...

yes, just use the variables to do it .


Hey! Great!
OK, so I do a variable when my score is 10 and the use it in the show hotspot only if variable = 1? Or I can write a script to show hotspot is score = 10 or 15 etc?? Sorry, I'm not that good in these... :oops:
Taretia
Taretia
Active Member
 
Posts: 97
Joined: Fri Jul 22, 2005 4:23 pm
Location: Ireland

Postby Lyberodoggy » Fri Mar 21, 2008 1:58 pm

I didn't really get the last one, but if I understood it correctly, the tutorial above should help you.


Anyway, as ShAdOwHuNtEr says, when coding, the sky is the limit, so you can make the hotspot appear in many different ways.
First way (using a boolean variable):
Create two integer variables. One named score and one named scoreequaltoten. Then use the score variable to save the user's score.
Go to your hotspot, make it visible only if scoreequaltoten=1. Then use this line of code to make scoreequaltoten=1:
Code: Select all
If score=10 Then
scoreequaltoten=1
else
scoreequaltoten=0
End If

Second way (using only the score variable):
Create just an integer variable named score.
Go to the frame's properties, under advanced type:
Code: Select all
If score =10 then
Hotspot(the number of your hotspot goes here).enabled=False
else
Hotspot(the number of your hotspot goes here).enabled=True
End If


etc...



Hope it helped...
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Taretia » Fri Mar 21, 2008 2:22 pm

Lyberodoggy wrote:I didn't really get the last one, but if I understood it correctly, the tutorial above should help you.


Anyway, as ShAdOwHuNtEr says, when coding, the sky is the limit, so you can make the hotspot appear in many different ways.
First way (using a boolean variable):
Create two integer variables. One named score and one named scoreequaltoten. Then use the score variable to save the user's score.
Go to your hotspot, make it visible only if scoreequaltoten=1. Then use this line of code to make scoreequaltoten=1:
Code: Select all
If score=10 Then
scoreequaltoten=1
else
scoreequaltoten=0
End If

Second way (using only the score variable):
Create just an integer variable named score.
Go to the frame's properties, under advanced type:
Code: Select all
If score =10 then
Hotspot(the number of your hotspot goes here).enabled=False
else
Hotspot(the number of your hotspot goes here).enabled=True
End If


etc...



Hope it helped...



Hey!

Sorry for not making myself clear in my post. But anyway, the first method what you described, that's what I meant! And I was looking for the second method that you described! :) So thank you!! :) You're a great help
Taretia
Taretia
Active Member
 
Posts: 97
Joined: Fri Jul 22, 2005 4:23 pm
Location: Ireland

Postby Lyberodoggy » Fri Mar 21, 2008 2:34 pm

:oops: hehe, thanks for the compliment :lol:


You are welcome. It's always nice to be of help...
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby chickens1127 » Sun Mar 30, 2008 3:05 pm

Excuse me, and laugh at me, but is this for full edition only?
User avatar
chickens1127
AM Magazine Moderator
 
Posts: 898
Joined: Thu Nov 22, 2007 12:49 am
Location: Awsomeville, USA

Postby Lyberodoggy » Sun Mar 30, 2008 3:16 pm

Yes, it's only for full edition, because it requires vbs...
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby chickens1127 » Tue Apr 08, 2008 11:25 pm

Can I do this with the free version???
User avatar
chickens1127
AM Magazine Moderator
 
Posts: 898
Joined: Thu Nov 22, 2007 12:49 am
Location: Awsomeville, USA

Postby Candle » Wed Apr 09, 2008 12:16 am

chickens1127 wrote:Can I do this with the free version???

I don't know ? what do you think?
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3051
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby binhotinto » Wed Apr 09, 2008 12:22 am

Nice, I think i'm gonna use this to create a simple life/energy system, I can set the score to 100 points and instead of increase more points, I can decrease it (MYSCORE = MYSCORE - 1) till it reachs 0 (If score=0 Then msgbox "game over" ) :)
binhotinto
Member
 
Posts: 50
Joined: Wed Jun 13, 2007 8:55 pm

Postby Lyberodoggy » Wed Apr 09, 2008 11:06 am

binhotinto I suggest you see the stress bar tutorial :P
you can display HP bars with it.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby chickens1127 » Sun Apr 13, 2008 10:33 pm

I'M CONFUSED!


Can I make a simple scoring system with the free version or not?

If you can, here is where I am:
Attachments
HELP.jpg
Here is where I'm stuck. HELP!
HELP.jpg (58.89 KiB) Viewed 15246 times
User avatar
chickens1127
AM Magazine Moderator
 
Posts: 898
Joined: Thu Nov 22, 2007 12:49 am
Location: Awsomeville, USA

Postby Lyberodoggy » Sun Apr 13, 2008 11:16 pm

As far as I am concerned, no there's no way to create a scoring system without AM Full... I 've already answered that before...
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Mon Apr 14, 2008 2:07 pm

Yep. Pretty difficult.
_________________
Gnosticism Forum
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests

cron