• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Script: Watch in the Pokégear Menu

FL

Pokémon Island Creator
2,444
Posts
13
Years
  • Seen Apr 22, 2024
gif.gif
screen.png

Add a watch in the Pokégear menu.

Link

Tested on Essentials v13, v18.1 and v20.1. If this script isn't working on latest Essentials version, please inform on this thread.

This script works well with Unreal time system
 
Last edited:
63
Posts
9
Years
  • Age 33
  • Seen Aug 15, 2017
How easily could this be adapted for a wall clock? I can't seem to find any info on setting up a wall clock that upon interaction would show the time.
 
32
Posts
10
Years
  • Age 29
  • Seen Nov 19, 2016
How easily could this be adapted for a wall clock? I can't seem to find any info on setting up a wall clock that upon interaction would show the time.

Hello!

It can be done very easily actually. Say you just want a message to show up after interacting with the clock. Simply create an event and use this script call:

Code:
pbSet(112,pbGetTimeNow.strftime("%I:%M %p"))

This just stored the current time in Variable 112 (or which ever temporary variable you'd like). Now, let's display this in a text message. With the same event, use Show Text and allow it to say the following:

"The time is \v[112]."

And there you have it! It will display the time in HOUR:MIN AM/PM format. You could replace with pbGetTimeNow.strftime("%I:%M %p") with pbGetTimeNow.strftime("%A") to display the current day of the week instead. Or any combination of either, really.
 
  • Like
Reactions: FL
63
Posts
9
Years
  • Age 33
  • Seen Aug 15, 2017
Thanks very much! I love the clock bit from RSE and I'm not wanting to attempt clocksetting, but I'd like interactions with objects to be real and of value =]
 

Epic Flex

Game Dev
2
Posts
10
Years
While Testing I get This error message
View attachment 73650

Here My Code
Code:
class PokegearButton < SpriteWrapper
  attr_reader :index
  attr_reader :name
  attr_accessor :selected

  def initialize(x,y,name="",index=0,viewport=nil)
    super(viewport)
    @index=index
    @name=name
    @selected=false
    fembutton=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearButtonf"))
    if $Trainer.gender==1 && fembutton
      @button=AnimatedBitmap.new("Graphics/Pictures/pokegearButtonf")
    else
      @button=AnimatedBitmap.new("Graphics/Pictures/pokegearButton")
    end
    @contents=BitmapWrapper.new(@button.width,@button.height)
    self.bitmap=@contents
    self.x=x
    self.y=y
    refresh
    update
  end

  def dispose
    @button.dispose
    @contents.dispose
    super
  end

  def refresh
    self.bitmap.clear
    self.bitmap.blt(0,0,@button.bitmap,Rect.new(0,0,@button.width,@button.height))
    pbSetSystemFont(self.bitmap)
    textpos=[          # Name is written on both unselected and selected buttons
       [@name,self.bitmap.width/2,10,2,Color.new(248,248,248),Color.new(40,40,40)],
       [@name,self.bitmap.width/2,62,2,Color.new(248,248,248),Color.new(40,40,40)]
    ]
    pbDrawTextPositions(self.bitmap,textpos)
    icon=sprintf("Graphics/Pictures/pokegear"+@name)
    imagepos=[         # Icon is put on both unselected and selected buttons
       [icon,18,10,0,0,-1,-1],
       [icon,18,62,0,0,-1,-1]
    ]
    pbDrawImagePositions(self.bitmap,imagepos)
  end

  def update
    if self.selected
      self.src_rect.set(0,self.bitmap.height/2,self.bitmap.width,self.bitmap.height/2)
    else
      self.src_rect.set(0,0,self.bitmap.width,self.bitmap.height/2)
    end
    super
  end
end



#===============================================================================
# - Scene_Pokegear
#-------------------------------------------------------------------------------
# Modified By Harshboy
# Modified by Peter O.
# Also Modified By OblivionMew
# Overhauled by Maruno
#===============================================================================
class Scene_Pokegear
  #-----------------------------------------------------------------------------
  # initialize
  #-----------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #-----------------------------------------------------------------------------
  # main
  #-----------------------------------------------------------------------------
  def main
    commands=[]
# OPTIONS - If you change these, you should also change update_command below.
    @cmdMap=-1
    @cmdPhone=-1
    @cmdJukebox=-1
    commands[@cmdMap=commands.length]=_INTL("Map")
    commands[@cmdPhone=commands.length]=_INTL("Phone") if $PokemonGlobal.phoneNumbers &&
                                                          $PokemonGlobal.phoneNumbers.length>0
    commands[@cmdJukebox=commands.length]=_INTL("Jukebox")

    @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=99999
    @button=AnimatedBitmap.new("Graphics/Pictures/pokegearButton")
    @sprites={}
    @sprites["background"] = IconSprite.new(0,0)
    femback=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearbgf"))
    if $Trainer.gender==1 && femback
      @sprites["background"].setBitmap("Graphics/Pictures/pokegearbgf")
    else
      @sprites["background"].setBitmap("Graphics/Pictures/pokegearbg")
    end
    @sprites["command_window"] = Window_CommandPokemon.new(commands,160)
    @sprites["command_window"].index = @menu_index
    @sprites["command_window"].x = Graphics.width
    @sprites["command_window"].y = 0
    for i in 0...commands.length
      x=118
      y=196 - (commands.length*24) + (i*48)
      @sprites["button#{i}"]=PokegearButton.new(x,y,commands[i],i,@viewport)
      @sprites["button#{i}"].selected=(i==@sprites["command_window"].index)
      @sprites["button#{i}"].update
    end
    @sprites["overlay"]=BitmapSprite.new(
    Graphics.width,Graphics.height,@viewport)
    pbSetSystemFont(@sprites["overlay"].bitmap)
    @dateString=""
    updateDateIfNecessary
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    pbDisposeSpriteHash(@sprites)
  end
  #-----------------------------------------------------------------------------
  # update the date display if necessary
  #-----------------------------------------------------------------------------
  def updateDateIfNecessary
    showSeconds = true # Make it false to won't show the seconds
    newDate = pbGetTimeNow.strftime(showSeconds ? "%I:%M:%S %p" : "%I:%M %p")
    return false if @dateString==newDate
    @dateString=newDate  
    overlay=@sprites["overlay"].bitmap
    overlay.clear 
    baseColor=Color.new(72,72,72)
    shadowColor=Color.new(160,160,160)
    textPositions=[
       [@dateString,Graphics.width/2,-2,2,baseColor,shadowColor]]
    pbDrawTextPositions(overlay,textPositions)
    return true
  end
  #-----------------------------------------------------------------------------
  # update the scene
  #-----------------------------------------------------------------------------
  def update
    updateDateIfNecessary
  def update
    for i in 0...@sprites["command_window"].commands.length
      sprite=@sprites["button#{i}"]
      sprite.selected=(i==@sprites["command_window"].index) ? true : false
    end
    pbUpdateSpriteHash(@sprites)
    #update command window and the info if it's active
    if @sprites["command_window"].active
      update_command
      return
    end
  end
  #-----------------------------------------------------------------------------
  # update the command window
  #-----------------------------------------------------------------------------
  def update_command
    if Input.trigger?(Input::B)
      pbPlayCancelSE()
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      if @cmdMap>=0 && @sprites["command_window"].index==@cmdMap
        pbPlayDecisionSE()
        pbShowMap(-1,false)
      end
      if @cmdPhone>=0 && @sprites["command_window"].index==@cmdPhone
        pbPlayDecisionSE()
        pbFadeOutIn(99999) {
           PokemonPhoneScene.new.start
        }
      end
      if @cmdJukebox>=0 && @sprites["command_window"].index==@cmdJukebox
        pbPlayDecisionSE()
        $scene = Scene_Jukebox.new
      end
    return
    end
  end
end
 
Last edited:

Nickalooose

--------------------
1,309
Posts
16
Years
  • Seen Dec 28, 2023
While Testing I get This error message
View attachment 73650

Here My Code
Spoiler:

That's not the right section... You have 186 lines in that code... Your error is looking at line 189... It's not possible!

Check your code again, but in the right section this time.
 
423
Posts
13
Years
  • Age 37
  • Seen Aug 31, 2023
is there a way to get it to update while on the screen as it only seams to update when i open and close the pokégear

EDIT

ok ignore me i didnt read the instructions correctly
 
Last edited:

TheKenny

The only real Kenny!
41
Posts
12
Years
I'm relatively new to scripting and stuff, so please excuse this kind of nooby question. How do I change the time to the european time format without AM/PM? Thanks in advance! :)
 

FL

Pokémon Island Creator
2,444
Posts
13
Years
  • Seen Apr 22, 2024
I'm relatively new to scripting and stuff, so please excuse this kind of nooby question. How do I change the time to the european time format without AM/PM? Thanks in advance! :)
Change

Code:
"%I:%M:%S %p" : "%I:%M %p"

to

Code:
"%H:%M:%S" : "%H:%M"
 
53
Posts
8
Years
I'm sorry to bother you, apparently nobody has encountered such an issue before: I just implemented the watch in my script but when I view the Pokégear, I get stuck. I can't select a menu or leave or anything.

Any ideas what the problem is?

Edit: I don't know what the problem was, but it works now.
 
Last edited:

Arkadious

Developer of Fragmentum
50
Posts
8
Years
I get a syntax error on line 176 after following the instructions to the letter using stock Essentials 16.2
 
Last edited:

FL

Pokémon Island Creator
2,444
Posts
13
Years
  • Seen Apr 22, 2024
I get a syntax error on line 176 after following the instructions to the letter using stock Essentials 16.2
Here is working. Are you sure that you followed the steps correctly?
 

Arkadious

Developer of Fragmentum
50
Posts
8
Years
Here is working. Are you sure that you followed the steps correctly?

Pretty sure; I was just waiting for a reply. I'll give it another go and comment on how it goes.

Edit (29/12/2016 at 12:20pm): Tried it again and it still doesn't work. Pictures attached.
 

Attachments

  • pt1.PNG
    pt1.PNG
    29.8 KB · Views: 29
  • pt2.PNG
    pt2.PNG
    28.8 KB · Views: 25
  • pt3.PNG
    pt3.PNG
    7.7 KB · Views: 14
Last edited:
7
Posts
5
Years
Hi, I just came across this post and seems quite cool! Just to know, would it be possible to include the time into the pause menu screen instead of the Pokegear?
 
Back
Top