Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Scene_Activation script - by Kain Nobel (help topic)

Out of bordom (and reading the other guy's post about a script of the same nature), I've decided writting my own Serial Activation script would be a cool idea, so I'm posting a new topic for it so I can get coaching and guidance to writting it. I'm a newbie scripter still, so this is like a "Teach me how to..." topic, special thanks to everybody who participates in helping me learn ;)

Please note that this is an origional script in progress, meaning I'm currently working on it the same time I'm writting my topic, so this is in no way based off any other script of the same nature, its 100% origional, and you're helping me learn how to script it ;)

If you add more to this script, let me know before you post 'your' work because this is supposed to be 'my learning experience', so don't spoil it for me, k? Thanks ;)

[spoiler="Activation Code" script]I just barely started, I'll show you a small sample of what I got done in less than a minute... I need you to help me so I can fill out the rest ;)

Code:
#= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# * Commercial Product Key #
#- - - - - - - - - - - - - #
# Written by: Kain Nobel
# Version: 0.x?
# Last Update: n/a
# Date Created: 4/30/2008
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SERIAL_DEBUG = true
#= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# * Scene_Serial
#= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
class Scene_Serial
  #========================
  # * Initialization Method
  #========================
  def initialize(product_key)
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # $DEBUG mode?
    if $DEBUG == true && SERIAL_DEBUG == false
      #$scene = Scene_Splash.new #<--Works if using my Splash script.
      $scene = Scene_Title.new
    end
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Load the System database & create a new game
    $data_system = load_data("Data/System.rxdata")
    $game_system = Game_System.new
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Initialize product key information
    @serial = [@s_rand01, @s_rand02, @s_rand03, @s_rand04]
    @product = [@p_rand01, @p_rand02, @p_rand03, @p_rand04]
    @activation = [@key01, @key02, @key03, @key04]
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Randomize Serial and Product keys
    @serial_rand = rand(1..5)
    # Call 'main' method
    check_product_key
  end
  #====================
  # * Check Product Key
  #====================
  def check_product_key
    # Test if "Product Key" file exists
    if $game_system.activation_key == true
      product_registered
    else
      activate_product_key
    end
  end
  #=======================
  # * Activate Product Key
  #=======================
  def activate_product_key
    # Determines a Random Serial Number
    case @serial_rand
    when 1
      # Serial
      @s_rand01 = '4TFS4'
      @s_rand02 = '19STS'
      @s_rand03 = '9T1AC'
      @s_rand04 = '42069'
      # Product
      @p_rand01 = 'DBCD4'
      @p_rand02 = '1F59C'
      @p_rand03 = 'L9BNS'
      @p_rand04 = 'ASD7D'
    when 2
      # Serial
      @s_rand01 = 'TF479'
      @s_rand02 = '549F7'
      @s_rand03 = 'B1979
      @s_rand04 = 'FBI50'
      # Product
      @p_rand01 = 'DSF5S'
      @p_rand02 = 'EDF8R'
      @p_rand03 = '56SD5'
      @p_rand04 = '6SDF8'
    when 3
      # Serial
      @s_rand01 = '05IBF'
      @s_rand02 = 'CDBCC'
      @s_rand03 = 'ILF0D'
      @s_rand04 = 'EDBC4'
      # Product
      @p_rand01 = 'SD2B4'
      @p_rand02 = '45KI8'
      @p_rand03 = 'GFTR8'
      @p_rand04 = '3TRJ4'
    when 4
      # Serial
      @s_rand01 = 'L3M0N'
      @s_rand02 = 'H34DS'
      @s_rand03 = 'FUCKN'
      @s_rand04 = 'RUL3S'
      # Product
      @p_rand01 = 'D948J'
      @p_rand02 = 'XC4NF'
      @p_rand03 = 'D45NM'
      @p_rand04 = 'C84N8'
    when 5
      # Serial
      @s_rand01 = 'ILIKE'
      @s_rand02 = 'BIGG0'
      @s_rand03 = 'BUTTS'
      @s_rand05 = 'FO0L5'
      # Product
      @p_rand01 = '9I48N'
      @p_rand02 = 'E8J9D'
      @p_rand03 = 'C845N'
      @p_rand04 = 'XC94F'
    end
  end
end
[/spoiler]

QUESTION #1

Upon initialization, the script is supposed to refer to System.rxdata, and its supposed to do one of two things...
1.) It checks if product key and serial have been recorded onto System.rxdata

2.) If not, it writes one of the random pairs of Serial and Product keys to System.rxdata

3.) If Serial/Product has already been written to file previously, all you have to do is enter an activation code (just like when you bought RPGXP, remember? X_x)

How would I do this? I don't want it to write the 'random' code if there's already a code assigned into the System.rxdata file. On that note, since any project that would use this would most likely be an encrypted "commercial" project, is there going to be any problems writting the info to System.rxdata?

Question #2

I want this script to call a Window (namely "Window_Activation") on Scene_Title, when you select New Game/Continue, which will have you type in the "Activation" code. How would I set this up (with some kinda keyboard script, like Aleworks Key lite or whatever) so you can type the code on the window?


Sorry, I maybe a newbie scripter, but I try to exercize all of my knowledge as possible when making a script.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top