[XP] RPG Maker XP Online System (RMX-OS)

Started by Blizzard, June 20, 2009, 11:52:23 am

Previous topic - Next topic

Rickpwns

Quote from: Blizzard on July 28, 2012, 05:51:36 am
Then I think I know what's causing the problem. For some reason your keyboard sends multiple characters when you press keys. Sure, a non-ASCII character is ok to have multiple characters since it's encoded in UTF8, but others shouldn't be doing that. I'll take a look at this, but I'm not really sure if it's fixable at all.

EDIT: Actually I think I found the problem. :) I'll put up v1.21 over the course of the day.

EDIT: There you go. I couldn't test it myself, because my keyboard only sends 2-byte Unicode characters. It was basically a bug that was caused by a mistake I made when updating the input module to properly support 4-byte Unicode characters. One piece of code was still assuming 2-byte characters.

Keep in mind that you may need a proper font for 4 byte Unicode characters.

And also, this here:

Quote from: Rickpwns on July 27, 2012, 05:47:52 pm
Also, if you type your password, each character makes 2 *'s.


This is what gave me the idea what could be wrong.


Pleasure to help.
Allow me to find more bugs.

Rickpwns

It seems I can't even click on the Password, your type cursor just stays at the username.

Also, I can not click 'Cancel' 'Register' etc.

ShinoTakadora

Quote from: Rickpwns on July 28, 2012, 05:37:49 pm
It seems I can't even click on the Password, your type cursor just stays at the username.

Also, I can not click 'Cancel' 'Register' etc.



Quite simply, you are trying to control the mouse, and in RPG Maker XP there is no control with the mouse)

Blizzard

If you want mouse control in RMX-OS, use this script: http://forum.chaos-project.com/index.php?topic=4710.0
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

khkramer

Is this the right place to post?

The bug I mentioned earlier in the RMXP Converter thread also occurs on a fresh copy of RMX-OS without any modifications. (Version 1.21)
I should note when using the RGSS or RGSS2 player it works fine but when I use the RGSS3 player the same bug occurs.
Maybe it has something to do with the newer ruby versions?

Blizzard

Very likely. I am actually quite surprised that RMX-OS works with RGSS2, because it was not coded specifically to do that. It's only supposed to work with RGSS.
I'll try to come up with a solution. You can then test it out and if it works, I can add it to the official release.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

khkramer

Yeah I was pretty surprised too when I found out it was working with the RGSS2 player.
Anyways, I hope you find a solution. (I desperately need the performance increase from ARC)

Blizzard

July 30, 2012, 12:26:49 pm #1367 Last Edit: July 30, 2012, 12:28:53 pm by Blizzard
Alright, here we go. Substitute the entire Input module of RMX-OS with this one and let me know if it works.

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Custom Game Controls by Blizzard
# Version: 4.2 RMX-OS Edition
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatiblity:
#
#   99% compatible with SDK 1.x, 90% compatible with SDK 2.x.
#
#
# Note:
#
#   Why is this input module better than others? I has far less code and it
#   can handle keyboard language layout.
#
#
# Explanation & Configuration:
#
#   This Add-on will allow you to specify your own game controls. Just below
#   is a list of possible keys, below that is the configuration. The default
#   configuration is RMXP's real game control configuration. You can add any
#   key specification into a key array and separate them with commas. Example:
#  
#   RIGHT = [Key['Arrow Right'], Key[','], Key['F'], Key['Ctrl'], Key['3'],
#            Key['NumberPad 6'], Key['F3'], Key['\''], Key['\\']]
#  
#   This example would assign for the RIGHT button the following keys:
#   - directional right (right arrow key)
#   - comma
#   - letter key F
#   - Control key (CTRL)
#   - Number Key 3 (on top over the letter keys)
#   - Numberpad Key 6 (number 6 on the numberpad on the right)
#   - Functional Key 3 (F3)
#   - apostrophe (')
#   - backslash (\)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

if !$tons_version || !TONS_OF_ADDONS::CUSTOM_CONTROLS
 
#==============================================================================
# module Input
#==============================================================================

module Input
 
 #----------------------------------------------------------------------------
 # Simple ASCII table
 #----------------------------------------------------------------------------
 Key = {'A' => 65, 'B' => 66, 'C' => 67, 'D' => 68, 'E' => 69, 'F' => 70,
        'G' => 71, 'H' => 72, 'I' => 73, 'J' => 74, 'K' => 75, 'L' => 76,
        'M' => 77, 'N' => 78, 'O' => 79, 'P' => 80, 'Q' => 81, 'R' => 82,
        'S' => 83, 'T' => 84, 'U' => 85, 'V' => 86, 'W' => 87, 'X' => 88,
        'Y' => 89, 'Z' => 90,
        '0' => 48, '1' => 49, '2' => 50, '3' => 51, '4' => 52, '5' => 53,
        '6' => 54, '7' => 55, '8' => 56, '9' => 57,
        '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,
        'F1' => 112, 'F2' => 113, 'F3' => 114, 'F4' => 115, 'F5' => 116,
        'F6' => 117, 'F7' => 118, 'F8' => 119, 'F9' => 120, 'F10' => 121,
        'F11' => 122, 'F12' => 123,
        ';' => 186, '=' => 187, ',' => 188, '-' => 189, '.' => 190, '/' => 220,
        '\\' => 191, '\'' => 222, '[' => 219, ']' => 221, '`' => 192,
        'Backspace' => 8, 'Tab' => 9, 'Enter' => 13, 'Shift' => 16,
        'Left Shift' => 160, 'Right Shift' => 161, 'Left Ctrl' => 162,
        'Right Ctrl' => 163, 'Left Alt' => 164, 'Right Alt' => 165,
        'Ctrl' => 17, 'Alt' => 18, 'Esc' => 27, 'Space' => 32, 'Page Up' => 33,
        'Page Down' => 34, 'End' => 35, 'Home' => 36, 'Insert' => 45,
        'Delete' => 46, 'Arrow Left' => 37, 'Arrow Up' => 38,
        'Arrow Right' => 39, 'Arrow Down' => 40,
        'Mouse Left' => 1, 'Mouse Right' => 2, 'Mouse Middle' => 4,
        'Mouse 4' => 5, 'Mouse 5' => 6}
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 UP = [Key['Arrow Up']]
 LEFT = [Key['Arrow Left']]
 DOWN = [Key['Arrow Down']]
 RIGHT = [Key['Arrow Right']]
 A = [Key['Shift']]
 B = [Key['Esc']]
 C = [Key['Enter']]
 X = []
 Y = []
 Z = []
 L = [Key['Page Down']]
 R = [Key['Page Up']]
 F5 = [Key['F5']]
 F6 = [Key['F6']]
 F7 = [Key['F7']]
 F8 = [Key['F8']]
 F9 = [Key['F9']]
 SHIFT = [Key['Shift']]
 CTRL = [Key['Ctrl']]
 ALT = [Key['Alt']]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 # All keys
 KEY_COUNT = 256
 ALL_KEYS = (0...KEY_COUNT).to_a
 # Win32 API calls
 GetKeyboardState = Win32API.new('user32', 'GetKeyboardState', 'P', 'I')
 GetKeyboardLayout = Win32API.new('user32', 'GetKeyboardLayout', 'L', 'L')
 MapVirtualKeyEx = Win32API.new('user32', 'MapVirtualKeyEx', 'IIL', 'I')
 ToUnicodeEx = Win32API.new('user32', 'ToUnicodeEx', 'LLPPILL', 'L')
 # some other constants
 DOWN_STATE_MASK = 0x80
 DEAD_KEY_MASK = 0x80000000
 # data
 @state = "\0" * KEY_COUNT
 @triggered = Array.new(KEY_COUNT, false)
 @pressed = Array.new(KEY_COUNT, false)
 @released = Array.new(KEY_COUNT, false)
 @repeatedKey = -1
 @repeatedCount = 0
 #----------------------------------------------------------------------------
 # update
 #  Updates input.
 #----------------------------------------------------------------------------
 def self.update
   # get current language layout
   @language_layout = GetKeyboardLayout.call(0)
   # get new keyboard state
   GetKeyboardState.call(@state)
   # this special code is used because Ruby 1.9.x does not return a char
   # when using String#[] but another String
   key = 0
   @state.each_byte {|byte|
       # if pressed state
       if (byte & DOWN_STATE_MASK) == DOWN_STATE_MASK
         # not released anymore
         @released[key] = false
         # if not pressed yet
         if !@pressed[key]
           # pressed and triggered
           @pressed[key] = true
           @triggered[key] = true
           @repeatedKey = key
           @repeatedCount = 0
         else
           # not triggered anymore
           @triggered[key] = false
         end
         # update of repeat counter
         if key == @repeatedKey
           @repeatedCount < 17 ? @repeatedCount += 1 : @repeatedCount = 15
         end
       # not released yet
       elsif !@released[key]
         # if still pressed
         if @pressed[key]
           # not triggered, pressed or repeated, but released
           @triggered[key] = false
           @pressed[key] = false
           @released[key] = true
           if key == @repeatedKey
             @repeatedKey = -1
             @repeatedCount = 0
           end
         end
       else
         # not released anymore
         @released[key] = false
       end
       key += 1}
 end
 #----------------------------------------------------------------------------
 # dir4
 #  4 direction check.
 #----------------------------------------------------------------------------
 def self.dir4
   return 2 if self.press?(DOWN)
   return 4 if self.press?(LEFT)
   return 6 if self.press?(RIGHT)
   return 8 if self.press?(UP)
   return 0
 end
 #----------------------------------------------------------------------------
 # dir8
 #  8 direction check.
 #----------------------------------------------------------------------------
 def self.dir8
   down = self.press?(DOWN)
   left = self.press?(LEFT)
   return 1 if down && left
   right = self.press?(RIGHT)
   return 3 if down && right
   up = self.press?(UP)
   return 7 if up && left
   return 9 if up && right
   return 2 if down
   return 4 if left
   return 6 if right
   return 8 if up
   return 0
 end
 #----------------------------------------------------------------------------
 # trigger?
 #  Test if key was triggered once.
 #----------------------------------------------------------------------------
 def self.trigger?(keys)
   keys = [keys] if !keys.is_a?(Array)
   return keys.any? {|key| @triggered[key]}
 end
 #----------------------------------------------------------------------------
 # press?
 #  Test if key is being pressed.
 #----------------------------------------------------------------------------
 def self.press?(keys)
   keys = [keys] if !keys.is_a?(Array)
   return keys.any? {|key| @pressed[key]}
 end
 #----------------------------------------------------------------------------
 # repeat?
 #  Test if key is being pressed for repeating.
 #----------------------------------------------------------------------------
 def self.repeat?(keys)
   keys = [keys] if !keys.is_a?(Array)
   return (@repeatedKey >= 0 && keys.include?(@repeatedKey) &&
       (@repeatedCount == 1 || @repeatedCount == 16))
 end
 #----------------------------------------------------------------------------
 # release?
 #  Test if key was released.
 #----------------------------------------------------------------------------
 def self.release?(keys)
   keys = [keys] if !keys.is_a?(Array)
   return keys.any? {|key| @released[key]}
 end
 #----------------------------------------------------------------------------
 # get_character
 #  vk - virtual key
 #  Gets the character from keyboard input using the input locale identifier
 #  (formerly called keyboard layout handles).
 #----------------------------------------------------------------------------
 def self.get_character(vk)
   # get corresponding character from virtual key
   c = MapVirtualKeyEx.call(vk, 2, @language_layout)
   # stop if character is non-printable and not a dead key
   return '' if c < 32 && (c & DEAD_KEY_MASK) != DEAD_KEY_MASK
   # get scan code
   vsc = MapVirtualKeyEx.call(vk, 0, @language_layout)
   # result string is never longer than 4 bytes (Unicode)
   result = "\0" * 4
   # get input string from Win32 API
   length = ToUnicodeEx.call(vk, vsc, @state, result, 4, 0, @language_layout)
   return (length == 0 ? '' : result)
 end
 #----------------------------------------------------------------------------
 # get_input_string
 #  Gets the string that was entered using the keyboard over the input locale
 #  identifier (formerly called keyboard layout handles).
 #----------------------------------------------------------------------------
 def self.get_input_string
   result = ''
   # check every key
   ALL_KEYS.each {|key|
       # if repeated
       if self.repeat?(key)
         # get character from keyboard state
         c = self.get_character(key)
         # add character if there is a character
         result += c if c != ''
       end}
   # empty if result is empty
   return '' if result == ''
   # convert string from Unicode to UTF-8
   return self.unicode_to_utf8(result)
 end
 #----------------------------------------------------------------------------
 # unicode_to_utf8
 #  string - string in Unicode format
 #  Converts a string from Unicode format to UTF-8 format as RGSS does not
 #  support Unicode.
 #----------------------------------------------------------------------------
 def self.unicode_to_utf8(string)
   result = ''
   # L* format means a bunch of 4-byte wide-chars
   string.unpack('L*').each {|c|
       # characters under 0x80 are 1 byte characters
       if c < 0x0080
         result += c.chr
       # other characters under 0x800 are 2 byte characters
       elsif c < 0x0800
         result += (0xC0 | (c >> 6)).chr
         result += (0x80 | (c & 0x3F)).chr
       # other characters under 0x10000 are 3 byte characters
       elsif c < 0x10000
         result += (0xE0 | (c >> 12)).chr
         result += (0x80 | ((c >> 6) & 0x3F)).chr
         result += (0x80 | (c & 0x3F)).chr
       # other characters under 0x200000 are 4 byte characters
       elsif c < 0x200000
         result += (0xF0 | (c >> 18)).chr
         result += (0x80 | ((c >> 12) & 0x3F)).chr
         result += (0x80 | ((c >> 6) & 0x3F)).chr
         result += (0x80 | (c & 0x3F)).chr
       # other characters under 0x4000000 are 5 byte characters
       elsif c < 0x4000000
         result += (0xF8 | (c >> 24)).chr
         result += (0x80 | ((c >> 18) & 0x3F)).chr
         result += (0x80 | ((c >> 12) & 0x3F)).chr
         result += (0x80 | ((c >> 6) & 0x3F)).chr
         result += (0x80 | (c & 0x3F)).chr
       # other characters under 0x80000000 are 6 byte characters
       elsif c < 0x80000000
         result += (0xFC | (c >> 30)).chr
         result += (0x80 | ((c >> 24) & 0x3F)).chr
         result += (0x80 | ((c >> 18) & 0x3F)).chr
         result += (0x80 | ((c >> 12) & 0x3F)).chr
         result += (0x80 | ((c >> 6) & 0x3F)).chr
         result += (0x80 | (c & 0x3F)).chr
       end}
   return result
 end

end

end


In Ruby 1.9.x the method String#[] does not return a byte anymore. Instead, it returns a string. That's why you are getting that error which also reminded me where I saw this error previously. I got it when I tried running Terranigma 2 on ARC which also uses my Input module. This edited Input module should take care of the problem while still maintaining compatibility with Ruby 1.8.x
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

khkramer

July 30, 2012, 12:32:05 pm #1368 Last Edit: July 30, 2012, 01:33:40 pm by khkramer
YOURETHEBEST
Works like a charm :D
edit: yeah I did read something about the string function changed in Ruby 1.9.x from 1.8 but I had no idea how to fix it myself.
Unfortunately I have found another bug/error...
When using ARC the servers always show as Offline thus the player cannot connect.
In RMXP the server shows as Online.
Any idea how to fix this?


Blizzard

July 30, 2012, 01:36:59 pm #1369 Last Edit: July 30, 2012, 04:22:04 pm by Blizzard
I'm putting together a new build of ARC and then I'll test it.

EDIT: I found the problem. It was basically the same reason: String encoding.

I have uploaded a fixed 1.21 that should work fine with ARC. But you also have to update one of ARC's files. Open Data/RMXP.rb and replace the entire code there with this:

Spoiler: ShowHide
# this makes sure that Kernel#require and Kernel#load don't need (but still accept) a full path anymore
$:.clear
$:.push(Dir.getwd)

# wrapper for RMXP's Win32API class
class Win32API
 
 LIMIT_L = 4294967296
 LIMIT_S = 65536
 LIMIT_C = 256
 
 def initialize(dllname, func, import, export = "0", calltype = :stdcall)
   import = import.join('') if import.is_a?(Array)
   export = export.join('') if export.is_a?(Array)
   @export = export.clone
   import.upcase!
   export.upcase!
   @api = Win32::API.new(func, import, export, dllname)
 end

 def call(*args)
   result = @api.call(*args)
   result -= LIMIT_L if @export == 'l' && result >= LIMIT_L / 2
   result -= LIMIT_S if @export == 's' && result >= LIMIT_S / 2
   result -= LIMIT_C if @export == 'c' && result >= LIMIT_C / 2
   return result
 end

 alias Call call
 
end


While at a first glance the different Win32API module in newer versions of Ruby seems superior, it turns out that it can't handle properly all data types. e.g. it only has the unsigned versions of the number data types such as unsigned char, unsigned short and unsigned long. It doesn't work with signed ones so the socket code wasn't even working right when I fixed the string problems because it would keep returning "4294967295" instead of "-1" in some functions. But with this code replaced and the new RMX-OS code, everything should be fine.

There are quite a few things that can go wrong here and I really don't have time to test each single command and server/client message. If you come across problems and/or crashes, let me know and I'll fix them.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

khkramer

July 30, 2012, 04:21:14 pm #1370 Last Edit: July 30, 2012, 05:04:28 pm by khkramer
Good luck! :D

EDIT: hmmm, updated rmxp.rb and rmx-os but server still shows as offline..
Could the problem be that I'm using an older version of the server selection scene? (I'm using it for compatibility with pokemon essentials)

Blizzard

It's possible.

I've just checked again to make sure everything is fine and it works in ARC without problems. The only thing that I could imagine would be that you may not be downloading the current version, but a version that your browser cached. Try emptying your browser cache and then redownload. You can easily find out if you have the fixed version. Use the search function to find $1.unpack('CCC'). If the text is not found, you're not using the new version.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

khkramer

July 31, 2012, 05:13:48 am #1372 Last Edit: July 31, 2012, 05:37:26 am by khkramer


Updated as you said, replaced rmxp.rb ,
$1.unpack('CCC')
is there in the rmx-os code.
Here is the modified part of the scene_servers:
def create_scene
   super
   # get all server names
   server_names = []
   RMXOS::Options::SERVERS.each {|server| server_names.push(server.name)}
   server_names.push(RMXOS::Data::Exit)
   # create server selection window
   @command_window = Window_CommandPokemon.new(server_names, 224) #(224, server_names)
   @command_window.x, @command_window.y = 64, 128
   @command_window.active = true
   @command_window.index = 0
   # create server states window
   states = []
   @server_states.size.times {states.push(RMXOS::Data::ServerOffline)}
   @online_window = Window_CommandPokemon.new(states, 224) #(224, states)
   @online_window.x, @online_window.y = 352, 128
   @online_window.active = false
   @online_window.index = -1
 end



EDIT: When I set my server ip to 127.0.0.1 and in my RMX-OS options, it suddenly works.
Could it be that ARC doesn't handle external ip's the right way?

Also looks like RMX-Os is starting to do funny stuff with comparisons:

Blizzard

RMX-OS uses Win32API calls for sockets so it should be working. I'll take a look at it.

That error is not because of RMX-OS, it's because of Ruby 1.9.x Strings. :/ I'll see if this can be fixed easily.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

khkramer

July 31, 2012, 12:27:53 pm #1374 Last Edit: July 31, 2012, 03:34:51 pm by khkramer
I'll take a look at the string problem, too.

EDIT: Converting the variables to integers fixes the error. (I think)
However, that means I'll have to add it to a lot of variables..
There should be an easier way to fix this.

Blizzard

August 01, 2012, 11:17:27 am #1375 Last Edit: August 01, 2012, 11:25:06 am by Blizzard
I checked it and I'm not entirely sure why you are getting that crash. The line is this one, right?

new = eval("#{classe.name}.new(#{args})")


args is taken from RMXOS::Options::CREATION_DATA of the given class. e.g.

Code: default creation data for Actors
CREATION_DATA[Game_Actor] = '1'


Now this is a string that should be interpreted as such and the final code in eval should be like this:

Game_Actor.new(1)


If you are getting errors like this, check your creation data. Maybe you use '1' instead of '"1"' (where the latter is a string) which then caused the problem.

As for the network not responding properly, guess what the problem was: String encoding again. :P I'll just finish up the edits in RMX-OS and upload 1.21 with the new fixes for ARC/Ruby 1.9.x again.

EDIT: There you go. Get the fixed version and keep on testing. Let me know when you encounter the next problem.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

khkramer

August 01, 2012, 11:52:11 am #1376 Last Edit: August 01, 2012, 03:04:58 pm by khkramer
Thanks for the fix, and I just found out the crash was not occuring because of RMX-OS but because of the Pokémon scripts.
I guess comparables have changed between 1.8 and 1.9 too.

EDIT:

Example:

It crashes with this:
# Gets the number of Exp Points needed to reach the given
# level with the given growth rate.
# growth -- Growth rate.
 def PBExperience.pbGetStartExperience(level,growth)
   if growth>=6 || growth<0
     return ArgumentError.new("The growth rate is invalid.")
   end
   if level.to_i<0
     return ArgumentError.new("The level is invalid.")
   end
   level=MAXLEVEL if level>MAXLEVEL
   return pbGetExpInternal(level,growth)
 end


But works if I change it to this:
# Gets the number of Exp Points needed to reach the given
# level with the given growth rate.
# growth -- Growth rate.
 def PBExperience.pbGetStartExperience(level,growth)
   if growth.to_i>=6 || growth.to_i<0
     return ArgumentError.new("The growth rate is invalid.")
   end
   if level.to_i<0
     return ArgumentError.new("The level is invalid.")
   end
   level=MAXLEVEL if level>MAXLEVEL
   return pbGetExpInternal(level,growth)
 end


Does that mean I would have to edit every comparison manually, or do you know an easier way?

Blizzard

How have you set up the CREATION_DATA option in RMX-OS?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

khkramer


    CREATION_DATA[PokeBattle_Trainer] = '\'\',\'\''
    CREATION_DATA[PokeBattle_Pokemon] = '1,1'
    CREATION_DATA[PokemonMail] = '\'\',\'\',\'\''
    CREATION_DATA[PokemonBox] = '\'\''
    CREATION_DATA[PBMove] = '1'

Blizzard

Comparison of a string using <, >, => or <= didn't work in Ruby 1.8.x either. But it seems that some data may not be saved as it should.
I don't know if the save data format makes much sense to you, but it would be good if you code find the database entry that is causing that crash and then check whether the growth variable was stored as a string with "" or just as an integer.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.