The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Create & Discover > Game Development > Pokémon Essentials
Reload this Page Help with small adjustment for a vertical battle menu!
Sign Up Rules/FAQ Daily Battle Blogs Mark Forums Read


Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

Reply
 
Thread Tools
  #1    
Old October 19th, 2013 (10:50 AM).
BadSamaritan's Avatar
BadSamaritan BadSamaritan is offline
Gone Fishin'
 
Join Date: May 2009
Location: In a galaxy far away...
Gender: Male
Nature: Timid
Posts: 264
[EDIT: sorry for not putting "question" in the title, I always forget]

Hi guys, I've been stuck on a seemingly simple coding issue for a few hours. I just need the down and up buttons to scroll through the menu at the bottom right.



Code:
  def pbNextIndex(curindex)
    if Input.trigger?(Input::LEFT) && (curindex&1)==1
      return curindex-1
    elsif Input.trigger?(Input::RIGHT) &&  (curindex&1)==0
      return curindex+1
    elsif Input.trigger?(Input::UP) &&  (curindex&2)==2
      return curindex-2
    elsif Input.trigger?(Input::DOWN) &&  (curindex&2)==0
      return curindex+2
    end
    return curindex
  end
I'm not very code savvy, so I tried to make sense of it and tried various number/button combos, but nothing came to fruition. I'm sure it's because the original menu does not scroll all the way through, but alas I can't figure it out.

Any help would be awesome, because the system works 100% otherwise.
Reply With Quote

Relevant Advertising!

  #2    
Old October 19th, 2013 (12:49 PM). Edited October 20th, 2013 by Maruno.
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Posts: 5,133
Now that I look at it, it's a bit odd how the battle commands work. Rather than using the perfectly valid built-in controls, it instead made the new def pbNextIndex to do the exact same thing.

Actually, it's probably a remnant from an older way it used to work, before it used Window_CommandPokemon. I'm not sure how it all makes sense, as it appears that both ways are working at once.

Anyway, try this:
Code:
def pbNextIndex(curindex)
  if Input.trigger?(Input::UP)
    return (curindex+3)%4
  elsif Input.trigger?(Input::DOWN)
    return (curindex+1)%4
  end
  return curindex
end
The only downside to this is that this also applies to the fight menu. If you wanted that to be a straight list too, then problem solved, but if you wanted it to be 2x2, you'd have to do something extra to keep it the way it is.
__________________
Reply With Quote
  #3    
Old October 20th, 2013 (3:35 PM).
BadSamaritan's Avatar
BadSamaritan BadSamaritan is offline
Gone Fishin'
 
Join Date: May 2009
Location: In a galaxy far away...
Gender: Male
Nature: Timid
Posts: 264
Ah that makes a lot of sense. I was wondering why, when I would have completely removed or changed a button input, that somehow the game was still interpreting me pressing them somehow haha.

And yes, I've created a "pbNextIndexnew" already, to avoid confliction.(though making the attack menu vertical isn't a bad idea for my purposes)

Anyways, the code works. It's worth noting for anyone else who wants to use this to make sure to add the "def" at the start, and also the UP and DOWN directions are flipped.

Thanks again for the help
Reply With Quote
  #4    
Old October 20th, 2013 (3:46 PM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Posts: 5,133
Are you sure the up and down parts are the wrong way round? Looks to me like they should be fine.
__________________
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 2:41 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2016 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2016.