Messaggio modificato da TNTbomb, 12 ottobre 2007 - 09:03
Cercasi script per giocare con il mouse
Iniziato da
TNTbomb
, ott 12 2007 08:54
35 risposte a questa discussione
#1
Inviato 12 ottobre 2007 - 08:54
se ricordo bene doveva esserci nel vecchio forum ma se ricordo male non c'era LOL .... cmq qualcuno di voi ha per caso lo script che permetta di giocare con il mouse al posto delle frecciette della tastiera???
#2 Ospite_dex91_*
Inviato 12 ottobre 2007 - 11:51
Lol...ti consiglio di cambiare il titolo e scrivere : Cerco script per muoversi con mouse...il titolo attuale non ha senso ...secondo me se non lo cambi la gente non capisce tanto e non visita il topic e di conseguenza non ti risponde...comunque io non lo ho mi disp
Messaggio modificato da dex91, 12 ottobre 2007 - 11:51
#6
Inviato 12 ottobre 2007 - 03:43
CITAZIONE (dex91 @ Oct 12 2007, 01:51 PM) <{POST_SNAPBACK}>
Lol...ti consiglio di cambiare il titolo e scrivere : Cerco script per muoversi con mouse...il titolo attuale non ha senso ...secondo me se non lo cambi la gente non capisce tanto e non visita il topic e di conseguenza non ti risponde...comunque io non lo ho mi disp
Pensavo che anke qu
#9
Inviato 12 ottobre 2007 - 09:01
raga quello script era bellissimo porco ***, mi faceva proprio ar**p*r* l'idea di giocare con il mouse ma farlo ad eventi non ci penso proprio... sebbene li amo e sono molto bravo con gli eventi... non perderei sicuramente tempo a fare qualcosa che
#10
Inviato 12 ottobre 2007 - 09:15
com'
#11
Inviato 13 ottobre 2007 - 07:51
CITAZIONE (TNTbomb @ Oct 12 2007, 11:01 PM) <{POST_SNAPBACK}>
raga quello script era bellissimo porco ***, mi faceva proprio ar**p*r* l'idea di giocare con il mouse ma farlo ad eventi non ci penso proprio... sebbene li amo e sono molto bravo con gli eventi... non perderei sicuramente tempo a fare qualcosa che
#15
Inviato 13 ottobre 2007 - 11:56
ok scusate ******* non bestemmier
#19
Inviato 13 ottobre 2007 - 12:41
Basta mo me so rotto ora metto lo script e chiudiamo questo c***o di topic:
Descrizione
Autore
Allegati
Istruzioni per l'uso
Movimento via Mouse
Descrizione
Questo script permette di usare il mouse per muoversi. l'ho trovato molto interessante, e chiedevo se qualche scripter riuscisse a farmi una modifica: vorrei che alcuni eventi si attivassero semplicemente cliccandoci sopra, senza doverli raggiungere con l'eroe.
Autore
Guedez
Allegati
..
Istruzioni per l'uso
Create una nuova pagina sopra Main e incollate questo:
CODICE
#==================================================================
# GMUS Guedez Mouse Use System
# Version: 1.0
# Released: 26/5/2006 Last Update: 1/6/2006
# Thx to: Cadafalso, Near Fantastica, and some guys from asylum!
#==================================================================
class Mouse_PositionCheck
def initialize
end
def main
get_pos
end
def get_window_index(window)
window.get_rect_positions
return -1 if window.index == -1
return -2 if window.index == -2
for i in 0...window.get_rect.size
if window.get_rect[i][0] < $bg.x and
window.get_rect[i][1] < $bg.y and
window.get_rect[i][2] > $bg.x and
window.get_rect[i][3] > $bg.y
return i
end
end
return -999999
end
def set_pos(x,y)
$setCursorPos.Call(x,y)
end
#==============================Thx to: Cadafalso===================
def get_pos
lpPoint = " " * 8 # store two LONGs
$getCursorPos.Call(lpPoint)
$bg.x, $bg.y = lpPoint.unpack("LL") # get the actual values
end
#==================================================================
end
class Window_Selectable < Window_Base
def get_rect_positions
index = self.index
@rect_position = [] if @rect_position == nil
if @rect_position == []
for i in 0...(self.row_max * @column_max)
self.index = i
update_cursor_rect
p = self.cursor_rect.to_s
p.gsub!("($1,$2,$3,$4):rect","");p.gsub!("(", ""); p.gsub!(")", "")
p = p.split(/,\s*/)
@rect_position[i] = [p[0].to_i + self.x + 16,
p[1].to_i - self.oy + self.y + 16,
p[0].to_i + p[2].to_i + self.x + 16,
p[1].to_i + p[3].to_i - self.oy + self.y + 16]
end
self.index = index
end
end
def refresh_rect_positions
@rect_position = []
get_rect_positions
end
def get_rect
return @rect_position
end
alias guedez_update update
def update
get_rect_positions
if self.active == true
old_index = self.index
new_index = $mouse.get_window_index(self)
$game_system.se_play($data_system.cursor_se) if
old_index != new_index and not new_index == -999999
@index = new_index if old_index != -1
self.cursor_rect.empty if new_index == -999999
self.index = new_index
end
guedez_update
end
end
# Actualy my script only need the mouse stuff, but i dont think
# the rest will bring any trouble :D, so i let the full script
#==============================================================================
# ** Keyboard Input Module
#==============================================================================
# Near Fantastica
# Version 5
# 29.11.05
#==============================================================================
# The Keyboard Input Module is designed to function as the default Input module
# dose. It is better then other methods keyboard input because as a key is
# tested it is not removed form the list. so you can test the same key multiple
# times the same loop.
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
#SDK.log("Keyboard Input", "Near Fantastica", 5, "29.11.05")
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
#if SDK.state("Keyboard Input") == true
module Keyboard
#--------------------------------------------------------------------------
@keys = []
@pressed = []
Mouse_Left = 1
Mouse_Right = 2
Back= 8
Tab = 9
Enter = 13
Shift = 16
Ctrl = 17
Alt = 18
Esc = 27
Space = 32
Numberkeys = {}
Numberkeys[0] = 48
Numberkeys[1] = 49
Numberkeys[2] = 50
Numberkeys[3] = 51
Numberkeys[4] = 52
Numberkeys[5] = 53
Numberkeys[6] = 54
Numberkeys[7] = 55
Numberkeys[8] = 56
Numberkeys[9] = 57
Numberpad = {}
Numberpad[0] = 45
Numberpad[1] = 35
Numberpad[2] = 40
Numberpad[3] = 34
Numberpad[4] = 37
Numberpad[5] = 12
Numberpad[6] = 39
Numberpad[7] = 36
Numberpad[8] = 38
Numberpad[9] = 33
Letters = {}
Letters["A"] = 65
Letters["B"] = 66
Letters["C"] = 67
Letters["D"] = 68
Letters["E"] = 69
Letters["F"] = 70
Letters["G"] = 71
Letters["H"] = 72
Letters["I"] = 73
Letters["J"] = 74
Letters["K"] = 75
Letters["L"] = 76
Letters["M"] = 77
Letters["N"] = 78
Letters["O"] = 79
Letters["P"] = 80
Letters["Q"] = 81
Letters["R"] = 82
Letters["S"] = 83
Letters["T"] = 84
Letters["U"] = 85
Letters["V"] = 86
Letters["W"] = 87
Letters["X"] = 88
Letters["Y"] = 89
Letters["Z"] = 90
Fkeys = {}
Fkeys[1] = 112
Fkeys[2] = 113
Fkeys[3] = 114
Fkeys[4] = 115
Fkeys[5] = 116
Fkeys[6] = 117
Fkeys[7] = 118
Fkeys[8] = 119
Fkeys[9] = 120
Fkeys[10] = 121
Fkeys[11] = 122
Fkeys[12] = 123
Collon = 186
Equal = 187
Comma = 188
Underscore = 189
Dot = 190
Backslash = 191
Lb = 219
Rb = 221
Quote = 222
State = Win32API.new("user32","GetKeyState",['i'],'i')
Key = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
#--------------------------------------------------------------------------
def Keyboard.getstate(key)
return true unless State.call(key).between?(0, 1)
return false
end
#--------------------------------------------------------------------------
def Keyboard.testkey(key)
Key.call(key) & 0x01 == 1
end
#--------------------------------------------------------------------------
def Keyboard.update
@keys = []
@keys.push(Keyboard::Mouse_Left) if Keyboard.testkey(Keyboard::Mouse_Left)
@keys.push(Keyboard::Mouse_Right) if Keyboard.testkey(Keyboard::Mouse_Right)
@keys.push(Keyboard::Back) if Keyboard.testkey(Keyboard::Back)
@keys.push(Keyboard::Tab) if Keyboard.testkey(Keyboard::Tab)
@keys.push(Keyboard::Enter) if Keyboard.testkey(Keyboard::Enter)
@keys.push(Keyboard::Shift) if Keyboard.testkey(Keyboard::Shift)
@keys.push(Keyboard::Ctrl) if Keyboard.testkey(Keyboard::Ctrl)
@keys.push(Keyboard::Alt) if Keyboard.testkey(Keyboard::Alt)
@keys.push(Keyboard::Esc) if Keyboard.testkey(Keyboard::Esc)
@keys.push(Keyboard::Space) if Keyboard.testkey(Keyboard::Space)
for key in Keyboard::Numberkeys.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Numberpad.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Letters.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Fkeys.values
@keys.push(key) if Keyboard.testkey(key)
end
@keys.push(Keyboard::Collon) if Keyboard.testkey(Keyboard::Collon)
@keys.push(Keyboard::Equal) if Keyboard.testkey(Keyboard::Equal)
@keys.push(Keyboard::Comma) if Keyboard.testkey(Keyboard::Comma)
@keys.push(Keyboard::Underscore) if Keyboard.testkey(Keyboard::Underscore)
@keys.push(Keyboard::Dot) if Keyboard.testkey(Keyboard::Dot)
@keys.push(Keyboard::Backslash) if Keyboard.testkey(Keyboard::Backslash)
@keys.push(Keyboard::Lb) if Keyboard.testkey(Keyboard::Lb)
@keys.push(Keyboard::Rb) if Keyboard.testkey(Keyboard::Rb)
@keys.push(Keyboard::Quote) if Keyboard.testkey(Keyboard::Quote)
@pressed = []
@pressed.push(Keyboard::Mouse_Left) if Keyboard.getstate(Keyboard::Mouse_Left)
@pressed.push(Keyboard::Mouse_Right) if Keyboard.getstate(Keyboard::Mouse_Right)
@pressed.push(Keyboard::Back) if Keyboard.getstate(Keyboard::Back)
@pressed.push(Keyboard::Tab) if Keyboard.getstate(Keyboard::Tab)
@pressed.push(Keyboard::Enter) if Keyboard.getstate(Keyboard::Enter)
@pressed.push(Keyboard::Shift) if Keyboard.getstate(Keyboard::Shift)
@pressed.push(Keyboard::Ctrl) if Keyboard.getstate(Keyboard::Ctrl)
@pressed.push(Keyboard::Alt) if Keyboard.getstate(Keyboard::Alt)
@pressed.push(Keyboard::Esc) if Keyboard.getstate(Keyboard::Esc)
@pressed.push(Keyboard::Space) if Keyboard.getstate(Keyboard::Space)
for key in Keyboard::Numberkeys.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Numberpad.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Letters.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Fkeys.values
@pressed.push(key) if Keyboard.getstate(key)
end
@pressed.push(Keyboard::Collon) if Keyboard.getstate(Keyboard::Collon)
@pressed.push(Keyboard::Equal) if Keyboard.getstate(Keyboard::Equal)
@pressed.push(Keyboard::Comma) if Keyboard.getstate(Keyboard::Comma)
@pressed.push(Keyboard::Underscore) if Keyboard.getstate(Keyboard::Underscore)
@pressed.push(Keyboard::Dot) if Keyboard.getstate(Keyboard::Dot)
@pressed.push(Keyboard::Backslash) if Keyboard.getstate(Keyboard::Backslash)
@pressed.push(Keyboard::Lb) if Keyboard.getstate(Keyboard::Lb)
@pressed.push(Keyboard::Rb) if Keyboard.getstate(Keyboard::Rb)
@pressed.push(Keyboard::Quote) if Keyboard.getstate(Keyboard::Quote)
end
#--------------------------------------------------------------------------
def Keyboard.trigger?(key)
return true if @keys.include?(key)
return false
end
#--------------------------------------------------------------------------
def Keyboard.pressed?(key)
return true if @pressed.include?(key)
return false
end
#end
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end
#=========================Game_Fixes=============================
$showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
$showm.call(18,0,0,0)
$showm.call(13,0,0,0)
$showm.call(13,0,2,0)
$showm.call(18,0,2,0)
$mouse = Mouse_PositionCheck.new
$getCursorPos = Win32API.new("user32", "GetCursorPos", ['P'], 'V')
$setCursorPos = Win32API.new("user32", "SetCursorPos", ['I','I'], 'V')
$bg = Sprite.new
$bg.bitmap = RPG::Cache.icon('001-Weapon01')
$bg.z = 999999
$bg.y = 0
$bg.x = 0
module Input
if @self_update == nil
@self_update = method('update')
@self_press = method('press?')
@self_rep = method('repeat?')
end
def self.update
@self_update.call
$mouse.main
Keyboard.update
end
def self.trigger?(key_code)
if @self_press.call(key_code)
return true
end
if key_code == C
return Keyboard.trigger?(Keyboard::Mouse_Left)
elsif key_code == B
return Keyboard.trigger?(Keyboard::Mouse_Right)
else
return @self_press.call(key_code)
end
end
def self.repeat?(key_code)
if @self_rep.call(key_code)
return true
end
if key_code == C
return Keyboard.pressed?(Keyboard::Mouse_Left)
elsif key_code == B
return Keyboard.pressed?(Keyboard::Mouse_Right)
else
return @self_rep.call(key_code)
end
end
end
class Arrow_Enemy < Arrow_Base
def update
super
$game_troop.enemies.size.times do
break if self.enemy.exist?
@index += 1
@index %= $game_troop.enemies.size
end
#size = 0
#for i in 0...$game_troop.enemies.size
# size += 1 if $game_troop.enemies[i].hp > 0
#end
size = $game_troop.enemies.size if size == nil
@index = ((size / 640.0) * $bg.x.to_f).to_i
if self.enemy != nil
self.x = self.enemy.screen_x
self.y = self.enemy.screen_y
end
end
end
class Arrow_Actor < Arrow_Base
def update
super
@index = 0 if $bg.x > 0 and $bg.x <= 160 and 0 <= ($game_party.actors.size - 1)
@index = 1 if $bg.x > 160 and $bg.x <= 320 and 1 <= ($game_party.actors.size - 1)
@index = 2 if $bg.x > 320 and $bg.x <= 480 and 2 <= ($game_party.actors.size - 1)
@index = 3 if $bg.x > 480 and $bg.x <= 640 and 3 <= ($game_party.actors.size - 1)
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y
end
end
end
class Window_Target < Window_Selectable
alias gupdate update
def update
@defaultx = 0 if @defaultx == nil
if @defaultx != self.x
@defaultx = self.x
self.refresh_rect_positions
return
else
gupdate
end
end
def update_cursor_rect
if @index == -1
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
class Scene_Battle
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
@actor_command_window.x = @actor_index * 160
@actor_command_window.refresh_rect_positions
@actor_command_window.index = 0
end
end
class Scene_Equip
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
@actor = $game_party.actors[@actor_index]
end
alias gmain main
def main
@dummy = Window_EquipItem.new(@actor, 99)
gmain
@dummy.dispose
end
alias gupdate_right update_right
def update_right
if @right_window.index == -999999
if Input.trigger?(Input::C)
$game_system.se_play($data_system.buzzer_se)
end
else
gupdate_right
end
end
def refresh
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
@dummy.visible = (@right_window.index == -999999)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
when -999999
return
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil)
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
end
class Scene_Skill
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index == -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index <= -3
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
class Scene_File
def update
@help_window.update
for i in @savefile_windows
i.update
end
if Input.trigger?(Input::C)
if @file_index == -1
$game_system.se_play($data_system.buzzer_se)
else
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
end
if Input.trigger?(Input::B)
on_cancel
return
end
if $bg.y > 64 and $bg.y < 168
if @savefile_windows[0].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = true
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
@file_index = 0
elsif $bg.y > 168 and $bg.y < 272
if @savefile_windows[1].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = true
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
@file_index = 1
elsif $bg.y > 272 and $bg.y < 376
if @savefile_windows[2].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = true
@savefile_windows[3].selected = false
@file_index = 2
elsif $bg.y > 376 and $bg.y < 480
if @savefile_windows[3].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = true
@file_index = 3
else
@file_index = -1
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
end
end
end
class Scene_Menu
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
unless @status_window.index < 0
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
end
class Game_Player
def update
last_moving = moving?
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or
@cant_move
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
last_real_x = @real_x
last_real_y = @real_y
super
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
end
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
unless moving?
if last_moving
result = check_event_trigger_here([1,2])
if result == false
unless $DEBUG and Input.press?(Input::CTRL)
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_curor_field
if (@field_x == self.x + 1 and @field_y == self.y and
self.direction == 6) or (@field_x == self.x - 1 and
@field_y == self.y and self.direction == 4) or
(@field_x == self.x and @field_y == self.y + 1 and
self.direction == 2) or (@field_x == self.x and
@field_y == self.y - 1 and self.direction == 8)
check_event_trigger_there([0,1,2])
end
end
if Input.repeat?(Input::C)
check_curor_field
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or
@cant_move and not (@field_x == self.x and @field_y == self.y)
move_by_mouse
end
check_event_trigger_here([0])
end
end
end
def check_curor_field
dummyx = $game_map.display_x > 0 ? $bg.x + 16 : $bg.x
@field_x = dummyx / 32 + $game_map.display_x / 128
@field_y = $bg.y / 32 + $game_map.display_y / 128
end
def move_by_mouse
dy = @field_x - self.x
dx = self.y - @field_y
if dx > 0 and dy > 0 #quarter 1
if dx > dy
if passable?(self.x, self.y, 8)
move_up
else
move_right
end
return
elsif dx < dy
if passable?(self.x, self.y, 6)
move_right
else
move_up
end
return
elsif dx == dy
if passable?(self.x, self.y, 8)
move_up
else
move_right
end
return
end
elsif dx > 0 and dy < 0 #quarter 2
if dx > -dy
if passable?(self.x, self.y, 8)
move_up
else
move_left
end
return
elsif dx < -dy
if passable?(self.x, self.y, 4)
move_left
else
move_up
end
return
elsif dx == -dy
if passable?(self.x, self.y, 8)
move_up
else
move_left
end
return
end
elsif dx < 0 and dy < 0 #quarter 2
if -dx > -dy
if passable?(self.x, self.y, 2)
move_down
else
move_left
end
return
elsif -dx < -dy
if passable?(self.x, self.y, 4)
move_left
else
move_down
end
return
elsif -dx == -dy
if passable?(self.x, self.y, 2)
move_down
else
move_left
end
return
end
elsif dx < 0 and dy > 0 #quarter 4
if -dx > dy
if passable?(self.x, self.y, 2)
move_down
else
move_right
end
return
elsif -dx < dy
if passable?(self.x, self.y, 6)
move_right
else
move_down
end
return
elsif -dx == dy
if passable?(self.x, self.y, 2)
move_down
else
move_right
end
return
end
elsif dx == 0 and dy < 0
move_left
elsif dx == 0 and dy > 0
move_right
elsif dx < 0 and dy == 0
move_down
elsif dx > 0 and dy == 0
move_up
end
end
end
# GMUS Guedez Mouse Use System
# Version: 1.0
# Released: 26/5/2006 Last Update: 1/6/2006
# Thx to: Cadafalso, Near Fantastica, and some guys from asylum!
#==================================================================
class Mouse_PositionCheck
def initialize
end
def main
get_pos
end
def get_window_index(window)
window.get_rect_positions
return -1 if window.index == -1
return -2 if window.index == -2
for i in 0...window.get_rect.size
if window.get_rect[i][0] < $bg.x and
window.get_rect[i][1] < $bg.y and
window.get_rect[i][2] > $bg.x and
window.get_rect[i][3] > $bg.y
return i
end
end
return -999999
end
def set_pos(x,y)
$setCursorPos.Call(x,y)
end
#==============================Thx to: Cadafalso===================
def get_pos
lpPoint = " " * 8 # store two LONGs
$getCursorPos.Call(lpPoint)
$bg.x, $bg.y = lpPoint.unpack("LL") # get the actual values
end
#==================================================================
end
class Window_Selectable < Window_Base
def get_rect_positions
index = self.index
@rect_position = [] if @rect_position == nil
if @rect_position == []
for i in 0...(self.row_max * @column_max)
self.index = i
update_cursor_rect
p = self.cursor_rect.to_s
p.gsub!("($1,$2,$3,$4):rect","");p.gsub!("(", ""); p.gsub!(")", "")
p = p.split(/,\s*/)
@rect_position[i] = [p[0].to_i + self.x + 16,
p[1].to_i - self.oy + self.y + 16,
p[0].to_i + p[2].to_i + self.x + 16,
p[1].to_i + p[3].to_i - self.oy + self.y + 16]
end
self.index = index
end
end
def refresh_rect_positions
@rect_position = []
get_rect_positions
end
def get_rect
return @rect_position
end
alias guedez_update update
def update
get_rect_positions
if self.active == true
old_index = self.index
new_index = $mouse.get_window_index(self)
$game_system.se_play($data_system.cursor_se) if
old_index != new_index and not new_index == -999999
@index = new_index if old_index != -1
self.cursor_rect.empty if new_index == -999999
self.index = new_index
end
guedez_update
end
end
# Actualy my script only need the mouse stuff, but i dont think
# the rest will bring any trouble :D, so i let the full script
#==============================================================================
# ** Keyboard Input Module
#==============================================================================
# Near Fantastica
# Version 5
# 29.11.05
#==============================================================================
# The Keyboard Input Module is designed to function as the default Input module
# dose. It is better then other methods keyboard input because as a key is
# tested it is not removed form the list. so you can test the same key multiple
# times the same loop.
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
#SDK.log("Keyboard Input", "Near Fantastica", 5, "29.11.05")
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
#if SDK.state("Keyboard Input") == true
module Keyboard
#--------------------------------------------------------------------------
@keys = []
@pressed = []
Mouse_Left = 1
Mouse_Right = 2
Back= 8
Tab = 9
Enter = 13
Shift = 16
Ctrl = 17
Alt = 18
Esc = 27
Space = 32
Numberkeys = {}
Numberkeys[0] = 48
Numberkeys[1] = 49
Numberkeys[2] = 50
Numberkeys[3] = 51
Numberkeys[4] = 52
Numberkeys[5] = 53
Numberkeys[6] = 54
Numberkeys[7] = 55
Numberkeys[8] = 56
Numberkeys[9] = 57
Numberpad = {}
Numberpad[0] = 45
Numberpad[1] = 35
Numberpad[2] = 40
Numberpad[3] = 34
Numberpad[4] = 37
Numberpad[5] = 12
Numberpad[6] = 39
Numberpad[7] = 36
Numberpad[8] = 38
Numberpad[9] = 33
Letters = {}
Letters["A"] = 65
Letters["B"] = 66
Letters["C"] = 67
Letters["D"] = 68
Letters["E"] = 69
Letters["F"] = 70
Letters["G"] = 71
Letters["H"] = 72
Letters["I"] = 73
Letters["J"] = 74
Letters["K"] = 75
Letters["L"] = 76
Letters["M"] = 77
Letters["N"] = 78
Letters["O"] = 79
Letters["P"] = 80
Letters["Q"] = 81
Letters["R"] = 82
Letters["S"] = 83
Letters["T"] = 84
Letters["U"] = 85
Letters["V"] = 86
Letters["W"] = 87
Letters["X"] = 88
Letters["Y"] = 89
Letters["Z"] = 90
Fkeys = {}
Fkeys[1] = 112
Fkeys[2] = 113
Fkeys[3] = 114
Fkeys[4] = 115
Fkeys[5] = 116
Fkeys[6] = 117
Fkeys[7] = 118
Fkeys[8] = 119
Fkeys[9] = 120
Fkeys[10] = 121
Fkeys[11] = 122
Fkeys[12] = 123
Collon = 186
Equal = 187
Comma = 188
Underscore = 189
Dot = 190
Backslash = 191
Lb = 219
Rb = 221
Quote = 222
State = Win32API.new("user32","GetKeyState",['i'],'i')
Key = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
#--------------------------------------------------------------------------
def Keyboard.getstate(key)
return true unless State.call(key).between?(0, 1)
return false
end
#--------------------------------------------------------------------------
def Keyboard.testkey(key)
Key.call(key) & 0x01 == 1
end
#--------------------------------------------------------------------------
def Keyboard.update
@keys = []
@keys.push(Keyboard::Mouse_Left) if Keyboard.testkey(Keyboard::Mouse_Left)
@keys.push(Keyboard::Mouse_Right) if Keyboard.testkey(Keyboard::Mouse_Right)
@keys.push(Keyboard::Back) if Keyboard.testkey(Keyboard::Back)
@keys.push(Keyboard::Tab) if Keyboard.testkey(Keyboard::Tab)
@keys.push(Keyboard::Enter) if Keyboard.testkey(Keyboard::Enter)
@keys.push(Keyboard::Shift) if Keyboard.testkey(Keyboard::Shift)
@keys.push(Keyboard::Ctrl) if Keyboard.testkey(Keyboard::Ctrl)
@keys.push(Keyboard::Alt) if Keyboard.testkey(Keyboard::Alt)
@keys.push(Keyboard::Esc) if Keyboard.testkey(Keyboard::Esc)
@keys.push(Keyboard::Space) if Keyboard.testkey(Keyboard::Space)
for key in Keyboard::Numberkeys.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Numberpad.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Letters.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Fkeys.values
@keys.push(key) if Keyboard.testkey(key)
end
@keys.push(Keyboard::Collon) if Keyboard.testkey(Keyboard::Collon)
@keys.push(Keyboard::Equal) if Keyboard.testkey(Keyboard::Equal)
@keys.push(Keyboard::Comma) if Keyboard.testkey(Keyboard::Comma)
@keys.push(Keyboard::Underscore) if Keyboard.testkey(Keyboard::Underscore)
@keys.push(Keyboard::Dot) if Keyboard.testkey(Keyboard::Dot)
@keys.push(Keyboard::Backslash) if Keyboard.testkey(Keyboard::Backslash)
@keys.push(Keyboard::Lb) if Keyboard.testkey(Keyboard::Lb)
@keys.push(Keyboard::Rb) if Keyboard.testkey(Keyboard::Rb)
@keys.push(Keyboard::Quote) if Keyboard.testkey(Keyboard::Quote)
@pressed = []
@pressed.push(Keyboard::Mouse_Left) if Keyboard.getstate(Keyboard::Mouse_Left)
@pressed.push(Keyboard::Mouse_Right) if Keyboard.getstate(Keyboard::Mouse_Right)
@pressed.push(Keyboard::Back) if Keyboard.getstate(Keyboard::Back)
@pressed.push(Keyboard::Tab) if Keyboard.getstate(Keyboard::Tab)
@pressed.push(Keyboard::Enter) if Keyboard.getstate(Keyboard::Enter)
@pressed.push(Keyboard::Shift) if Keyboard.getstate(Keyboard::Shift)
@pressed.push(Keyboard::Ctrl) if Keyboard.getstate(Keyboard::Ctrl)
@pressed.push(Keyboard::Alt) if Keyboard.getstate(Keyboard::Alt)
@pressed.push(Keyboard::Esc) if Keyboard.getstate(Keyboard::Esc)
@pressed.push(Keyboard::Space) if Keyboard.getstate(Keyboard::Space)
for key in Keyboard::Numberkeys.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Numberpad.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Letters.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Fkeys.values
@pressed.push(key) if Keyboard.getstate(key)
end
@pressed.push(Keyboard::Collon) if Keyboard.getstate(Keyboard::Collon)
@pressed.push(Keyboard::Equal) if Keyboard.getstate(Keyboard::Equal)
@pressed.push(Keyboard::Comma) if Keyboard.getstate(Keyboard::Comma)
@pressed.push(Keyboard::Underscore) if Keyboard.getstate(Keyboard::Underscore)
@pressed.push(Keyboard::Dot) if Keyboard.getstate(Keyboard::Dot)
@pressed.push(Keyboard::Backslash) if Keyboard.getstate(Keyboard::Backslash)
@pressed.push(Keyboard::Lb) if Keyboard.getstate(Keyboard::Lb)
@pressed.push(Keyboard::Rb) if Keyboard.getstate(Keyboard::Rb)
@pressed.push(Keyboard::Quote) if Keyboard.getstate(Keyboard::Quote)
end
#--------------------------------------------------------------------------
def Keyboard.trigger?(key)
return true if @keys.include?(key)
return false
end
#--------------------------------------------------------------------------
def Keyboard.pressed?(key)
return true if @pressed.include?(key)
return false
end
#end
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end
#=========================Game_Fixes=============================
$showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
$showm.call(18,0,0,0)
$showm.call(13,0,0,0)
$showm.call(13,0,2,0)
$showm.call(18,0,2,0)
$mouse = Mouse_PositionCheck.new
$getCursorPos = Win32API.new("user32", "GetCursorPos", ['P'], 'V')
$setCursorPos = Win32API.new("user32", "SetCursorPos", ['I','I'], 'V')
$bg = Sprite.new
$bg.bitmap = RPG::Cache.icon('001-Weapon01')
$bg.z = 999999
$bg.y = 0
$bg.x = 0
module Input
if @self_update == nil
@self_update = method('update')
@self_press = method('press?')
@self_rep = method('repeat?')
end
def self.update
@self_update.call
$mouse.main
Keyboard.update
end
def self.trigger?(key_code)
if @self_press.call(key_code)
return true
end
if key_code == C
return Keyboard.trigger?(Keyboard::Mouse_Left)
elsif key_code == B
return Keyboard.trigger?(Keyboard::Mouse_Right)
else
return @self_press.call(key_code)
end
end
def self.repeat?(key_code)
if @self_rep.call(key_code)
return true
end
if key_code == C
return Keyboard.pressed?(Keyboard::Mouse_Left)
elsif key_code == B
return Keyboard.pressed?(Keyboard::Mouse_Right)
else
return @self_rep.call(key_code)
end
end
end
class Arrow_Enemy < Arrow_Base
def update
super
$game_troop.enemies.size.times do
break if self.enemy.exist?
@index += 1
@index %= $game_troop.enemies.size
end
#size = 0
#for i in 0...$game_troop.enemies.size
# size += 1 if $game_troop.enemies[i].hp > 0
#end
size = $game_troop.enemies.size if size == nil
@index = ((size / 640.0) * $bg.x.to_f).to_i
if self.enemy != nil
self.x = self.enemy.screen_x
self.y = self.enemy.screen_y
end
end
end
class Arrow_Actor < Arrow_Base
def update
super
@index = 0 if $bg.x > 0 and $bg.x <= 160 and 0 <= ($game_party.actors.size - 1)
@index = 1 if $bg.x > 160 and $bg.x <= 320 and 1 <= ($game_party.actors.size - 1)
@index = 2 if $bg.x > 320 and $bg.x <= 480 and 2 <= ($game_party.actors.size - 1)
@index = 3 if $bg.x > 480 and $bg.x <= 640 and 3 <= ($game_party.actors.size - 1)
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y
end
end
end
class Window_Target < Window_Selectable
alias gupdate update
def update
@defaultx = 0 if @defaultx == nil
if @defaultx != self.x
@defaultx = self.x
self.refresh_rect_positions
return
else
gupdate
end
end
def update_cursor_rect
if @index == -1
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
class Scene_Battle
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
@actor_command_window.x = @actor_index * 160
@actor_command_window.refresh_rect_positions
@actor_command_window.index = 0
end
end
class Scene_Equip
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
@actor = $game_party.actors[@actor_index]
end
alias gmain main
def main
@dummy = Window_EquipItem.new(@actor, 99)
gmain
@dummy.dispose
end
alias gupdate_right update_right
def update_right
if @right_window.index == -999999
if Input.trigger?(Input::C)
$game_system.se_play($data_system.buzzer_se)
end
else
gupdate_right
end
end
def refresh
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
@dummy.visible = (@right_window.index == -999999)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
when -999999
return
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil)
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
end
class Scene_Skill
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index == -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index <= -3
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
class Scene_File
def update
@help_window.update
for i in @savefile_windows
i.update
end
if Input.trigger?(Input::C)
if @file_index == -1
$game_system.se_play($data_system.buzzer_se)
else
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
end
if Input.trigger?(Input::B)
on_cancel
return
end
if $bg.y > 64 and $bg.y < 168
if @savefile_windows[0].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = true
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
@file_index = 0
elsif $bg.y > 168 and $bg.y < 272
if @savefile_windows[1].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = true
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
@file_index = 1
elsif $bg.y > 272 and $bg.y < 376
if @savefile_windows[2].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = true
@savefile_windows[3].selected = false
@file_index = 2
elsif $bg.y > 376 and $bg.y < 480
if @savefile_windows[3].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = true
@file_index = 3
else
@file_index = -1
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
end
end
end
class Scene_Menu
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
unless @status_window.index < 0
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
end
class Game_Player
def update
last_moving = moving?
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or
@cant_move
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
last_real_x = @real_x
last_real_y = @real_y
super
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
end
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
unless moving?
if last_moving
result = check_event_trigger_here([1,2])
if result == false
unless $DEBUG and Input.press?(Input::CTRL)
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_curor_field
if (@field_x == self.x + 1 and @field_y == self.y and
self.direction == 6) or (@field_x == self.x - 1 and
@field_y == self.y and self.direction == 4) or
(@field_x == self.x and @field_y == self.y + 1 and
self.direction == 2) or (@field_x == self.x and
@field_y == self.y - 1 and self.direction == 8)
check_event_trigger_there([0,1,2])
end
end
if Input.repeat?(Input::C)
check_curor_field
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or
@cant_move and not (@field_x == self.x and @field_y == self.y)
move_by_mouse
end
check_event_trigger_here([0])
end
end
end
def check_curor_field
dummyx = $game_map.display_x > 0 ? $bg.x + 16 : $bg.x
@field_x = dummyx / 32 + $game_map.display_x / 128
@field_y = $bg.y / 32 + $game_map.display_y / 128
end
def move_by_mouse
dy = @field_x - self.x
dx = self.y - @field_y
if dx > 0 and dy > 0 #quarter 1
if dx > dy
if passable?(self.x, self.y, 8)
move_up
else
move_right
end
return
elsif dx < dy
if passable?(self.x, self.y, 6)
move_right
else
move_up
end
return
elsif dx == dy
if passable?(self.x, self.y, 8)
move_up
else
move_right
end
return
end
elsif dx > 0 and dy < 0 #quarter 2
if dx > -dy
if passable?(self.x, self.y, 8)
move_up
else
move_left
end
return
elsif dx < -dy
if passable?(self.x, self.y, 4)
move_left
else
move_up
end
return
elsif dx == -dy
if passable?(self.x, self.y, 8)
move_up
else
move_left
end
return
end
elsif dx < 0 and dy < 0 #quarter 2
if -dx > -dy
if passable?(self.x, self.y, 2)
move_down
else
move_left
end
return
elsif -dx < -dy
if passable?(self.x, self.y, 4)
move_left
else
move_down
end
return
elsif -dx == -dy
if passable?(self.x, self.y, 2)
move_down
else
move_left
end
return
end
elsif dx < 0 and dy > 0 #quarter 4
if -dx > dy
if passable?(self.x, self.y, 2)
move_down
else
move_right
end
return
elsif -dx < dy
if passable?(self.x, self.y, 6)
move_right
else
move_down
end
return
elsif -dx == dy
if passable?(self.x, self.y, 2)
move_down
else
move_right
end
return
end
elsif dx == 0 and dy < 0
move_left
elsif dx == 0 and dy > 0
move_right
elsif dx < 0 and dy == 0
move_down
elsif dx > 0 and dy == 0
move_up
end
end
end
#20
Inviato 13 ottobre 2007 - 12:51
grazie raga e in particolare lorenman ! se ricordo bene per
Messaggio modificato da TNTbomb, 13 ottobre 2007 - 12:59
0 utente(i) stanno leggendo questa discussione
0 utenti, 0 visitatori, 0 utenti anonimi