Kain Nobel
Member
Some of you already know that I'm making a Game Serial prompt, but I have a problem... the half working version of Game_System (modified) that goes into the script has been overwritten, but I had to re-code it anyways... theres still an older version on this topic if you need to look at anything for reference.
So here is the way I am doing the 'semi-random code' stuff, it handles it through arrays 'n all that fun stuff... arrays and text.gsub! methods are new to me, and I'm not even sure if this is coded right. Please tell me anything that you might know or how to better code the method if I'm doing something wrong.
mechacrash mentioned using WinAPI and writting it to the registry 'n stuff, however I ponder that this might be better handled from within the encrypted game itself, just writting it to Activation.rxdata within the Data/ folder of an encrypted project. However, I wrote a line similiar to this one...
Which supposedly can handle encrypted file data, according to the help file, and it errors. Any ideas on what I have to do to get that to work? (I've only tested it in an un-encrypted project).
Also, critique on the new Game_System code generating functions would be helpful too, I haven't had time to test it. I'm off to work, thanks ahead of time to anybody who can help me (again).
Also, handle using WinAPI and writting to registry, or just handling it within the game files themselves... what you think would be better? (I have no knowledge of RGSS + WinAPI so that would involve some extra help.)
So here is the way I am doing the 'semi-random code' stuff, it handles it through arrays 'n all that fun stuff... arrays and text.gsub! methods are new to me, and I'm not even sure if this is coded right. Please tell me anything that you might know or how to better code the method if I'm doing something wrong.
Code:
Key_A = '9'
Key_B = '8'
Key_C = '7'
Key_D = '6'
Key_E = '5'
Key_F = '4'
Key_G = '3'
Key_H = '2'
Key_I = '1'
Key_J = '0'
Key_K = 'Z'
Key_L = 'Y'
Key_M = 'X'
Key_N = 'W'
Key_O = 'V'
Key_P = 'U'
Key_Q = 'T'
Key_R = 'S'
Key_S = 'R'
Key_T = 'Q'
Key_U = 'P'
Key_V = 'O'
Key_W = 'N'
Key_X = 'M'
Key_Y = 'L'
Key_Z = 'K'
Key_1 = 'J'
Key_2 = 'I'
Key_3 = 'H'
Key_4 = 'G'
Key_5 = 'F'
Key_6 = 'E'
Key_7 = 'D'
Key_8 = 'C'
Key_9 = 'B'
Key_0 = 'A'
class Game_System
 #[Attributes]-----------------------------------------------------------------
 attr_accessor :serial_number
 attr_accessor :product_number
 #[Alias Methods]
 alias_method :kn_activation_game_system_initialize, :initialize
 #--------------------
 # * Initialize Method
 #--------------------
 def initialize
  kn_activation_game_system_initialize
  @serial = nil
  @product = nil
  @key_codes = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
         'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
         'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
  codes_validated
 end
 #---------------------------
 # * Check if Codes Validated
 #---------------------------
 def codes_validated
  if FileTest.exist?(filename) == true
   $data_activation = Activation_File + .new
   @serial = $data_activation.serial_number
   @product = $data_activation.product_number
   if @serial != nil or @product != nil
    serial_number
   end
  end
 end
 #------------------
 # * Generate Serial
 #------------------
 def serial_number(digits_max)
  @serial = serial_number
  @digits_max = Activation_DigitsMax
  for i in 0..@serial.digits_max
   until @digits_max == 0
    @serial.push(rand[@key_codes])
    @digits_max -= 1
   end
   return @serial
   product_number
  end
 end
 #-------------------
 # * Generate Product
 #-------------------
 def product_number(digits_max)
  @digits_max = Activation_DigitsMax
  @product = serial_number
  for i in 0..@product.digits_max
   until @digits_max == 0
    @product.sub_code_text
    @digits_max -= 1
   end
   return @product
   codes_validated = true
  end
 end
 #-------------------
 # * Sub Code Text
 #-------------------
 def sub_code_text
  @text.gsub!(/[1]/) do Key_1 end
  @text.gsub!(/[2]/) do Key_2 end
  @text.gsub!(/[3]/) do Key_3 end
  @text.gsub!(/[4]/) do Key_4 end
  @text.gsub!(/[5]/) do Key_5 end
  @text.gsub!(/[6]/) do Key_6 end
  @text.gsub!(/[7]/) do Key_7 end
  @text.gsub!(/[8]/) do Key_8 end
  @text.gsub!(/[9]/) do Key_9 end
  @text.gsub!(/[0]/) do Key_0 end
  @text.gsub!(/[Aa]/) do Key_A end
  @text.gsub!(/[Bb]/) do Key_B end
  @text.gsub!(/[Cc]/) do Key_C end
  @text.gsub!(/[Dd]/) do Key_D end
  @text.gsub!(/[Ee]/) do Key_E end
  @text.gsub!(/[Ff]/) do Key_F end
  @text.gsub!(/[Gg]/) do Key_G end
  @text.gsub!(/[Hh]/) do Key_H end
  @text.gsub!(/[Ii]/) do Key_I end
  @text.gsub!(/[Jj]/) do Key_J end
  @text.gsub!(/[Kk]/) do Key_K end
  @text.gsub!(/[Ll]/) do Key_L end
  @text.gsub!(/[Mm]/) do Key_M end
  @text.gsub!(/[Nn]/) do Key_N end
  @text.gsub!(/[Oo]/) do Key_O end
  @text.gsub!(/[Pp]/) do Key_P end
  @text.gsub!(/[Qq]/) do Key_Q end
  @text.gsub!(/[Rr]/) do Key_R end
  @text.gsub!(/[Ss]/) do Key_S end
  @text.gsub!(/[Tt]/) do Key_T end
  @text.gsub!(/[Uu]/) do Key_U end
  @text.gsub!(/[Vv]/) do Key_V end
  @text.gsub!(/[Ww]/) do Key_W end
  @text.gsub!(/[Xx]/) do Key_X end
  @text.gsub!(/[Yy]/) do Key_Y end
  @text.gsub!(/[Zz]/) do Key_Z end
 end
end
mechacrash mentioned using WinAPI and writting it to the registry 'n stuff, however I ponder that this might be better handled from within the encrypted game itself, just writting it to Activation.rxdata within the Data/ folder of an encrypted project. However, I wrote a line similiar to this one...
Code:
Activation_File = 'Activation'
#...
filename = Activation_File + .new
File.open(filename, "rb") { |f|
 obj = Marshal.load(f)
}
Which supposedly can handle encrypted file data, according to the help file, and it errors. Any ideas on what I have to do to get that to work? (I've only tested it in an un-encrypted project).
Also, critique on the new Game_System code generating functions would be helpful too, I haven't had time to test it. I'm off to work, thanks ahead of time to anybody who can help me (again).
Also, handle using WinAPI and writting to registry, or just handling it within the game files themselves... what you think would be better? (I have no knowledge of RGSS + WinAPI so that would involve some extra help.)