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.
Simple Pedometer HUD

0 Members and 1 Guest are viewing this topic.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Simple Pedometer HUD
Version: 1.1a
Author: cozziekuns
Date: May 2, 2010

Version History


  • <Version 1.0> 05.02.2010 - Original Release
  • <Version 1.0b> 05.02.2010 - Made the X and Y module
  • <Version 1.1a> 05.02.2010 - With the help of Deity and MA, you can now disable the pedometer with Q, and enable with W.

Planned Future Versions

  • <Version 1.1b> Pausing.

Description


A simple pedometer HUD. The only reason I can see that this could be useful is if you have an item akin to an egg in pokemon, where the item will hatch, break, etc on a specific step count, and you want your player to be able to see how many steps his walked.

Features

  • A simple pedometer HUD.
  • Updates itself.
  • Up to 5 digits, or 99999 Steps before it breaks down.
  • Resettable.
  • Shows up as a variable.
  • Able to disable

Screenshots



Instructions

See the header. You can change the modules as you like as well. To reset the pedometer, just set the variable (default is 1) to 0.

Script


Code: [Select]
#===============================================================================
#
# Cozziekuns' Simple Pedometer HUD
# Last Date Updated: 4/10/2010
#
# A pedometer that counts your steps. It can be reset. The step count is stored
# in the variable 1 by default.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 05/02/10 - Started Script.
# o 05/02/10 - Created the X and Y function on the module.
# o 05/02/10 - Made disabling possible.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Pausing?
# o I dunno. You tell me!
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#===============================================================================

module COZZIEKUNS
  VARIABLE = 1 # The variable where the step count is stored
  PEDOMETER = "Pedometer" # The text above the step count.
  ICON = 48 # The Icon aligned left of the step count.
  X = 384 # The X co-ordinate of the window.
  Y = 328 # The Y co-ordinate of the window.
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    $game_map.refresh
    @spriteset = Spriteset_Map.new
    @CozX = COZZIEKUNS::X
    @CozY = COZZIEKUNS::Y
    @pedometer_window = Window_Pedometer.new(@CozX, @CozY)
    @message_window = Window_Message.new
  end
  
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    if $scene.is_a?(Scene_Battle)     # If switching to battle screen
      @spriteset.dispose_characters   # Hide characters for background creation
    end
    snapshot_for_background
    @spriteset.dispose
    @pedometer_window.dispose
    @message_window.dispose
    if $scene.is_a?(Scene_Battle)     # If switching to battle screen
      perform_battle_transition       # Execute pre-battle transition
    end
  end
  
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if Input.trigger?(Input::L)
      @pedometer_window.visible = false
    end
    if Input.trigger?(Input::R)
      @pedometer_window.visible = true
    end
    $game_map.interpreter.update      # Update interpreter
    $game_map.update                  # Update map
    $game_player.update               # Update player
    $game_system.update               # Update timer
    @spriteset.update                 # Update sprite set
    @message_window.update            # Update message window
    @pedometer_window.update
    unless $game_message.visible      # Unless displaying a message
      update_transfer_player
      update_encounter
      update_call_menu
      update_call_debug
      update_scene_change
    end
  end
end

#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles maps. It includes event starting determinants and map
# scrolling functions. The instance of this class is referenced by $game_map.
#==============================================================================  
 
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Increase Steps
  #--------------------------------------------------------------------------
  def increase_steps
    super
    return if @move_route_forcing
    return if in_vehicle?
    @variable = COZZIEKUNS::VARIABLE
    $game_party.increase_steps
    $game_party.on_player_walk
    $game_variables[@variable] += 1
  end
end

#==============================================================================
# ** Window_Pedometer
#------------------------------------------------------------------------------
#  This window displays a pedometer
#==============================================================================

class Window_Pedometer < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     x : window X coordinate
  #     y : window Y coordinate
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 160, WLH + 64)
    @variable = COZZIEKUNS::VARIABLE
    refresh
  end
  #--------------------------------------------------------------------------
  # * Step_Count
  #--------------------------------------------------------------------------
  def step_count
    @stepcount = $game_variables[1]
    steps = @stepcount
    result = sprintf("%05d", steps)
    return result
  end
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if $game_variables[2] = 1
    text = step_count
    texta = COZZIEKUNS::PEDOMETER
    self.contents.font.color = system_color
    draw_icon(COZZIEKUNS::ICON, 4, 32)
    self.contents.draw_text(4, 0, 120, WLH, texta, 1)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, WLH ,text, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if $game_variables[@variable] != step_count
      refresh
    end
  end
end

Credit


  • cozziekuns

Thanks


  • Deity
  • Modern Algebra

Support


Just post down here.

Known Compatibility Issues

Seems like it gets in the way of Active Battle System HUD's. Though you could just change the X and Y co-ordinates.

Demo


See attached.

Restrictions

:ccby:
« Last Edit: May 03, 2010, 10:07:19 PM by cozziekuns »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Yeah, it does seem like it has limited uses. It's cool nonetheless :)

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Thanks for the positive feedback! Hope someone can find more uses for this then I could.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, I think it could be useful for some minigames; for instance, maybe they could make a maze that you only have a limited number of steps to get through it or else you lose; stuff like that.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
That's a nice idea, but at the moment I can't find a way to disable the script -.- So using it for a minigame wouldn't be a good idea, unless your willing to have it on for the whole game just for those one or two minigames.


***
Rep:
Level 82
aka DigiDeity
Hay nice idea!
To disable the script you've only to change the visibility of the window.
Use the window-class variable visible = boolean to change the visibility.

Deity
Greetings
DigiDeity

├Work┤
├Contact┤


***
EXECUTED WEEBLING?
Rep:
Level 81
Im still here.. hahahahahaha
Is There any way to get rid of stuff on Mr Mo mo's ABS HUD
Hey if you need anything just ask.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Is There any way to get rid of stuff on Mr Mo mo's ABS HUD

Lol no.

Jokes, just move the x, y co-ordinates somewhere else. And if I'm not mistaken, I think Mr Mo's ABS is for RPG Maker XP... This is for RPG Maker VX. Sorry.

@Deity: Great idea! I'll try it now.
« Last Edit: May 02, 2010, 08:17:59 PM by cozziekuns »

***
EXECUTED WEEBLING?
Rep:
Level 81
Im still here.. hahahahahaha
Is There any way to get rid of stuff on Mr Mo mo's ABS HUD

Lol no.

Jokes, just move the x, y co-ordinates somewhere else. And if I'm not mistaken, I think Mr Moo's ABS is for RPG Maker XP... This is for RPG Maker VX. Sorry.

@Deity: Great idea! I'll try it now.

What line is It On? And Yea Xp :D
Hey if you need anything just ask.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
What line is It On? And Yea Xp :D

Well, I updated it so the X and Y co-ordinates can be changed easily through the module. Still no progress on disabling it though. Killing the opacity doesn't seem to destroy the text, and I don't want to dispose the window, because then it won't be updating constantly...

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Why won't:

Code: [Select]
@pedometer_window.visible = false

work?

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Why won't:

Code: [Select]
@pedometer_window.visible = false

work?

Wow, I was doing a lot more than that. It worked in the end. Thanks Deity and Modern Algebra!