Simple Counter Display

Status
Not open for further replies.

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV
I have a minigame and I want to make it so that you only have so many turns. I would like to be able to have a display running during the game to show how many turns you have left. I'm thinking just a small window in one of the top corners that shows the number of turns left and changes as the variable that holds the number of turns changes.

I have searched and can't seem to find what I am looking for it, but if it's out there great. If not and someone would like to help create this for me, I would be very grateful. Thank you in advance!

And if you do want to do it and need more information, please just let me know what.
 

Rieker

>9000 pixels
Veteran
Joined
Jan 16, 2014
Messages
82
Reaction score
17
Primarily Uses
Wouldn't a simple display picture event work? each time the variable changes the number of turns on the picture counts up or down.
 

Ruiran

Veteran
Veteran
Joined
Nov 4, 2013
Messages
78
Reaction score
30
First Language
English
Primarily Uses
I'm to lazy to write this(give me a sec), but couldn't you just make a script that would create a window (at 0,0 or the left hand corner) whose text shows a variable corresponding to the turns remaining ?
 
Last edited by a moderator:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV
@Reiker - I thought about that. But then, wouldn't I have to make and upload all of those different pictures? And for this particular game it will likely take more than 20 turns. If I do more challenging levels, possibly 30, 40, etc. That's a lot of little pictures to make, save, load and then display. It seemed to me it would be much simpler to have a bit of code that creates a small window that displays text. Maybe I'm wrong though. Hopefully a scripter will chime in.

@Ruiran - Well, I'm hoping that someone simply can but no, I do not know enough about scripting to do this. At least, I don't think I do. If I thought I could, I would have done it.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
module mlogan def self.create $spr = Sprite.new(Viewport.new) $spr.x = 0 $spr.y = Graphics.width-32 #for example $spr.bitmap = Bitmap.new(Graphics.height,Graphics.width) $spr.bitmap.draw_text(0,0,32,32,"Initial turn count here") end def self.adjust(value) $spr.bitmap.clear $spr.bitmap.draw_text(0,0,32,32,value.to_s) end def self.clear spr.bitmap.clear endendso just call mlogan.create at the start (then possibly call mlogan.clear in case you don't need it yet)then just call mlogan.adjust(value) when you want to show a new value

Note though that this is a basic show text method, there will be no window backgrounds
 
Last edited by a moderator:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV
First, thanks Engr!

Second, I stuck it under Materials, like I have with other scripts. I am getting this error, upon game start (don't even make it to the menu).



I do have other scripts, could they possibly be interfering? If not, what am I doing wrong?
 

Ruiran

Veteran
Veteran
Joined
Nov 4, 2013
Messages
78
Reaction score
30
First Language
English
Primarily Uses
First, thanks Engr!

Second, I stuck it under Materials, like I have with other scripts. I am getting this error, upon game start (don't even make it to the menu).



I do have other scripts, could they possibly be interfering? If not, what am I doing wrong?
I'm not sure but try replacing mlogan with Mlogan or MLOGAN
 
Last edited by a moderator:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV
@Ruiran - Thanks, the capital M did the trick for whatever reason.

However, I'm not getting it to display. I'm sure it's just my ignorance. I changed "Initial Turn Count Here" to "25". I then created a parallel process event triggered by a switch that has the script call Mlogan.create. I tested it and even with the switch is definitely triggered, there it no display shown.

Is there more I need to customize so that it shows?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
ah yes, it should at least start with a capital letter... sorry... :) \


try adding this to the create method


$spr.z = 400
 
Last edited by a moderator:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV
Still nothing. Just to clarify, this is how I called the script. Yes? Or totally wrong?

ScriptError2.png
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
oh wait, my formula is wrong... silly me


it should be


$spr.x = Graphics.width - 32


$spr.y = 0


right now, it tries to show at y = 544-32 => 512, while the maximum height of the window is just 416... :)


btw, you can adjust the .x and .y lines to fit your needs
 
Last edited by a moderator:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV
Yay, that did it! I figured those were the display position values, but I didn't want to mess with them until it showed up first.

Now, hopefully last question. Is there a way to show the value of a variable in "Initial turn count" spot? I know in text input you would use \V or whatever. Can something similar be done here?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
replace the "INITIAL VALUE HERE" with $game_variables[iD].to_s, ID being the id of the game variable


for the adjust(value), just remove the to_s part


so like


Mlogan.adjust($game_variables[iD])
 
Last edited by a moderator:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV
Sweet! Working beautifully! Thank you so much!

This can be closed now.
 

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
15,141
Reaction score
15,473
First Language
Filipino
Primarily Uses
RMMZ
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top