Mausskript Problem
Ahoi, ich hab zwei kleine Probleme mit meinem Mausscript
Problem 1:
Die Maus zeigt auf einen Menüpunkt aber dieser wird nicht ausgewählt, erst wen ich die Maus viel weiter unter dem Menüpunkt habe wird dieser ausgewählt, je weiter unten der Menüpunkt ist je größer der Abstand zu der Maus.

Problem 2:
Wenn ich Input überschreibe funktioniert mein Pathfinding nicht mehr obwohl ich die Maustaste die dafür vorgesehen ist nicht doppelt belegt habe.
Ich hoffe es kann mir wer weiterhelfen denn ich komm leider allein nicht weiter.
Problem 1:
Die Maus zeigt auf einen Menüpunkt aber dieser wird nicht ausgewählt, erst wen ich die Maus viel weiter unter dem Menüpunkt habe wird dieser ausgewählt, je weiter unten der Menüpunkt ist je größer der Abstand zu der Maus.
Problem 2:
Wenn ich Input überschreibe funktioniert mein Pathfinding nicht mehr obwohl ich die Maustaste die dafür vorgesehen ist nicht doppelt belegt habe.
|
|
Ruby Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Déplacement/selection d'events a la souris # berka 0.2 Rgss1 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # http://www.rpgmakervx-fr.com #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #=========================================== # Mouse # par Berka d'apres SephirothSpawn #=========================================== module Berka module Curseur_Mod Bmp_Curs='Graphics/System/Curseur.png' Scroll_Actif=true end module Deplace_Event Commentaire="bouge" # pour distinguer les events déplacables Couleur_Cadre_Selection=Color.new(0,255,50,255) Couleur_Fond_Selection=Color.new(0,255,50,75) end end module Mouse GetAsyncKeyState=Win32API.new("user32","GetAsyncKeyState",'i','i') GetKeyState=Win32API.new("user32","GetKeyState",'i','i') SetCursorPos=Win32API.new('user32','SetCursorPos','nn','n') GetCursorPo=Win32API.new('user32','GetCursorPos','p','i') ScreenToClient=Win32API.new('user32','ScreenToClient','lp','i') GetPrivateProfileStringA=Win32API.new('kernel32','GetPrivateProfileStringA','pppplp','l') FindWindowA=Win32API.new('user32','FindWindowA','pp','l') GetClientRect=Win32API.new('user32','GetClientRect','lp','i') GetWindowRect=Win32API.new('user32','GetWindowRect','lp','i') @mouse_menu=0 game_name="\0"*256 GetPrivateProfileStringA.call('Game','Title','',game_name,255,".\\Game.ini") game_name.delete!("\0") @handle=FindWindowA.call('RGSS Player',game_name) module_function def click?(button) return true if @keys.include?(button) return false end def press?(button) return true if @press.include?(button) return false end def enter? return true if GetAsyncKeyState.call(1)&0x01==1 return false end def set_pos(x_pos=0,y_pos=0) width,height=client_size if (x_pos.between?(0,width)&&y_pos.between?(0,height)) SetCursorPos.call(client_pos[0]+x_pos,client_pos[1]+y_pos) end end def update @pos=Mouse.pos @keys,@press=[],[] @keys.push(1)if GetAsyncKeyState.call(1)&0x01==1 @keys.push(2)if GetAsyncKeyState.call(2)&0x01==1 @keys.push(3)if GetAsyncKeyState.call(4)&0x01==1 @press.push(1)if pressed?(1) @press.push(2)if pressed?(2) @press.push(3)if pressed?(4) end def pressed?(key) return true unless GetKeyState.call(key).between?(0,1) return false end def global_pos pos=[0,0].pack('ll') GetCursorPo.call(pos)!=0 ? (return pos.unpack('ll')):(return nil) end def pos x,y=screen_to_client(*global_pos) width,height=client_size begin x=0 if x<=0;y=0 if y<=0 x=width if x>=width;y=height if y>=height return x,y end end def screen_to_client(x,y) return nil unless x&&y pos=[x,y].pack('ll') ScreenToClient.call(@handle,pos)!=0?(return pos.unpack('ll')):(return nil) end def client_size rect=[0,0,0,0].pack('l4') GetClientRect.call(@handle,rect) right,bottom=rect.unpack('l4')[2..3] return right,bottom end def client_pos rect=[0,0,0,0].pack('l4') GetWindowRect.call(@handle,rect) left,upper=rect.unpack('l4')[0..1] return left+4,upper+30 end def grid return nil if @pos.nil? return [(@pos[0]+$game_map.display_x/8)/32,(@pos[1]+$game_map.display_y/8)/32] end def Mouse.area?(x, y, width=32, height=32) return false if @pos == nil return true if @pos[0] >= x and @pos[0] <= (x+width) and @pos[1] >= y and @pos[1] <= (y+height) return false end end #=========================================== # Sprite_Curseur # par Berka #=========================================== class Sprite_Curseur < RPG::Sprite def initialize super Win32API.new('user32','ShowCursor','i','i').call(0) self.z=5000 creer_curseur(Berka::Curseur_Mod::Bmp_Curs) update end def creer_curseur(curseur="") (self.bitmap=Bitmap.new(curseur);return)rescue nil self.bitmap=Bitmap.new(24,24) bitmap=RPG::Cache.icon("001-Weapon01") rect=Rect.new(0,0,24,24) self.bitmap.blt(0,0,bitmap,rect) end def update;super;self.x,self.y=Mouse.pos;end def dispose;super;end end Curseur=Sprite_Curseur.new #=========================================== # Pathfinding # par SephirothSpawn #=========================================== class Game_Character alias nf_pf_game_character_initialize initialize alias nf_pf_game_character_update update attr_accessor :map attr_accessor :runpath def initialize nf_pf_game_character_initialize @map,@runpath=nil,false end def update run_path if @runpath nf_pf_game_character_update end def run_path return if moving? step=@map[@x,@y] (@map,@runpath=nil,false;return)if step==1 case rand(2) when 0 move_right if @map[@x+1,@y]==step-1&&step!=0 move_down if @map[@x,@y+1]==step-1&&step!=0 move_left if @map[@x-1,@y]==step-1&&step!=0 move_up if @map[@x,@y-1]==step-1&&step!=0 when 1 move_up if @map[@x,@y-1]==step-1&&step!=0 move_left if @map[@x-1,@y]==step-1&&step!=0 move_down if @map[@x,@y+1]==step-1&&step!=0 move_right if @map[@x+1,@y]==step-1&&step!=0 end end def find_path(x,y) sx,sy=@x,@y result=setup_map(sx,sy,x,y) @runpath,@map=result[0],result[1] @map[sx,sy]=result[2] if !result[2].nil? end def clear_path;@map,@runpath=nil,false;end def setup_map(sx,sy,ex,ey) map=Table.new($game_map.width,$game_map.height) map[ex,ey]=1 old_positions,new_positions=[],[] old_positions.push([ex,ey]) depth=2 depth.upto(100){|step| loop do break if old_positions[0].nil? x,y=old_positions.shift return [true,map,step] if x==sx&&y+1==sy if $game_map.passable?(x,y,2)&&map[x,y+1]==0 map[x,y+1]=step new_positions.push([x,y+1]) end return [true,map,step] if x-1==sx&&y==sy if $game_map.passable?(x,y,4)&&map[x-1,y]==0 map[x-1,y]=step new_positions.push([x-1,y]) end return [true,map,step] if x+1==sx&&y==sy if $game_map.passable?(x,y,6)&&map[x+1,y]==0 map[x+1,y]=step new_positions.push([x+1,y]) end return [true,map,step] if x==sx&&y-1==sy if $game_map.passable?(x,y,8)&&map[x,y-1]==0 map[x,y-1]=step new_positions.push([x,y-1]) end end old_positions=new_positions new_positions=[]} return [false,nil,nil] end end class Game_Map alias pf_game_map_setup setup def setup(map_id) pf_game_map_setup(map_id) $game_player.clear_path for event in events.values event.clear_path end end end #=========================================== # Rect Select # par Berka #=========================================== class Rect_Select<Sprite def initialize super self.x,self.y=Mouse.pos self.z=5000 self.bitmap=Bitmap.new(640,480) self.visible=false end def update(ox=0,oy=0) self.visible=true self.bitmap.clear (Mouse.pos[0]-ox>0)?(self.x=ox;cib_x=Mouse.pos[0]-self.x):(self.x=Mouse.pos[0];cib_x=ox-Mouse.pos[0]) (Mouse.pos[1]-oy>0)?(self.y=oy;cib_y=Mouse.pos[1]-self.y):(self.y=Mouse.pos[1];cib_y=oy-Mouse.pos[1]) self.bitmap.fill_rect(0,0,cib_x,cib_y,Berka::Deplace_Event::Couleur_Cadre_Selection) self.bitmap.fill_rect(1,1,cib_x-2,cib_y-2,Berka::Deplace_Event::Couleur_Fond_Selection) end def chk_dessous?(x,y) x-=$game_map.display_x/8 y-=$game_map.display_y/8 return true if x.between?(self.x,Mouse.pos[0]-self.x)&&y.between?(self.y,Mouse.pos[1]-self.y) return false end end #=========================================== # Scene_Map: Select # par Berka #=========================================== class Scene_Map alias :select_main :main alias :select_update :update def main @rect=Rect_Select.new @x,@y,@events=Mouse.pos[0],Mouse.pos[1],[] select_main @spriteset = Spriteset_Map.new @message_window = Window_Message.new Graphics.transition loop do Graphics.update Input.update update break if $scene != self end Graphics.freeze @spriteset.dispose @message_window.dispose @rect.dispose if $scene.is_a?(Scene_Title) Graphics.transition Graphics.freeze end end def update Mouse.update select_update @rect.visible=false if !Mouse.press?(1);@x,@y=Mouse.pos[0],Mouse.pos[1] else;@rect.visible=true;@rect.update(@x,@y) for event in $game_map.events.values if event.list[0].parameters==Berka::Deplace_Event::Commentaire.to_a (@events << event) if @rect.chk_dessous?(event.x*32,event.y*32) end end end if Mouse.click?(1) for event in $game_map.events.values if event.list[0].parameters==Berka::Deplace_Event::Commentaire.to_a @events << event if Mouse.grid==[event.x,event.y] end end elsif Mouse.click?(2) if !@events.empty? @events.each{|event|event.find_path(Mouse.grid[0],Mouse.grid[1]) @events.delete(event) if event.runpath} @events=[] else;$game_player.find_path(Mouse.grid[0],Mouse.grid[1]) end elsif Mouse.click?(3) @events=[] end end end module Graphics class<<self alias :graphics_update :update unless Graphics.methods.include?('graphics_update') def update graphics_update Curseur.update end end end |
zum Lesen den Text mit der Maus markieren
|
|
Ruby Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
class << Input alias wor_input_upd_mouse update unless $@ alias wor_input_trig_mouse trigger? unless $@ def Input.update wor_input_upd_mouse Mouse.update end def Input.trigger?(input) return wor_input_trig_mouse(input) if Mouse.pos.nil? if input == Input::C if $scene.is_a?(Scene_Map) and $game_message != nil and !$game_message.visible return wor_input_trig_mouse(input) else return (wor_input_trig_mouse(input) or Mouse.click?(1)) return Mouse.click?(1) end else return wor_input_trig_mouse(input) end end end class Window_Selectable < Window_Base alias wor_winsel_ini_mouse initialize alias wor_winsel_upd_mouse update def initialize(*args) wor_winsel_ini_mouse(*args) @scroll_wait = 0 @cursor_wait = 0 end def update wor_winsel_upd_mouse update_mouse if self.active and self.visible end def update_mouse @cursor_wait -= 1 if @cursor_wait > 0 (0..@item_max - 1).each do |i| irect = item_rect(i) irx = self.x + 16 + irect.x - self.ox iry = self.y + 16 + irect.y - self.oy move_cursor(i) if Mouse.area?(irx, iry, irect.width, irect.height) end end def move_cursor(index) return if @index == index @scroll_wait -= 1 if @scroll_wait > 0 row1 = @index / @column_max row2 = index / @column_max bottom = self.top_row + (self.page_row_max - 1) if row1 < self.top_row and row2 < self.top_row return if @scroll_wait > 0 @index = [@index - @column_max, 0].max @scroll_wait = 30 elsif row1 == bottom and row2 > bottom return if @scroll_wait > 0 @index = [@index + @column_max, @item_max - 1].min @scroll_wait = 30 else @index = index end return if @cursor_wait > 0 $game_system.se_play($data_system.cursor_se) @cursor_wait += 2 end def item_rect(index) return Rect.new(0, index * 96, contents.width, 96) end end |
zum Lesen den Text mit der Maus markieren
Ich hoffe es kann mir wer weiterhelfen denn ich komm leider allein nicht weiter.
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »siteplayer« (19. September 2009, 15:01)
Ich bin jetzt mal zu faul um das Script von dia zu lese, wollte aber mal wissen, was dein Script sonst noch alles so kann?
Mehr als a Allgäuer ka a Mensch it wera.
Wie soll ich wissen was ich denke, bevor ich nicht höre was ich sage?
NES-Emulator - a simple NES-Emulator
ERDL - a embedded Ruby Interpreter with the abilltiy to render images with DirectX ERDL shall be 100% compatible to RPGXP-Ruby Scripts
ERDL - a embedded Ruby Interpreter with the abilltiy to render images with DirectX ERDL shall be 100% compatible to RPGXP-Ruby Scripts
zum Lesen den Text mit der Maus markieren
Naja das Mausscript is von Berka und das Pathfinding von SephirothSpawn, mit der linken Taste wird ein Quadrat gezeichnet, die mittlere Taste ist unbelegt, die rechte Taste ist zum Bewegen des Spielers, allerdings brauche ich nur das Pathfinding, die Linke Taste soll zum Menü auswählen und Kampf benutzt werden (benutze noch das Monsta's Shoot System), die Mittlere soll zum Menüöffnen benutzt werden.
Das Script für die Menü Auswahl stammt aus dem Simple Mouse System und wurde von Neo-Bahamut in diesem Thread umgeschrieben.
Das Script für die Menü Auswahl stammt aus dem Simple Mouse System und wurde von Neo-Bahamut in diesem Thread umgeschrieben.
Benutzerinformationen überspringen
Motto: wenn du fragen hast dann frag, versuche aber so zu fragen, dass man dich versteht.
ersten: dir werden nicht mehr sondern eher weniger leute helfen wenn du andauernd "push" postest.
zweitens: sowas kann tierisch ärger mit den mods geben!
also lass das gepushe lieber sein!
gruß agenty
Pushen ist nach 3 Tagen erlaubt. Du hingegen solltest Pseudomodding lieber sein lassen
~ Drag-On
agenty fühlt sich auf grund dieses edits von dem moderator missverstanden, da er eigentlich nicht gegen das pushen als solches geredet hat sondern gegen die art und weise, nämlich durch sog. spam, der noch dazu themafremdes posting enthällt. agenty dementiert des weiteren, sich wie ein moderator verhalten zu haben, er wollte lediglich dem user einige informationen zukommen lassen
zweitens: sowas kann tierisch ärger mit den mods geben!
also lass das gepushe lieber sein!
gruß agenty
Pushen ist nach 3 Tagen erlaubt. Du hingegen solltest Pseudomodding lieber sein lassen
~ Drag-Onagenty fühlt sich auf grund dieses edits von dem moderator missverstanden, da er eigentlich nicht gegen das pushen als solches geredet hat sondern gegen die art und weise, nämlich durch sog. spam, der noch dazu themafremdes posting enthällt. agenty dementiert des weiteren, sich wie ein moderator verhalten zu haben, er wollte lediglich dem user einige informationen zukommen lassen
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »agenty« (30. September 2009, 12:22)
Ähnliche Themen
-
Taverne zum philosophischen Phönix »-
Pech gehabt!
(28. Mai 2007, 23:40)
-
Skript-Anfragen »-
"Text Art Ändern" Skript
(5. August 2009, 09:07)
-
Archiv Jobbörse »-
[Suche] Skripter der Menü bearbeitet
(24. September 2008, 03:36)
-
RGSS Archiv »-
Maus Skript?
(10. April 2005, 17:49)
-
RGSS Archiv »-
Mausscript.
(19. Dezember 2004, 20:25)

