• 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.

Simple Dual Screen System

209
Posts
17
Years
  • Ok, I've done everything like in CNG tutorial on page 5.
    Here is my PokemonMenu:
    Spoiler:

    For shure I've imported Button graphic to pictures. When I ran game, I still can't use mouse, its just stuck, and button doesn't appear. But when I press X, The button appears, the standard menu gets opened, and I get this error:
    Spoiler:


    What did I do wrong now?
     

    nmorr

    Takin a brake. -_-
    214
    Posts
    15
    Years
  • sigh...I got that error too. But I frgt, how I fixed it, hold on, I'll ask CNG on his forum.
     
    209
    Posts
    17
    Years
  • Ok, thank you very much for your help. If you find out how to fix it you can post it here or send me PM, its your choice :)
     

    nmorr

    Takin a brake. -_-
    214
    Posts
    15
    Years
  • okay, I will. I think he replied now.

    Here's the new mouse script,

    #===============================================================================
    # * Mouse Input Module by Dervvulfman
    # * Mouse.mouse_in_area? added by Crazyninjaguy
    #===============================================================================

    $mouse=IconSprite.new
    $mouse.setBitmap("Graphics/Pictures/Mouse")
    $mouse.z = 999999999

    # Left-Clicking Control---
    # 0 = single click action
    # 1 = double-click action
    MOUSE_LEFT_ACTION = 0

    # Right-Clicking Control--
    # 0 = Menu / 'B' pressed
    # 1 = Stop Movement
    MOUSE_RIGHT_ACTION = 0

    module Mouse
    @cursor_pos_get = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    @cursor_pos_set = Win32API.new('user32', 'SetCursorPos', 'ii', 'i')
    @cursor_show = Win32API.new('user32', 'ShowCursor', 'L', 'i')
    @window_find = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')
    @window_c_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i')
    @window_scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i')
    @readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
    @key = Win32API.new("user32", "GetAsyncKeyState", 'i', 'i')
    Left_Click = 1
    Right_Click = 2
    Middle_Click = 4
    MOUSE_BUTTONS = { Left_Click => 1,
    Right_Click => 2,
    Middle_Click => 4 }
    MOUSE_REPEAT = MOUSE_BUTTONS.clone
    MOUSE_REPEAT.keys.each { |k| MOUSE_REPEAT[k] = [false, false, 10]}
    @game_window = nil # Set game handle to nil
    @cursor_show.call(0) # Turn off system mouse
    def Mouse.click?(button)
    MOUSE_REPEAT[button][1] >= 1
    end
    def Mouse.dbclick?(button)
    MOUSE_REPEAT[button][1] == 2
    end
    def Mouse.pos(catch_anywhere = true)
    x, y = screen_to_client(screen_x, screen_y)
    width, height = client_size
    if catch_anywhere or (x >= 0 and y >= 0 and x < width and y < height)
    return x, y
    else
    return 0, 0
    end
    end
    def Mouse.pos_set(x, y)
    x = [[x, 0].max, 640].min
    y = [[y, 0].max, 480].min
    x, y = client_to_screen(x, y)
    @cursor_pos_set.call(x, y)
    end
    def Mouse.pos_x
    x, y = pos
    return x
    end
    def Mouse.pos_y
    x, y = pos
    return y
    end
    def Mouse.screen
    pos = [0, 0].pack('ll')
    @cursor_pos_get.call(pos)
    return pos.unpack('ll')
    end
    def Mouse.screen_x
    pos = [0, 0].pack('ll')
    @cursor_pos_get.call(pos)
    return pos.unpack('ll')[0]
    end
    def Mouse.screen_y
    pos = [0, 0].pack('ll')
    @cursor_pos_get.call(pos)
    return pos.unpack('ll')[1]
    end
    def Mouse.client_size
    rect = [0, 0, 0, 0].pack('l4')
    @window_c_rect.call(Mouse.hwnd, rect)
    right, bottom = rect.unpack('l4')[2..3]
    return right, bottom
    end
    def Mouse.hwnd
    if @game_window.nil?
    game_name = "\0" * 256
    @readini.call('Game','Title','',game_name,255,".\\Game.ini")
    game_name.delete!("\0")
    @game_window = @window_find.call('RGSS Player',game_name)
    end
    return @game_window
    end
    def Mouse.screen_to_client(x, y)
    return nil unless x and y
    pos = [x, y].pack('ll')
    if @window_scr2cli.call(hwnd, pos) != 0
    return pos.unpack('ll')
    else
    return nil
    end
    end
    def Mouse.update
    $mouse.x = Mouse.pos_x
    $mouse.y = Mouse.pos_y
    MOUSE_BUTTONS.keys.each do |key|
    temp = MOUSE_REPEAT[key][0]
    key_pres = @key.call(MOUSE_BUTTONS[key]) != 0
    key_trig = temp == key_pres ? 0 : (key_pres ? (MOUSE_REPEAT[key][2].between?(1, 9) ? 2 : 1) : -1)
    count = key_trig > 0 ? 0 : [MOUSE_REPEAT[key][2]+1, 20].min
    MOUSE_REPEAT[key] = [key_pres, key_trig, count]
    end
    end
    def Mouse.visible?(visible=true)
    if visible
    @cursor_show.call(-1)
    else
    @cursor_show.call(0)
    end
    end
    def Mouse.mouse_in_area?(*args)
    return false if Mouse.pos_x.nil?
    if args[0].is_a?(Rect)
    Mouse.pos_x >= args[0].x and
    Mouse.pos_y >= args[0].y and
    Mouse.pos_x <= args[0].x + args[0].width and
    Mouse.pos_y <= args[0].y + args[0].height
    else
    Mouse.pos_x >= args[0] and
    Mouse.pos_y >= args[1] and
    Mouse.pos_x <= args[0] + args[2] and
    Mouse.pos_y <= args[1] + args[3]
    end
    end
    end

    module Input
    class << self
    alias cng_input_update update
    def update
    cng_input_update
    Mouse.update
    end
    end
    end
     
    209
    Posts
    17
    Years
  • Ok, thank you very much, Im starting to get somewhere.
    Now I can move mouse with no problem, but my button appears only when I press X to open old menu (which I still can use with no problem), but when I click on it, nothing happens. Also it disappears when I close standard menu with X.
    Well its still so much better than it was, but I wonder what's wrong now. I used my old PokemonMenu (posted few posts upper) without changing anything.
     

    carmaniac

    Where the pickle surprise at?
    671
    Posts
    15
    Years
  • Ok, thank you very much, Im starting to get somewhere.
    Now I can move mouse with no problem, but my button appears only when I press X to open old menu (which I still can use with no problem), but when I click on it, nothing happens. Also it disappears when I close standard menu with X.
    Well its still so much better than it was, but I wonder what's wrong now. I used my old PokemonMenu (posted few posts upper) without changing anything.
    Well of course the button is going to appear and disappear as the menu is the script calling the graphic.
    Use mine as an example NOT to use for your game.
    Code:
    class PokemonMenu_Scene
    def pbShowCommands(commands)
     ret=-1
     [EMAIL="cmdwindow=@sprites["cmdwindow"]cmdwindow=@sprites["cmdwindow[/EMAIL]"]
     cmdwindow.viewport=Viewport.new(0, 0, 480, 320)
     cmdwindow.index=$PokemonTemp.menuLastChoice
     cmdwindow.resizeToFit(commands)
     cmdwindow.commands=commands
     cmdwindow.x=480-cmdwindow.width
     cmdwindow.y=0
     cmdwindow.visible=true
       loop do
        cmdwindow.update
        Graphics.update
        Input.update
        Mouse.update
        $mouse.x = Mouse.pos_x
        $mouse.y = Mouse.pos_y
        pbUpdateSceneMap
        if Input.trigger?(Input::B)
         ret=-1
         break
       end
        if Input.trigger?(Input::C) || @abortable || Mouse.click?(1)
         ret=cmdwindow.index
         $PokemonTemp.menuLastChoice=ret
         break
        end
       end
     return ret
    end
    def pbShowInfo(text)
      @sprites["infowindow"].resizeToFit(text,Graphics.height)
      @sprites["infowindow"].text=text
      @sprites["infowindow"].visible=true
      @infostate=true
    end
    def pbShowHelp(text)
      @sprites["helpwindow"].resizeToFit(text,Graphics.height)
      @sprites["helpwindow"].text=text
      @sprites["helpwindow"].visible=true
      @helpstate=true
      pbBottomLeft(@sprites["helpwindow"])
    end
    def pbStartScene
     @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
     @viewport.z=99999
     @sprites={}
     @sprites["cmdwindow"]=Window_CommandPokemon.new([])
     @sprites["infowindow"]=Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport)
     @sprites["infowindow"].visible=false
     @sprites["helpwindow"]=Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport)
     @sprites["helpwindow"].visible=false
     @sprites["cmdwindow"].visible=false
     @sprites["button"]=IconSprite.new(20, 340)
     @sprites["button"].setBitmap("Graphics/Pictures/button.png")
     @sprites["button1"]=IconSprite.new(20, 390)
     @sprites["button1"].setBitmap("Graphics/Pictures/button1.png")
     @infostate=false
     @helpstate=false
     pbSEPlay("menu")
     end
    def pbHideMenu
     @sprites["cmdwindow"].visible=false
     @sprites["infowindow"].visible=false
     @sprites["helpwindow"].visible=false
    end
    def pbShowMenu
     @sprites["cmdwindow"].visible=true
     @sprites["infowindow"].visible=@infostate
     @sprites["helpwindow"].visible=@helpstate
    end
    def pbEndScene
     pbDisposeSpriteHash(@sprites)
     @viewport.dispose
    end
    def pbRefresh
    end
    end
    
    class PokemonMenu
    def initialize(scene)
     @scene=scene
    end
    def pbShowMenu
     @scene.pbRefresh
     @scene.pbShowMenu
    end
    def pbStartPokemonMenu
      @scene.pbStartScene
      endscene=true
      commands=[]
      cmdPokedex=-1
      cmdPokemon=-1
      cmdBag=-1
      cmdTrainer=-1
      cmdSave=-1
      cmdOption=-1
      cmdPokegear=-1
      cmdDebug=-1
      cmdQuit=-1
      if !$Trainer
       if $DEBUG
        Kernel.pbMessage(_INTL("The player trainer was not defined, so the menu can't be displayed."))
        Kernel.pbMessage(_INTL("Please see the documentation to learn how to set up the trainer player."))
       end
       return
      end
      commands[cmdPokedex=commands.length]=_INTL("POKéDEX") if $Trainer.pokedex
      commands[cmdPokemon=commands.length]=_INTL("POKéMON") if $Trainer.party.length>0
      commands[cmdBag=commands.length]=_INTL("BAG") if !pbInBugContest?
      commands[cmdPokegear=commands.length]=_INTL("POKéGEAR") if $Trainer.pokegear
      commands[cmdTrainer=commands.length]=$Trainer.name
      if pbInSafari?
       @scene.pbShowInfo(_INTL("STEPS: {1}/600\nBALLS: {2}",pbSafariState.steps,pbSafariState.ballcount))
       commands[cmdQuit=commands.length]=_INTL("QUIT")
      elsif pbInBugContest?
       if pbBugContestState.lastPokemon
         @scene.pbShowInfo(_INTL("CAUGHT: {1}\nLEVEL: {2}\nBALLS: {3}",
              PBSpecies.getName(pbBugContestState.lastPokemon.species),
              pbBugContestState.lastPokemon.level,
              pbBugContestState.ballcount))
       else
         @scene.pbShowInfo(_INTL("CAUGHT: None\nBALLS: {1}",pbBugContestState.ballcount))
       end
       commands[cmdQuit=commands.length]=_INTL("QUIT")
      else
       commands[cmdSave=commands.length]=_INTL("SAVE") if !$game_system || !$game_system.save_disabled
      end
      commands[cmdOption=commands.length]=_INTL("OPTION")
      commands[cmdDebug=commands.length]=_INTL("DEBUG") if $DEBUG
      commands[commands.length]=_INTL("EXIT")
      loop do
      if Mouse.mouse_in_area?(20, 340, 71, 46)
        if Mouse.click?(1)
          pbFadeOutIn(99999) {
          scene=PokemonPokedexScene.new
          screen=PokemonPokedex.new(scene)
          screen.pbStartScreen
          @scene.pbRefresh
          }
        end
      end  
      if Mouse.mouse_in_area?(20, 390, 71, 46)
        if Mouse.click?(1)
         sscene=PokemonScreen_Scene.new
         sscreen=PokemonScreen.new(sscene,$Trainer.party)
         hiddenmove=nil
         pbFadeOutIn(99999) { 
          hiddenmove=sscreen.pbPokemonScreen
          if hiddenmove
           @scene.pbEndScene
          else
           @scene.pbRefresh
          end
         }
        end
      end  
      [EMAIL="[email protected](commands"][email protected](commands[/EMAIL])
    #   if cmdPokedex>=0 && command==cmdPokedex
    #    pbFadeOutIn(99999) {
    #    scene=PokemonPokedexScene.new
    #    screen=PokemonPokedex.new(scene)
    #    screen.pbStartScreen
    #    @scene.pbRefresh
    #    }
       if cmdPokegear>=0 && command==cmdPokegear
        pbLoadRpgxpScene(Scene_Pokegear.new)
       elsif cmdPokemon>=0 && command==cmdPokemon
         sscene=PokemonScreen_Scene.new
         sscreen=PokemonScreen.new(sscene,$Trainer.party)
         hiddenmove=nil
         pbFadeOutIn(99999) { 
          hiddenmove=sscreen.pbPokemonScreen
          if hiddenmove
           @scene.pbEndScene
          else
           @scene.pbRefresh
          end
         }
        if hiddenmove
         Kernel.pbUseHiddenMove(hiddenmove[0],hiddenmove[1])
         return
        end
       elsif cmdBag>=0 && command==cmdBag
        item=0
        scene=PokemonBag_Scene.new
        screen=PokemonBagScreen.new(scene,$PokemonBag)
        pbFadeOutIn(99999) { 
          item=screen.pbStartScreen 
          if item>0
           @scene.pbEndScene
          else
           @scene.pbRefresh
          end
        }
        if item>0
         Kernel.pbUseKeyItemInField(item)
         return
        end
       elsif cmdTrainer>=0 && command==cmdTrainer
        PBDebug.logonerr {
         scene=PokemonTrainerCardScene.new
         screen=PokemonTrainerCard.new(scene)
         pbFadeOutIn(99999) { 
          screen.pbStartScreen
          @scene.pbRefresh
         }
        }
       elsif cmdQuit>=0 && command==cmdQuit
         @scene.pbHideMenu
         if pbInSafari?
           if Kernel.pbConfirmMessage(_INTL("Would you like to leave the Safari Game right now?"))
            @scene.pbEndScene
            pbSafariState.decision=1
            pbSafariState.pbGoToStart
            return
           else
            pbShowMenu
           end
         else
           if Kernel.pbConfirmMessage(_INTL("Would you like to end the Contest now?"))
            @scene.pbEndScene
            pbBugContestState.pbStartJudging
            return
           else
            pbShowMenu
           end
         end
       elsif cmdSave>=0 && command==cmdSave
         @scene.pbHideMenu
         scene=PokemonSaveScene.new
         screen=PokemonSave.new(scene)
         if screen.pbSaveScreen
          @scene.pbEndScene
          endscene=false
          break
         else
          pbShowMenu
         end
       elsif cmdDebug>=0 && command==cmdDebug
        pbFadeOutIn(99999) { 
         pbDebugMenu
         @scene.pbRefresh
        }
       elsif cmdOption>=0 && command==cmdOption
         scene=PokemonOptionScene.new
         screen=PokemonOption.new(scene)
         pbFadeOutIn(99999) {
          screen.pbStartScreen
          pbUpdateSceneMap
          @scene.pbRefresh
         }
       else
        break
       end
      end
      @scene.pbEndScene if endscene
    end
    end
     
    209
    Posts
    17
    Years
  • Ok, thank you for posting your example. First, before modifying my menu i wanted to try will even your in original form work for me. But when i used your (i placed all graphics with your width and height in pictures) I was stil unable to use buttons - when i was clicking on them nothing happened. Also when i choose pokedex in standard menu, it just close the menu.
    I guess its no point for me trying to use your script as example if it doesn't work for me even in original form.
    I wonder what am i doing wrong. If this script works for you and not for me, it must be fault of my game. But i have only standard essentials scripts and Dual screen.
    Is it possible, that this script may just not work on Windows 7 64-bit and will be fine on other PCs?
     

    carmaniac

    Where the pickle surprise at?
    671
    Posts
    15
    Years
  • Ok, thank you for posting your example. First, before modifying my menu i wanted to try will even your in original form work for me. But when i used your (i placed all graphics with your width and height in pictures) I was stil unable to use buttons - when i was clicking on them nothing happened. Also when i choose pokedex in standard menu, it just close the menu.
    I guess its no point for me trying to use your script as example if it doesn't work for me even in original form.
    I wonder what am i doing wrong. If this script works for you and not for me, it must be fault of my game. But i have only standard essentials scripts and Dual screen.
    Is it possible, that this script may just not work on Windows 7 64-bit and will be fine on other PCs?

    Hmm, it can be that although I couldn't see the problem being caused by Windows 7. It's slightly odd aswell how most of the mouse features work when ever they feel like to. I'll have a look into it for you.
     
    209
    Posts
    17
    Years
  • Hmm, it can be that although I couldn't see the problem being caused by Windows 7. It's slightly odd aswell how most of the mouse features work when ever they feel like to. I'll have a look into it for you.
    Thank you. My Essentials generally works different than it should. For example it saves games in C\Users\Mackoo\Saved Games instead of putting it in game folder (first it wasn't saving at all, and when I downloaded Curts region starter kit and used it, and then it finally started) so I got same save file ifor all essentials projects I download. But games made in Essentials, like Pokemon Raptor work normal and save game in its folder...
     
    23
    Posts
    14
    Years
    • Seen Jul 16, 2010
    Okay, I've fixed my error by some random miracle, but when I open up the menu now, I get my pictures for a menu and my old menu that you scroll through. Also, I cant get the mouse to appear still. Can someone help me out?
     

    DarkShadow21

    Master of dark fire!!
    57
    Posts
    14
    Years
  • idk about you the rest of you guys but the only thing i need help with is when i try to resize the screen it only resizes the top screen.. i don't want to reset the size of the top screen because then i have to go to every single line of code that positions something and change it and that would take forever. i just want to know how i could add the SpriteResizer with the duel screen script
     

    viraniz

    Pokemon Dragon Creator
    11
    Posts
    13
    Years
    • Seen Nov 3, 2015
    i cant get this to function with my menu it opens my graphics for the meny but works the old simple one now what
     
    22
    Posts
    15
    Years
    • Seen Aug 7, 2016
    Hello!

    I'm using your script this in my game. I changed the display to 256 x 404, and each screen, the top and bottom, has a ratio of 256 x 192.

    But I have a problem. See the image below:
    window.png


    How do I decrease the font size of the game and the graphics?
    Also like to know if there is like putting a mouse and a script Touch Screen. Could you tell me where I find such scripts?

    If you can send me something, a pack, for example, with some scripts dual screen, including the script itself and the mouse and touch screen, I thank you very much! I'm a sucker for scripts, I can not learn to do these kinds of codes>. <"

    If you can help me do some things to the screen dual screen of my game, I really appreciate it!

    Send me the study by personal message or MSN: [email protected]

    Thank you in advance.
    Goodbye! o /
     

    nmorr

    Takin a brake. -_-
    214
    Posts
    15
    Years
  • Nice 2 c u again Arthur, but I'm afraid CNG isn't on this forum anymore. go to his on planetdev.net and ask him the the thead there under simple dual screen and stuff. I'm still waiting for his reply even though it's been...2 weeks! lol
     

    warpras

    Chief of Pokémon Time Version
    20
    Posts
    14
    Years
  • Try PokemonScriptProject DS. Ok, this starter kit is in french but with you can transalte it in english. A lot of scripts have been did.
    Enjoy :)

    Sorry for my bad english
     

    carmaniac

    Where the pickle surprise at?
    671
    Posts
    15
    Years
  • Try PokemonScriptProject DS. Ok, this starter kit is in french but with you can transalte it in english. A lot of scripts have been did.
    Enjoy :)

    Sorry for my bad english

    Yeah but there's one problem with saying that, the script in this thread is for a great starter kit that has advanced a lot more than what Pokemon Script Project DS has. :P
     

    Rafael-animal

    Pokémon DS Kit
    20
    Posts
    14
    Years
    • Seen Mar 27, 2015
    I have a doubt, modify the scripts in order that the image appears on the screen of below, but encambio only it works out black, since I can put the screen of below in trasparente?
     
    Back
    Top