I would like a script that adds a vairiable every time you select the option Free trial. One that vairiable reaches 10 it disables free trial. Like how continue is disabled. Leaving the options Activate and end. I am using this script for activation.
Code:
#==============================================================================
# ** Scene_Serial - Based In Scene_Register from Netplay+
#------------------------------------------------------------------------------
# Author Mr.Mo and Me?, modified by Chaosg1
# Version 1.0
# Date 14-12-06
#==============================================================================
class Scene_Register
def initialize
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# Make system object
$game_system = Game_System.new
@code = Codex.new
#saves the File To create only one serial
begin
file = File.open("Serial.rxdata", "rb")
a = Marshal.load(file)
file.close
@serial = a
rescue #Loads the file
@serial = @code.generate_code
p @serial,@code.decode(@serial) if $DEBUG
file = File.open("Serial.rxdata", "wb")
Marshal.dump(@serial, file)
file.close
a = @serial
end
@wserial = Window_Help.new
@wserial.set_text("Your Id is: " + a.values.to_s + ", insert the serial below")
end
#--------------------------------------------------------------------------
# Main Processing
#--------------------------------------------------------------------------
def main
@user_window = Window_Username.new
@user_window.active = true
@user_window.width = 100*2 + 180
#sets necassary variables
@user_name = []
# Graphic Transition.
Graphics.transition
# Srarts LOOP Update.
loop do
# Update
Input.update
Graphics.update
update
#Checks if the scene self.
if $scene != self
#If not break.
break
end
end
# Wait.
Graphics.freeze
# Dispose stuff.
@user_window.dispose
@wserial.dispose
end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
def update
#Updates Windows.
@user_window.update
#Updates User Name or Password
update_user
if $DEBUG
p (@code.decode(@serial)).values if Input.triggerd?(Input::Letters["A"])
p @code.decode(@serial) if Input.triggerd?(Input::Letters["B"])
end
end
#--------------------------------------------------------------------------
# Check Code
#--------------------------------------------------------------------------
def check
p @user_name, (@code.decode(@serial)).values if $DEBUG
if @user_name == (@code.decode(@serial)).values
p Code::OK_Message
$scene = Scene_Title.new
else
p Code::Wrong_Message
$scene = nil
end
end
#--------------------------------------------------------------------------
# Update User
#--------------------------------------------------------------------------
def update_user
if Input.triggerd?(Input::Enter)
p "Insert Serial" if @user_name == []
return if @user_name == []
check
end
#Checks for backspace.
@user_name.delete_at(-1) if Input.triggerd?(Input::Back) and @user_name.size != 0
return if @user_name.size == Code::Code_Size
#Checks for Numberkeys input.
for key in Input::Numberkeys.keys
@user_name.push(key.to_s) if Input.triggerd?(Input::Numberkeys[key])
end
#Checks for Letter input.
for key in Input::Letters.keys
if Input.triggerd?(Input::Letters[key])
if Input.pressed?(Input::Shift)
@user_name.push(key.upcase)
else
@user_name.push(key.downcase)
end
end
end
#Checks for Underscore
if Input.triggerd?(Input::Underscore)
if Input.pressed?(Input::Shift)
@user_name.push("_")
else
@user_name.push("-")
end
end
@user_window.text = @user_name.to_s
@user_window.update
return
#ends method
end
#--------------------------------------------------------------------------
# End Of class
#--------------------------------------------------------------------------
end
Code:
#==============================================================================
# ** Codex
#------------------------------------------------------------------------------
# Version 1.0 (
# Author: Chaosg1(RMXP.org) aka Dr.X
# Date : 05-11-2006
#==============================================================================--------------------------------------------
# NOTE: THIS IS EXCLUSIVE TO RMXP.org!!
#------------------------------------------------------------------------------
module Code
OK_Message = "Serial Accepted!"
Wrong_Message = "Wrong serial, game will close."
#The Generated code Size (Recomended no less than 8)
Code_Size = 2
#Holds the desencription code.
Code = {}
Code = {
#Encryption 1
0 => {'a'=>'c', 'b'=>'h', 'c'=>'a', 'd'=>'o', 'e'=>'s',
'f'=>'b', 'g'=>'d', 'h'=>'e', 'i'=>'f', 'j'=>'g',
'k'=>'i', 'l'=>'j', 'm'=>'k', 'n'=>'l', 'o'=>'m',
'p'=>'n', 'q'=>'p', 'r'=>'q', 's'=>'r', 't'=>'t',
'u'=>'u', 'v'=>'v', 'w'=>'w', 'x'=>'x', 'y'=>'y',
'z'=>'z'},
#Encryption 2
1 => {'a'=>'b', 'b'=>'d', 'c'=>'e', 'd'=>'f', 'e'=>'g',
'f'=>'i', 'g'=>'j', 'h'=>'k', 'i'=>'l', 'j'=>'m',
'k'=>'n', 'l'=>'p', 'm'=>'q', 'n'=>'r', 'o'=>'t',
'p'=>'u', 'q'=>'v', 'r'=>'w', 's'=>'x', 't'=>'y',
'u'=>'z', 'v'=>'c', 'w'=>'h', 'x'=>'a', 'y'=>'o',
'z'=>'s'
},
#Encryption 3
2 =>{'a'=>'00','b'=>'01','c'=>'02','d'=>'03',
'e'=>'04','f'=>'05','g'=>'06','h'=>'07',
'i'=>'08','j'=>'09','k'=>'10','l'=>'11',
'm'=>'12','n'=>'13','o'=>'14','p'=>'15',
'q'=>'16','r'=>'17','s'=>'18','t'=>'19',
'u'=>'20','v'=>'21','w'=>'22','x'=>'23',
'y'=>'24','z'=>'25'
}
}
end
class Codex
def initialize
@serial ={}
@id = {}
end
#----------------------------------------------------------------------------
# * This will generate a random code for this and this game only.
#----------------------------------------------------------------------------
def generate_code
#Generate the Code
time = 0
Code::Code_Size.times do
#All the Alphabet letters
a = rand(25)
#change the numbers in letters.
#Put the letter in the serial
i = get_letter(a)
@serial[time] = i
#Add time plus 1
time += 1
end
@id = code_serial(@serial)
return @id
end
#----------------------------------------------------------------------------
# * Code
#----------------------------------------------------------------------------
def code_serial(code)
hold = {}
time = 0
#Encrypt First Time
for i in code.values
a = Code::Code[0][i]
hold[time] = a
time += 1
end
#Encrypt Second Time
time = 0
hold2 = {}
for i in hold.values
a = Code::Code[1][i]
hold2[time] = a
time += 1
end
#Encrypt Third Time
time = 0
hold3 = {}
for i in hold2.values
a = Code::Code[2][i]
hold3[time] = a
time += 1
end
return hold3
end
#----------------------------------------------------------------------------
# * Decode
#----------------------------------------------------------------------------
def decode(value)
#De-encrypt Third Time
time = 0
hold = {}
for i in value.values
a = Code::Code[2].index(i)
hold[time] = a
time += 1
end
#De-encrypt Third Time
time = 0
hold1 = {}
for i in hold.values
a = Code::Code[1].index(i)
hold1[time] = a
time += 1
end
#De-encrypt Third Time
time = 0
hold2 = {}
for i in hold1.values
a = Code::Code[0].index(i)
hold2[time] = a
time += 1
end
return hold2
end
#----------------------------------------------------------------------------
# * Change number to letter
#----------------------------------------------------------------------------
def get_letter(number)
#Letter array
@letters= {'0'=>'a', '1'=>'b','2'=>'c', '3'=>'d','4'=>'e',
'5'=>'f', '6'=>'g','7'=>'h', '8'=>'i','9'=>'j',
'10'=>'k','11'=>'l','12'=>'m','13'=>'n','14'=>'o',
'15'=>'p','16'=>'q','17'=>'r','18'=>'s', '19'=>'t',
'20'=>'u', '21'=>'v', '22'=>'w','23'=>'x','24'=>'y',
'25'=>'z'}
return @letters[number.to_s]
end
end
#==============================================================================
# ** Window_Username - Username Input
#------------------------------------------------------------------------------
# Author Me?
# Base Mr.Mo
# Version 1.0
#==============================================================================
class Window_Username < Window_Base
#--------------------------------------------------------------------------
# * Attributes
#--------------------------------------------------------------------------
attr_accessor :text
attr_accessor :actives
#--------------------------------------------------------------------------
# * Initializes input window.
#--------------------------------------------------------------------------
def initialize
super(120, 202, 100 + 180, 48)
self.width = 100*2 + 180
self.contents = Bitmap.new(self.width-32, height-32)
self.contents.font.size = 16
self.opacity = 160
@text = []
@wait = 0
@actives = true
refresh
end
#--------------------------------------------------------------------------
# * Refreshes input window.
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, -8, self.width-64, 32, "Serial:")
self.contents.draw_text(70, -16, self.width-64, 48, @text.to_s) if not self.active
self.contents.draw_text(70, -16, self.width-64, 48, @text.to_s + ' |') if self.active
self.contents.draw_text(70, -16, self.width-64, 48, @text.to_s) if self.active
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
refresh
end
end