Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
CharlieTooHuman

Pausing a timer (RMXP)

Question

Hey everyone... Quick question. 

After searching and searching for a solution, I saw that this was possible to do in VX Ace: http://forums.rpgmakerweb.com/index.php?/topic/16546-pausing-timers-and-resetting-events/

VX Ace Script

class Game_Timer
  #--------------------------------------------------------------------------
  # * Pause
  #--------------------------------------------------------------------------
  def pause
    @working = false if @count > 0
  end
  #--------------------------------------------------------------------------
  # * Unpause
  #--------------------------------------------------------------------------
  def unpause
    @working = true if @count > 0
  end
end

Sadly, my project is on XP and the classes and names in the script above do not really apply to the older version of RGSS. I've been trying to do this myself through trial and error, but to no avail. I was wondering what I could do to make the script (in the link above) compatible with RMXP

 

(I'm assuming @working has to be something like @timer_working... And @count is maybe @total_sec? I'm still very new to this scripting thing and not too sure about the differences in the scripting terminology of RMXP and RMVXA)

 

What I'm trying to do: I am attempting to pause a timer when a message is being shown. So, if a timer is running at 10 seconds and I talk to an event, I could call a timer pause to keep it where its at and then unpause the time when I am finished interacting with the event. I found a script that freezes events through a call, so at least I have that... but the timer STILL continues when the message is being shown.

So, is this difficult to do on RPG Maker XP? 

Thanks in advance!
 

Edited by CharlieTooHuman

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

An easy fix might be to set $game_system.timer_working to false.  If you cant change it, change attr_reader :timer_working to attr_accessor :timer_working.  This may take a bit more work...

Share this post


Link to post
Share on other sites
  • 0

I tried the first option in your post and it just erases the timer in the same manner as inserting a stop timer function. The second thing you mentioned, I am a bit unsure about. I went into Game_System and it is already set to attr_accessor : timer_working. Do you mean to do this through a script call?

Thanks for the help!

Edited by CharlieTooHuman

Share this post


Link to post
Share on other sites
  • 0

try this: 

class Game_System
  #--------------------------------------------------------------------------
  # * Pause
  #--------------------------------------------------------------------------
  def pause
    @timer_working = false if @timer > 0
  end
  #--------------------------------------------------------------------------
  # * Unpause
  #--------------------------------------------------------------------------
  def unpause
    @timer_working = true if @timer > 0
  end
end

So instead of calling with "$game_timer," you can use "$game_system." As RMXP stores its timer in Game _System since Game_Timer was never written for that engine.

Share this post


Link to post
Share on other sites
  • 0

Ah! Okay, so the class was game_system.

And the replacement for @count was @timer... Awesome

 

 

Thanks a lot Bigace! Problem solved

Edited by CharlieTooHuman

Share this post


Link to post
Share on other sites
  • 0

Erm, Well since this request was solved. I'm locking it. just because we don't want anything weird here.

 

@CharlieTooHuman if you want this topic to be re-opened please contact me or any other mods.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...