I Want To Make A Score That Changes When You Click A Button And The Score Shows Up In A GUI

Started by Cool_Wesley_Dude on

Topic category: Help with MCreator software

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I Want To Make A Score That Changes When You Click A Button And The Score Shows Up In A GUI

PLEASE HELP ITS HARD AND I WATCHED TUTORIALS, THEY DONT HELP!!!

Im trying to put the string in the math block D: it doesnt work.

Anyone know how to help?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You need a clearer…
Tue, 01/16/2024 - 22:21

You need a clearer explanation of what you're trying to do, otherwise it's hard to provide help. I can offer some basic pointers though:

  • You'll probably want to make a player-persistent number variable to save your score. 
  • You can convert numbers to strings, but it's more difficult to convert strings back to numbers.There should be a 'text' function that will format a provided number as a string, for things where a string is required.
  • GUIs can use the GUI itself and the entity viewing it as dependencies; so if your score is a player-persistant number variable, you should be able to use it as an input for your GUI. (You would need to make an additional procedure that returns a string to display; in this case, by converting the score of the target entity into a string, and returning that string). Again, I can explain this more in depth, but I need to know what you're trying to do specifically.
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i have a lot of stuff done …
Tue, 01/16/2024 - 22:58

i have a lot of stuff done 

im making a mod how you click a button and it gives you a click point vut i dont know how to make it give you a poing becuz my points are strings if yk what i mean

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You should use numbers, not…
Wed, 01/17/2024 - 00:45

You should use numbers, not strings, for points. You cannot do math on strings, and while it's easy to convert numbers to strings, it is more difficult to convert strings to numbers. 

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do i do that by chance?
Wed, 01/17/2024 - 14:01

how do i do that by chance?

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
cuz im making a mod that i…
Wed, 01/17/2024 - 14:05

cuz im making a mod that i have been doing for a LONG time and it wont work

 

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and its gonna be cool but…
Wed, 01/17/2024 - 14:06

and its gonna be cool but idk how

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
so  i am making a mod how u…
Wed, 01/17/2024 - 14:09

so  i am making a mod how u click and the score (ClickCount) goes up by (UpgradeAmount) so 1 upgrade is 2 per and 5 upgrades is 6 per so each upgrade makes it give u 1 more click each upgrade

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't totally understand…
Wed, 01/17/2024 - 14:11

I don't totally understand what you mean, but here's the basic idea:

Go to the 'variables' tab and add a custom, player-persistent or player-lifetime number variable. (I'll call it 'score_counter'). If it's player persistent, the score will stay the same even if the player dies, if it's player-lifetime, it will go back to zero when the player dies.

Whenever the player pushes the button, set the 'score-counter' variable for that player to the current value of the 'score-counter' variable, plus whatever the upgrade level for the item is.

Make a procedure with a 'return string' function, (you can find this in the flow control tab). Take the current value of 'score-counter,' and use a 'convert number to string' function to turn it into a string, then use that for the 'return string' function. Then, in your GUI, make a textbox that uses this procedure as its text provided. The procedure will check the current score for the player, convert that score into text, and return that text. (You could also use a 'combine text' function if you want it to say something like 'Score: 42' instead of just returning '42'.)

If you want scores for a specific item, you need to use NBT data instead. This will just provide a single score for the player themself.

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
convert number to string????…
Wed, 01/17/2024 - 14:13

convert number to string????? where??

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
'Text' tab, scroll, it's…
Wed, 01/17/2024 - 14:15

'Text' tab, scroll, it's actually named 'format (blank) as ##.##,' which is confusing. If you don't want it to show decimal values, you can change the formatting to '##.'

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
do you think you could show…
Wed, 01/17/2024 - 14:16

do you think you could show me some screenshots to help if you have time?