• Anmelden

1

Mittwoch, 28. Juli 2010, 13:25

Mausskript per scriptfunktion aktivieren?

Hy!
Ich würde gerne wissen ob es ein Mausskript gibt das sich per scriptfunktion im maker aktivieren lässt.
Gibt es sowas oder könnte mir das jemand machen?
Ich habe keines gefunden, aber wahrscheinlich war ich einfach wieder zu doof :C

man sollte damit einfach nur steuern können und leute ansprechen etc...^^
Bild


Reborn

hat beim Stromkonzern schon Rabatt

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

  • Nachricht senden

2

Mittwoch, 28. Juli 2010, 17:36

Kommt drauf an was du mit aktivieren meinst...

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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
#==============================================================================
#
# Mouse Script 1.0                                      created by: cybersam
#                                                       edited by: MagicMagor
#
#==============================================================================
#
# (got rid of cybersams explanation here, because it isn't true for this module)
#                                                       MagicMagor
#==============================================================================
 
#==============================================================================
# I have edited cybersams script, to fit my needs and my personal style of
# coding. I have also extended the script and got rid of several bugs. 
# If you use this, give credit to cybersam and me.
#------------------------------------------------------------------------------
# MagicMagor
#==============================================================================
 
module Mouse
 
  MOUSE_LEFT    = 0x01        # left mouse button
  MOUSE_RIGHT   = 0x02        # right mouse button
 
  attr_reader :MOUSE_LEFT, :MOUSE_RIGHT
 
  # Flags
 
  INIT_CURSOR = 0x01
  INIT_SAVE = 0x02
  INIT_TYPE = 0x03
 
  CURSOR_PIC = 0x01
  CURSOR_ROOT = 0x02
  CURSOR_BITMAP = 0x03
 
  attr_reader :INIT_CURSOR, :INIT_SAVE, :INIT_TYPE,
              :CURSOR_PIC, :CURSOR_ROOT, :CURSOR_BITMAP
 
 
  @getCursorPos = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
  @getWindowRect = Win32API.new('user32', 'GetWindowRect', ['p', 'p'], 'i')
  @scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i')
  @client_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i')
  @readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
  @findwindow = Win32API.new('user32', 'FindWindow', %w(p p), 'l')
  @getKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
 
  #---------------------------------------------------------------------------
  # Initialize the mouse-system, with given arguments. Is automaticly called
  # if needed.
  #---------------------------------------------------------------------------
  def Mouse.initSystem(*args)
    @init = true
    @handle = self.getHandle()
    @cursor = Sprite.new()
    if args.length >= 1
      flags = args[0]
      @showCursor  = (flags & INIT_CURSOR)
      @saveToGame = (flags & INIT_SAVE)
      withType = (flags & INIT_TYPE)
      if (@showCursor != 0)
        @showCursor = true
      else
        @showCursor = false
      end
      if (@saveToGame != 0)
        @saveToGame = true
      else
        @saveToGame = false
      end
      @cursor.visible = @showCursor
      @originX = 0
      @originY = 0
      if (@saveToGame)
        @gameX = args[-2]
        @gameY = args[-1]
      end
      if (@showCursor)
        if (withType)
          self.setCursor(args[1], args[2])
        else
          self.setCursor(args[1])
        end
      end
    end
    return nil
  end
 
  #---------------------------------------------------------------------------
  # Checks if key was pressed.
  #---------------------------------------------------------------------------  
  def Mouse.pressed?(key)
   return ((@getKeyState.call(key) & 0x01) == 1)
  end
 
  #---------------------------------------------------------------------------
  # Returns true if saving mouse positions to game-variables is enabled
  #---------------------------------------------------------------------------  
  def Mouse.saveToGame?()
    if !(@init)
      self.initSystem(nil)
    end
    return @saveToGame
  end
 
  #---------------------------------------------------------------------------
  # Enables saving the mouse positions to game-variables
  #---------------------------------------------------------------------------  
  def Mouse.enableSaveToGame(game_x = nil, game_y = nil )
    if !(@init)
      self.initSystem(nil)
    end
    @saveToGame = true
    if (game_x != nil)
      @gameX = game_x
    end
    if (game_y != nil)
      @gameY = game_y
    end
    return nil
  end
 
  #---------------------------------------------------------------------------
  # Disables saving the mouse positions to game-variables
  #---------------------------------------------------------------------------  
  def Mouse.disableSaveToGame()
    if !(@init)
      self.initSystem(nil)
    end
    @saveToGame = false
    return nil
  end
 
  #---------------------------------------------------------------------------
  # Sets the variable-ID in which the X position is saved
  #---------------------------------------------------------------------------  
  def Mouse.setGameX(game_x)
    if !(@init)
      self.initSystem(nil)
    end
    @gameX = game_x
    return nil
  end
 
  #---------------------------------------------------------------------------
  # Sets the variable-ID in which the Y position is saved
  #---------------------------------------------------------------------------  
  def Mouse.setGameY(game_y)
   if !(@init)
      self.initSystem(nil)
    end
   @gameY = game_y
   return nil
  end
 
  #---------------------------------------------------------------------------
  # Returns the variable-ID in which the X position is saved
  #---------------------------------------------------------------------------  
  def Mouse.gameX
    return @gameX
  end  
 
  #---------------------------------------------------------------------------
  # Returns the variable-ID in which the Y position is saved
  #---------------------------------------------------------------------------  
  def Mouse.gameY
    return @gameY
  end
 
  #---------------------------------------------------------------------------
  # Returns X-Value of mouse positions
  #---------------------------------------------------------------------------    
  def Mouse.x()
    if !(@init)
      self.initSystem(nil)
    end
    x, y = Mouse.mousePos()
    return x
  end
 
  #---------------------------------------------------------------------------
  # Returns Y-Value of mouse positions
  #---------------------------------------------------------------------------    
  def Mouse.y()
    if !(@init)
      self.initSystem(nil)
    end
    x, y = Mouse.mousePos()
    return y
  end
 
  #---------------------------------------------------------------------------
  # Returns TRUE when the mouse-cursor is shown.
  #---------------------------------------------------------------------------    
  def Mouse.shown?()
    if !(@init)
      self.initSystem(nil)
    end
    return @showCursor
  end
 
  #---------------------------------------------------------------------------
  # Enables showing of the mouse-cursor.
  #---------------------------------------------------------------------------    
  def Mouse.enableShow()
    if !(@init)
      self.initSystem(nil)
    end
    @showCursor = true
    @cursor.visible = true
    return nil
  end
 
  #---------------------------------------------------------------------------
  # Disable showing of the mouse-cursor.
  #---------------------------------------------------------------------------    
  def Mouse.disableShow()
    if !(@init)
      self.initSystem(nil)
    end
    @showCursor = false
    @cursor.visible = false
    return nil
  end
 
  #---------------------------------------------------------------------------
  # Sets a new bitmap for the cursor.
  #---------------------------------------------------------------------------    
 
  def Mouse.setCursor(filename, type = CURSOR_PIC, originX = 0, originY = 0)
    if !(@init)
      self.initSystem(nil)
    end
    @originX = originX
    @originY = originY
    case type
    when CURSOR_PIC
      @cursor.bitmap = RPG::Cache.picture(filename)
      @cursor.z = 999    
      return nil
    when CURSOR_ROOT
      @cursor.bitmap = Bitmap.new(filename)
      @cursor.z = 999
      return nil
    when CURSOR_BITMAP
      @cursor.bitmap = filename
      @cursor.z = 999
      return nil
    end
  end
 
  #---------------------------------------------------------------------------
  # Sets the x-coordinate of the cursor-picture origin.
  #---------------------------------------------------------------------------    
  def Mouse.setOriginX(originX)
    if !(@init)
      self.initSystem(nil)
    end
    @originX = originX
    return nil
  end
 
  #---------------------------------------------------------------------------
  # Sets the y-coordinate of the cursor-picture origin.
  #---------------------------------------------------------------------------    
  def Mouse.setOriginY(originY)
    if !(@init)
      self.initSystem(nil)
    end
    @originY = originY
    return nil
  end
 
  #---------------------------------------------------------------------------
  # Updates the position of the mouse-cursor on screen.
  #---------------------------------------------------------------------------    
  def Mouse.update()
    if !(@init)
      self.initSystem(nil)
    end
    if (@showCursor)
      if Mouse.x() != nil
        @cursor.x = Mouse.x() - @originX
      end
      if Mouse.y() != nil
        @cursor.y = Mouse.y() - @originY
      end
    end
    if ((@saveToGame) && (@gameX != nil) && (@gameY != nil))
      $game_variables[@gameX] = Mouse.x()
      $game_variables[@gameY] = Mouse.y()
    end
    return nil
  end
 
#===============================================================================  
# Private methods start here
# Do not call them directly.
# Edit them only if you know what you are doing.
#===============================================================================  
 
  #---------------------------------------------------------------------------
  # Calculates mouse position inside the programms window.
  #---------------------------------------------------------------------------  
  def Mouse.mousePos(catch_anywhere = false)
    x, y = Mouse.screenToClient(*Mouse.getPos)
    width, height = Mouse.clientSize()
    if ((x == nil) || (y == nil))
      return nil
    end
    if ((catch_anywhere) || ((x >= 0) && (y >= 0) && (x < width) && (y < height)))
      return x, y
    else
      return nil
    end
  end
 
  #---------------------------------------------------------------------------
  # Gets mouse position from OS.
  #---------------------------------------------------------------------------  
  def Mouse.getPos()
    if !(@init)
      Mouse.initSystem(nil)
    end
    pos = [0, 0].pack('ll')
    if @getCursorPos.call(pos) != 0
      return pos.unpack('ll')
    else
      return nil
    end
  end
 
  #---------------------------------------------------------------------------
  # Transforms screen-coordinates in client-coordinates.
  #---------------------------------------------------------------------------    
  def Mouse.screenToClient(x, y)
    if !(@init)
      self.initSystem(nil)
    end
    return nil unless x and y
    pos = [x, y].pack('ll')
    if @scr2cli.call(@handle, pos) != 0
      return pos.unpack('ll')
    else
      return nil
    end
  end
 
  #---------------------------------------------------------------------------
  # Gets the client size from OS.
  #---------------------------------------------------------------------------    
  def Mouse.clientSize()
    if !(@init)
      self.initSystem(nil)
    end
    rect = [0, 0, 0, 0].pack('l4')
    @client_rect.call(@handle, rect)
    right, bottom = rect.unpack('l4')[2..3]
    return right, bottom
  end
 
  #---------------------------------------------------------------------------
  # Gets the windows handle from OS.
  #---------------------------------------------------------------------------    
  def Mouse.getHandle()
    if !(@init)
      self.initSystem(nil)
    end
    gameName = "\0" * 256
    @readini.call('Game', 'Title', '', gameName, 255, ".\\Game.ini")
    gameName.delete!("\0")
    if ($DEBUG)
      # Only one RGSS Player should be open
      result = @findwindow.call('RGSS Player', 0) 
    else
      result = @findwindow.call('RGSS Player', gameName)
    end
    return result
  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

3

Mittwoch, 28. Juli 2010, 19:28

also unter aktivieren verstehe ich so, das ich es genau dann aktivieren wann ich es brauche mit der scriptfunktion.
besser gesagt das ich es dann aktivieren kann wen man auf der Karte ist
Bild


Reborn

hat beim Stromkonzern schon Rabatt

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

  • Nachricht senden

4

Mittwoch, 28. Juli 2010, 19:38

Was stellst du dir denn vor was das Mausscript kann? Das was ich dir da oben geschickt habe, kann nur die aktuelle Mausposition und ob eine Taste geklickt wurde oder eben nicht geklickt wurde abfragen.
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, 29. Juli 2010, 06:54

man soll damit laufen können (auf den Boden klicken) und Normale sachen machen können die sonst mit der Entertaste auch gehen.
Wenns im Menü geht wäre ich auch Froh, aber das habe ich mit Bilder gemacht, kp ob das auch geht...
Bild


6

Donnerstag, 29. Juli 2010, 13:46

Ist ja witzig, wenn ich in die Forensuche "Mit der Maus steuern" eingebe, den Haken bei "exakter Treffer" wegmache und auf [Suchen] klicke... dann find ich ganz viele Threads die diese Frage beantworten :D

Beispiel: Maussteuerung

7

Donnerstag, 29. Juli 2010, 15:30

öhm jane...ja....ne...ne! xD
mein titelscript funktioniert dann nicht mehr, und wenn ich mein titelscript rausnehme kommt eine fehlermeldung in window message zeile 277
...
.meine frage, gibt es ein skript das überhaupt mit xas funktioniert?
Bild


8

Donnerstag, 29. Juli 2010, 15:40

1.) Wenn du wirklich Hilfe willst, dann nenn die genaue Fehlerbeschreibung - selbst wenn du damit nichts anfangen kannst, jeder der sich in RGSS Auskennt, dem hilft die Fehlerbeschreibung (das ist der Text in der MessageBox die erscheint) weiter. Und nenn die neu eingefügten Scripte.
2.) Das XAS funktioniert afaik mit keinem Mausscript

Ähnliche Themen

Social Bookmarks