RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Scoring In GameMaker

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 87
Lord of MSCF
I found the D&D score thing in GameMaker very hard to understand, and I told that GML was easier. I would like to know how to show the score, and know how to add 1 to it each time.

I have tried the following code below...
CODE STARTS
show_score
score += 1;

...but that has failed and comes up with the error message:

"COMPILATION ERROR in code action
Error in code at line 71:
score += 1;

at position 2: Assignment operator expected."
CODE ENDS

If someone could show me how to solve it, thanks in advance.


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Hmmmmm...

Well, whoever told you that GML was easier is probably wrong. GML is not only a little harder (for me at least) to keep organized, and a little more glitch prone, but D&D is also read much faster by the compiler.

Could you please copy the entire code into a new post?

**
Rep: +0/-0Level 87
Lord of MSCF
I have sorted the problem.

I did that by finding out that I had to do the following:-

show_score = true;

I now want to know how I can show the score on the screen itself...rather than in the windows window thingy.


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
There is a way, uh...lemme think.

You would just tell it to draw text, and in the place where it asks what text to show jusy say...player.score, I think.

I'm sorry, but I don't use either of those functions in any of my projects. If you continue to have trouble figuring it out, just say so, and I'll try to hook you up with an example.

**
Rep: +0/-0Level 87
Lord of MSCF
I have tried:

draw_text(0,32,score);

But it doesn't seem to work.


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Hm. Well, I'll try to hook you up, just give me about a day. :D

*
Shooting for the "MEMBER MODERATOR OF THE YEAR 2007" Award
Rep:
Level 89
Hi, there.
Here is an example. All I did was change a system unction(see picture below) so that it wont show the border(therefore not showing the score as well).

Hope this helps. :D
Sig by MacGravel

**
Rep: +0/-0Level 87
Lord of MSCF
Not trying to be rude Stephen, but I'm having a bit fo a hard time learning/understanding .rar example you let me have a look at.


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

**
Rep: +0/-0Level 87
Lord of MSCF
Sorry for the double post. I have sorted the on screen score out. Now i might as well link this problem in this topic instead of starting a new one.

Rigth, so I have my score system set up using the gm score. But the thing is, I would like to know how to show the score on a scorecard at the end of each hole. I have set up another room, but I want to know how to show the score that the player got on that hole and pevious holes.


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Okay, that I can tell you off the top of my head. ;D

Make a global variable called global.score. Set that variable to the player's score at the end of each level. Then, make the board check that variable, and display a corresponding number. :D

**
Rep: +0/-0Level 87
Lord of MSCF
Okay, that I can tell you off the top of my head. ;D

Make a global variable called global.score. Set that variable to the player's score at the end of each level. Then, make the board check that variable, and display a corresponding number. :D
Sorry, about this, but where do I put this. Also, if you could use a little step by step, it will help me understand and learn better. That is the only way I can learn the code. Sorry if I'm being rude.


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
No no, its perfectly fine! Do it like this:

1. Go to the object you use to handle score in the room where the game is played (where the score is set for the scoreboard).

2. Go to the control tab, and take a set variable button. Put it in the "create" event.

3. Make that set variable say "global.score", and make it equal to "0"

4. Grab another one, and in the "room end" event, make it set "global.score" equal to "score".

5. In the room with the scoreboard, open the object that controls the scoreboard's display.

6. When it is time for that object to decide what to display, tell it to check the variable you set up, "global.score".

7. Then, tell it to act on that variable. If you are using a sprite for the display, tell it to use a corresponding image_index. If you are drawing text, tell it to draw the number stored in your variable.

Good, or did I miss something?

**
Rep: +0/-0Level 87
Lord of MSCF
I don't use the 'room end' event, simply because it wont work for me. Are you telling me to create a room end event, or use the one I've got.(I haven't got one, as I use the different room event)


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Well, you could easily use somtehing else, just make sure that the variable is set to equal whatever your scroe is after that player finishes and before the scoreboard needs it really.

**
Rep: +0/-0Level 87
Lord of MSCF
Well, you could easily use somtehing else, just make sure that the variable is set to equal whatever your scroe is after that player finishes and before the scoreboard needs it really.
Sorry, but this is getting a little confusing now. I'll post a link to the gm file, which should be below.

Link


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Holy crap, what happened to my spelling?

I'll take a look. :D

EDIT: Nice code! I made a REALLY simple score check, it just makes a crappy little number in the next room that is representative of your score. I'm interested in seeing where this goes, so keep us posted!

http://www.savefile.com/files/760071
« Last Edit: May 28, 2007, 04:39:43 PM by Arrow-1 »

**
Rep: +0/-0Level 87
Lord of MSCF
Holy crap, what happened to my spelling?

I'll take a look. :D
Don't be so harsh on yourself...it's just a typo.


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Edited my last post. Enjooooooooooooy :D

**
Rep: +0/-0Level 87
Lord of MSCF
So would that apply for the hole after the first one. What I mean is, when I move onto the second hole, and complete it, will the score from hole 1 still show?

I appreciate the help as well.


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Well, you'd have to make a seperate score object for each hole. You'd make it have no sprite until it was needed. After each hole is completed, and the subimage is set, you'll want to make sure you store the subimage you got to a variable.

For instance, the first hole's score.

image_index=score

global.myimage1=score

-------------------------------
Then when you need it again, in a later score room
-------------------------------

self.image_index=global.myimage1

**
Rep: +0/-0Level 87
Lord of MSCF
Well, you'd have to make a seperate score object for each hole. You'd make it have no sprite until it was needed. After each hole is completed, and the subimage is set, you'll want to make sure you store the subimage you got to a variable.

For instance, the first hole's score.

image_index=score

global.myimage1=score

-------------------------------
Then when you need it again, in a later score room
-------------------------------

self.image_index=global.myimage1
Sorry, but would I put that in code, in a create event in the room I want as the scorecard?

EDIT: I will be going out soon, so I may have to look into this tomorrow.
« Last Edit: May 28, 2007, 05:15:26 PM by Minihobbs »


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
Tomorrow sounds just fine, I have things I need to do today as well. I'll just edit the gm6 again and repost it.

**
Rep: +0/-0Level 87
Lord of MSCF
Tomorrow sounds just fine, I have things I need to do today as well. I'll just edit the gm6 again and repost it.
Yesturday I played a couple of games of snooker and some pool, it was great. No rush anyways, I have got plenty of graphics to do in the meantime.


Wisdom is knowing that a tomato is a fruit, knowledge is knowing not to put it in a fruit salad.

Currently working on:
Mini-Mini Golf