Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: JellalFerd on June 16, 2011, 10:09:22 am

Title: [XP] Hotkey Number Modifier
Post by: JellalFerd on June 16, 2011, 10:09:22 am
Hotkey Number Modifier
Authors: Jellalferd
Version: .7
Type: Blizz-ABS Plugin
Key Term: Blizz-ABS Plugin



Introduction
This script modifies the number of hotkeys you have.


Features




Screenshots
(http://img135.imageshack.us/img135/2428/screenshotfrt.png)


Demo
The script is pretty much plug and play, so I think no demo is required.


Script
Spoiler: ShowHide

module BlizzCFG
 Hotkeys = 3
end

class Hotkeys
 BlizzABS::Cache::Keys = 0...BlizzCFG::Hotkeys
 BlizzABS::Cache::HotkeyRange = 1..BlizzCFG::Hotkeys
 
 
end

class Scene_Hotkeys
 def update_choice
# set x position
   @choice.x = 160 + @index * 32
   # if pressed B
   if Input.trigger?(Input::B)
     # play cancel sound
     $game_system.se_play($data_system.cancel_se)
     # create map scene
     $scene = Scene_Map.new
   # if C is pressed
   elsif Input.trigger?(Input::C)
     # play sound
     $game_system.se_play($data_system.decision_se)
     # not active
     @active = false
     # the one that was active the last time is now active
     @skill_window.active = @last_active
     @item_window.active = (!@last_active)
   # if RIGHT is being pressed
   elsif Input.repeat?(Input::RIGHT)
     # if RIGHT is pressed or index is less than 9
     if Input.trigger?(Input::RIGHT) || @index < BlizzCFG::Hotkeys-1
       # play sound
       $game_system.se_play($data_system.cursor_se)
       # set new index
       @index = (@index + 1) % BlizzCFG::Hotkeys
     end
   # if LEFT is being pressed
   elsif Input.repeat?(Input::LEFT)
     # if LEFT is pressed or index is equal or greater than 1
     if Input.trigger?(Input::LEFT) || @index >= 1
       # play sound
       $game_system.se_play($data_system.cursor_se)
       # set new index
       @index = (@index + BlizzCFG::Hotkeys-1) % BlizzCFG::Hotkeys
     end
   end
 end
end



Instructions
Just modify this line:
Hotkeys = 3



Compatibility



Credits and Thanks


Author's Notes
I got inspired to make this because of this:
Spoiler: ShowHide
(http://img15.imageshack.us/img15/2969/snap645.png)
Title: Re: [XP] Hotkey Number Modifier
Post by: mroedesigns on June 16, 2011, 03:13:09 pm
Very nice script! I enjoy having 10 hotkeys, but I still may use this to give the player the option for less.
Title: Re: [XP] Hotkey Number Modifier
Post by: JellalFerd on June 16, 2011, 09:58:26 pm
Alright, I've been testing it more, and apparently it doesn't work with some specific numbers.
The first one I've encountered is 5.
If you have it set to 5, Hotkeys 1-4 work, but 5 doesn't.
Title: Re: [XP] Hotkey Number Modifier
Post by: G_G on June 16, 2011, 11:08:21 pm
Is it because of this - 1?
BlizzABS::Cache::Keys = 0..BlizzCFG::Hotkeys-1
Title: Re: [XP] Hotkey Number Modifier
Post by: JellalFerd on June 16, 2011, 11:54:54 pm
No.
In the actual Blizz-ABS Script, the line is:
Keys = 0..9

That's ten keys. If the -1 wasn't there, it'd be one higher than the specified value.
Also,if that were the problem, it'd be a flaw with all other numbers, so far, it's only happened on the number 5.
Title: Re: [XP] Hotkey Number Modifier
Post by: ForeverZer0 on June 17, 2011, 08:27:34 pm
Just add an extra dot in the range and you need not do the -1 at the end.

BlizzABS::Cache::Keys = 0...BlizzCFG::Hotkeys
Title: Re: [XP] Hotkey Number Modifier
Post by: JellalFerd on June 18, 2011, 02:40:16 am
...I can't believe I forgot that. ;_;