• Anmelden
  • »dany81191« ist der Autor dieses Themas

Motto: Boom Shak Ragga

  • Nachricht senden

1

Mittwoch, 29. April 2009, 20:55

mouse system nur für map

Hey :D

kann jemand ein mouse script erstellen, welches für das sdk 2.4 funktioniert, und man es nur auf der Map benutzen kann??

Ich hab nämlich die Mog Menüs, und da funktioniert kein mouse system..

und es soll mit diesem keyboard input funktionieren..

Spoiler
class W32API
attr_reader :tasten #Der Hash der Tastennamen in Hexa-Code umwandelt
attr_reader :retasten #Der Hash der Hexa-Code in Tastennamen umwandelt
def initialize()
@key_push = Win32API.new('user32', "GetAsyncKeyState", 'i', 'i')
$key_press = Win32API.new('user32', "keybd_event", 'iiii', '')
@tasten = Hash.new(
#--------------------------Maus
"l mouse" => 0x01, #Linke Maustaste
"r mouse" => 0x02, #Rechte Maustaste
"m mouse" => 0x04, #Mittlere Maustaste
#--------------------------Special
"back" => 0x08, #Backspace
"tab" => 0x09, #Tabulator-Taste
"enter" => 0x0D, #Enter
"shift" => 0x10, #Eine der Shift-Tasten
"strg" => 0x11, #Alt Gr-Taste oder eine der Strg-Tasten
"alt" => 0x12, #Eine alt oder die Num-Block-Taste5 mit num lock
"umschalt" => 0x14, #Umschalttaste
"esc" => 0x1B, #Escape
"space" => 0x20, #Leertaste
#--------------------------Extra-Block
"bild oben" => 0x21,
"bild unten" => 0x22,
"ende" => 0x23,
"pos1" => 0x24,
#--------------------------Pfeil
"left" => 0x25,
"links" => 0x25, #-
"up" => 0x26,
"hoch" => 0x26, #-
"oben" => 0x26, #-
"right" => 0x27,
"rechts" => 0x27, #-
"down" => 0x28,
"unten" => 0x28, #-
#--------------------------Extra-Block
"snapshot" => 0x2C,
"einfg" => 0x2D,
"entf" => 0x2E,
#--------------------------Zahlen
"0" => 0x30,
"1" => 0x31,
"2" => 0x32,
"3" => 0x33,
"4" => 0x34,
"5" => 0x35,
"6" => 0x36,
"7" => 0x37,
"8" => 0x38,
"9" => 0x39,
#--------------------------Alphabet
"a" => 0x41,
"b" => 0x42,
"c" => 0x43,
"d" => 0x44,
"e" => 0x45,
"f" => 0x46,
"g" => 0x47,
"h" => 0x48,
"i" => 0x49,
"j" => 0x4A,
"k" => 0x4B,
"l" => 0x4C,
"m" => 0x4D,
"n" => 0x4E,
"o" => 0x4F,
"p" => 0x50,
"q" => 0x51,
"r" => 0x52,
"s" => 0x53,
"t" => 0x54,
"u" => 0x55,
"v" => 0x56,
"w" => 0x57,
"x" => 0x58,
"y" => 0x59,
"z" => 0x5A,
#--------------------------Special
"l windows" => 0x5B, #linke "Windows-Taste"
"r windows" => 0x5C, #rechte "Windows-Taste"
#--------------------------Num-Block
"num 0" => 0x60,
"num 1" => 0x61,
"num 2" => 0x62,
"num 3" => 0x63,
"num 4" => 0x64,
"num 5" => 0x65,
"num 6" => 0x66,
"num 7" => 0x67,
"num 8" => 0x68,
"num 9" => 0x69,
"num *" => 0x6A,
"num +" => 0x6B,
"num -" => 0x6D,
"num ," => 0x6E,
"num /" => 0x6F,
#--------------------------F-Zeichen
"F1" => 0x70,
"F2" => 0x71,
"F3" => 0x72,
"F4" => 0x73,
"F5" => 0x74,
"F6" => 0x75,
"F7" => 0x76,
"F8" => 0x77,
"F9" => 0x78,
"F10" => 0x79,
"F11" => 0x7A,
"F12" => 0x7B,
#--------------------------Num-Block
"num lock" => 0x90,
#--------------------------Extra-Block
"scroll" => 0x91,
#--------------------------Special
"l shift" => 0xA0,
"r shift" => 0xA1,
"l strg" => 0xA2,
"r strg" => 0xA3,
"l alt" => 0xA4,
"alt gr" => 0xA5,
#--------------------------Sonderzeichen
"ü" => 0xBA,
"+" => 0xBB,
"," => 0xBC,
"-" => 0xBD,
"." => 0xBE,
"#" => 0xBF,
"ö" => 0xC0,
#--------------------------Special
"menü" => 0xD5,
#--------------------------Sonderzeichen
"ß" => 0xDB,
"^" => 0xDC,
"´" => 0xDD,
"ä" => 0xDE,
"<" => 0xE2
)
@tasten = @tasten[1]
@retasten = @tasten.invert
@nmomw = 1
@nmoma = -1
end
#-----------------------------------------------------------------------------
####Rückgabe Wandelt einen String in die Zeichen um, die durch
# drücken der Shift-Taste herauskommen
####Parameter
#str :Der umzuwandelnde String
#-----------------------------------------------------------------------------
def shift_string(str)
str = str.tr(('a'..'z').to_a.join+'^1234567890ß´äöü+#<,.-',
('A'..'Z').to_a.join+'°!"§$%&/()=?`ÄÖÜ*\'>;:_')
return(str)
end
#-----------------------------------------------------------------------------
####Rückgabe Wandelt einen String in die Zeichen um, die durch
# drücken der Alt Gr-Taste herauskommen
####Parameter
#str :Der umzuwandelnde String
#-----------------------------------------------------------------------------
def altgr_string(str)
str = str.tr('237890ßqe+<m', '²³{[]}\@€~|µ')
return(str)
end
#-----------------------------------------------------------------------------
####Rückgabe True, wenn die Taste gerade angefangen wird zu drücken.
####Parameter
#taste :Der Name der zu überprüfenden Taste
#-----------------------------------------------------------------------------
def an?(taste)
if(@tasten[taste])
iff = @key_push.call(@tasten[taste])
if(iff < 0)
ret=true
else
ret=false
end
return(ret)
else
return(false)
end
end
#-----------------------------------------------------------------------------
####Rückgabe True, wenn die Taste gedrückt ist.
####Parameter
#taste :Der Name der zu überprüfenden Taste
#-----------------------------------------------------------------------------
def press?(taste)
if(@tasten[taste])
iff = @key_push.call(@tasten[taste])
if(iff != 0 and iff != 1)
ret=true
else
ret=false
end
return(ret)
else
return(false)
end
end
#-----------------------------------------------------------------------------
####Rückgabe True, wenn die Taste gedrückt ist.
####Parameter
#taste :Der Hexadezimale Code der zu überprüfenden Taste
#-----------------------------------------------------------------------------
def pressc?(taste)
if(@retasten[taste])
iff = @key_push.call(taste)
if(iff != 0 and iff != 1)
ret=true
else
ret=false
end
return(ret)
else
return(false)
end
end
#-----------------------------------------------------------------------------
#Drückt eine Taste Extrem kurz (Wird von anderen
# Scripten nicht erfasst, aber von Windows ;) )
####Parameter
#taste :Gibt die Taste an, die gedrückt werden soll
#-----------------------------------------------------------------------------
def keypress(taste)
keydown(taste)
keyup(taste)
end
#-----------------------------------------------------------------------------
#Drückt eine Taste ab jetzt
####Parameter
#taste :Gibt die Taste an, die gedrückt werden soll
#-----------------------------------------------------------------------------
def keydown(taste)
if(@tasten[taste])
$key_press.call(@tasten[taste], 0, 0x0, 0)
end
end
#-----------------------------------------------------------------------------
#Macht eine gedrückte Taste hoch
####Parameter
#taste :Gibt die Taste an, die gehoben werden soll
#-----------------------------------------------------------------------------
def keyup(taste)
if(@tasten[taste])
$key_press.call(@tasten[taste], 0, 0x2, 0)
end
end
end
$api = W32API.new
zum Lesen den Text mit der Maus markieren


außer ihr habt eines, welches mit den mogs funktioniert (ich glaubs eher nicht) :)
Spoiler
Bild
zum Lesen den Text mit der Maus markieren




Spoiler


DJ Laitier rocks the house!!

http://www.youtube.com/user/dany81191
zum Lesen den Text mit der Maus markieren

Reborn

hat beim Stromkonzern schon Rabatt

Motto: Wer noch was vom Wochenende weis, hat es nie erlebt!

  • Nachricht senden

2

Donnerstag, 30. April 2009, 07:58

Hier:

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
#==============================================================================
# ** Mouse Input Module (Revised)
#------------------------------------------------------------------------------
#   by DerVVulfman
#   version 1.2
#   08-18-2007
#------------------------------------------------------------------------------
#   Based on...
#   Mouse Input Module
#   by Near Fantastica
#------------------------------------------------------------------------------
#   Set_Pos feature by
#   Freakboy
#------------------------------------------------------------------------------
#
#   THE CALLS: 
#
#   Mouse.click?
#   This returns a true/false value  when you test whether a button is clicked.
#   The values you pass are 1 (for the left mouse button), 2 (for the right) or
#   3 (for the middle button).
#
#   Mouse.press?
#   This returns a true/false value  when you test  whether a button is pressed
#   and kept depressed.  The values you pass are 1 (for the left mouse button),
#   2 (for the right mouse button), or 3 (for the middle).
#
#   Mouse.pixels
#   This returns the  mouse's screen coordinates  in pixels.  Based on a screen
#   with a 640x480 dimension,  this returns an array of the mouse's position in
#   index values.  Calling Mouse.pixels returns both x & y positions  in a sin-
#   gle string,  but calling Mouse.pixels[0] returns the x position (0-639) and
#   calling Mouse.pixels[1]  returns  the y position (0-439).   If the mouse is
#   outside of the game's window region, this call returns nil.
#
#   Mouse.tiles
#   This returns  the mouse's screen  coordinates  in map tiles.   Based on the
#   system's 20x15 tile size,  this returns it in index values  (a 0-19 width & 
#   a 0-14 height).  This functions the same manner as Mouse.pixels.
#
#   Mouse.set_pos
#   This allows you  to forcefully position the mouse at an x/y position within
#   the game screen by pixel coordinates.  Given the game's normal screen width
#   of 640x480, adding:  Mouse.set_pos(320,240)  should position the mouse dead
#   center of the gaming window.
#
#   Mouse.update
#   Add this routine  into your update routines  to update  the mouse position.
#   It must be called otherwise you won't get valid mouse coordinates.
#
#==============================================================================
 
module Mouse
  @mouse_menu = 0
  #--------------------------------------------------------------------------
  # * Mouse Picture
  #     Picture ID  : id
  #--------------------------------------------------------------------------
  def Mouse.picture?(id,x,y,px,py)
    return false if $game_screen.pictures[id].name == ""
    Mouse.update
    x2 = x + px
    y2 = y + py
    for i in x..x2
      if i == Mouse.pixels[0]
        for i in y..y2
          return true if i == Mouse.pixels[1]
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Mouse Event Touch Check
  #     Event ID    : id
  #--------------------------------------------------------------------------
  def Mouse.event?(id)
    x = $game_player.x - $game_player.screen_x / 32 + Mouse.pixels[0] / 32
    y = $game_player.y - $game_player.screen_y / 32 + Mouse.pixels[1] / 32
    return true if $game_map.events[id].x == x and $game_map.events[id].y-1 == y
    return false
  end
  #--------------------------------------------------------------------------
  # * Mouse Click
  #     button      : button
  #--------------------------------------------------------------------------
  def Mouse.click?(button)
    return true if @keys.include?(button)
    return false
  end  
  #--------------------------------------------------------------------------
  # * Mouse Pressed
  #     button      : button
  #--------------------------------------------------------------------------
  def Mouse.press?(button)
    return true if @press.include?(button)
    return false
  end
  #--------------------------------------------------------------------------
  # * Mouse Pressed
  #     button      : button
  #--------------------------------------------------------------------------
  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
  #--------------------------------------------------------------------------
  # * Mouse Pixel Position
  #--------------------------------------------------------------------------
  def Mouse.pixels
    return @pos == nil ? [0, 0] : @pos
  end
  #--------------------------------------------------------------------------
  # * Mouse Tile Position
  #--------------------------------------------------------------------------
  def Mouse.tiles
    return nil if @pos == nil
    x = @pos[0] / 32
    y = @pos[1] / 32
    return [x, y]
  end
  #--------------------------------------------------------------------------
  # * Set Mouse Position
  #-------------------------------------------------------------------------- 
  def Mouse.set_pos(x_pos=0, y_pos=0)
    width, height = Mouse.client_size
    if (x_pos.between?(0, width) && y_pos.between?(0, height))
      x = Mouse.client_pos[0] + x_pos; y = Mouse.client_pos[1] + y_pos
      Win32API.new('user32', 'SetCursorPos', 'NN', 'N').call(x, y)
    end
  end
  #--------------------------------------------------------------------------
  # * Mouse Update
  #--------------------------------------------------------------------------
  def Mouse.update
    @pos            = Mouse.pos
    @keys, @press   = [], []
    @keys.push(1)   if Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(1) & 0X01 == 1
    @keys.push(2)   if Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(2) & 0X01 == 1
    @keys.push(3)   if Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(4) & 0X01 == 1
    @press.push(1)  if Win32API.new("user32","GetKeyState",['i'],'i').call(1) & 0X01 == 1
    @press.push(2)  if Win32API.new("user32","GetKeyState",['i'],'i').call(2) & 0X01 == 1
    @press.push(3)  if Win32API.new("user32","GetKeyState",['i'],'i').call(4) & 0X01 == 1
  end  
  #--------------------------------------------------------------------------
  # * Automatic functions below 
  #--------------------------------------------------------------------------
  #
  #--------------------------------------------------------------------------
  # * Obtain Mouse position in screen
  #--------------------------------------------------------------------------
  def Mouse.global_pos
    pos = [0, 0].pack('ll')
    if Win32API.new('user32', 'GetCursorPos', 'p', 'i').call(pos) != 0
      return pos.unpack('ll')
    else
      return nil
    end
  end
  #--------------------------------------------------------------------------
  # * Return Screen mouse position within game window
  #--------------------------------------------------------------------------
  def Mouse.pos
    x, y = Mouse.screen_to_client(*Mouse.global_pos)
    width, height = Mouse.client_size
    begin
      if (x >= 0 and y >= 0 and x < width and y < height)
        return x, y
      else
        return nil
      end
    rescue
      return nil
    end
  end
  #--------------------------------------------------------------------------
  #  * Pass Screen to Game System
  #--------------------------------------------------------------------------
  def Mouse.screen_to_client(x, y)
    return nil unless x and y
    pos = [x, y].pack('ll')
    if Win32API.new('user32', 'ScreenToClient', %w(l p), 'i').call(Mouse.hwnd, pos) != 0
      return pos.unpack('ll')
    else
      return nil
    end
  end
  #--------------------------------------------------------------------------
  # * Get Screen Window Handle
  #--------------------------------------------------------------------------
  def Mouse.hwnd
    game_name = "\0" * 256
    Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l').call('Game','Title','',game_name,255,".\\Game.ini")
    game_name.delete!("\0")
    return Win32API.new('user32', 'FindWindowA', %w(p p), 'l').call('RGSS Player',game_name)
  end
  #--------------------------------------------------------------------------
  # * Get Game Window Size
  #--------------------------------------------------------------------------
  def Mouse.client_size
    rect = [0, 0, 0, 0].pack('l4')
    Win32API.new('user32', 'GetClientRect', %w(l p), 'i').call(Mouse.hwnd, rect)
    right, bottom = rect.unpack('l4')[2..3]
    return right, bottom
  end
  #--------------------------------------------------------------------------
  # * Get Window Position (RGSS Player)
  #--------------------------------------------------------------------------
  def Mouse.client_pos
    rect = [0, 0, 0, 0].pack('l4')
    Win32API.new('user32', 'GetWindowRect', %w(l p), 'i').call(Mouse.hwnd, rect)
    left, upper = rect.unpack('l4')[0..1]
    return left+4, upper+30
  end  
end
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?


Spoiler: OpenSource-Projects
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
zum Lesen den Text mit der Maus markieren

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

3

Donnerstag, 30. April 2009, 18:37

Dein Skript macht aber nix Hindi, sondern ist nur zur Skripterstellung gedacht.
Außerdem kann man es nicht nur auf der Map verwenden, sondern überall xP
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

Reborn

hat beim Stromkonzern schon Rabatt

Motto: Wer noch was vom Wochenende weis, hat es nie erlebt!

  • Nachricht senden

4

Donnerstag, 30. April 2009, 19:05

Was für einen Sinn sollte sonst ein Mouse-Script haben? Oder was willst du überhaupt erreichen?
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?


Spoiler: OpenSource-Projects
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
zum Lesen den Text mit der Maus markieren

5

Donnerstag, 30. April 2009, 19:08

Unter "Nur auf der Map benutzen" versteht er vermutlich, dass das Mausskript nur die Heldenbewegung steuert und sonst nichts. Muss sich dany81191 noch mal melden.

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

6

Donnerstag, 30. April 2009, 19:09

Normalerweise würde ich sowas unter einem Mouse System verstehen:
http://www.rmxp.org/forums/viewtopic.php…it=mouse+system

Halt Steuerung auf der Map und in Menüs

/edit
Monsta D:<
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

Reborn

hat beim Stromkonzern schon Rabatt

Motto: Wer noch was vom Wochenende weis, hat es nie erlebt!

  • Nachricht senden

7

Donnerstag, 30. April 2009, 20:33

Das währe ja noch das einfachst, dann brauchst halt noch das Pathfinding und der rest erklärt sich von selbst...
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?


Spoiler: OpenSource-Projects
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
zum Lesen den Text mit der Maus markieren

Ähnliche Themen

Social Bookmarks