Game Variable ControlVersion: 1.0
By: game_guy aka gameguy27
Introduction
Well say you're scripting and it involves typing out $game_variables[id] += whatever
or something like that. This small scriptlet allows you to shorten the above line
THIS WORKS FOR VX AND XP
Features
Screenshots
N/A
Demo
N/A
Script
Instructions
Ok instead of using something like this
$points = $game_variables[id]
you can use this instead
$points = Gv.getval(id)
To me it makes things alot quicker. Here are the different operatoins you can use
Gv.getval(id) # Get the value of the game variable
Gv.setval(id, val) # Set the value of the game variable
Gv.addval(id, val) # Add value to the game variable
Gv.subval(id, val) # Subtract value from the game variable
Gv.multval(id, val) # Multiply value to the game variable
Gv.divval(id, val) # Divide value by the game variable
id = variable id
val = the value you want to set/add/subtract/multiply/divide the variable to
FAQ
None
Compatibility
Compatible with everything.
Credits and Thanks
game_guy aka gameguy27 ~ making it
Author's Notes
I am not sure if this would be considered a scripters tools seeing you can also do this by script call. But I think of this mostly as a scripters tool.
Terms and Conditions
Use as you wish.
By: game_guy aka gameguy27
Introduction
Well say you're scripting and it involves typing out $game_variables[id] += whatever
or something like that. This small scriptlet allows you to shorten the above line
THIS WORKS FOR VX AND XP
Features
- Use shorting line instead of $game_variables
Screenshots
N/A
Demo
N/A
Script
Code:
=begin
Gv.getval(id) # Get the value of the game variable
Gv.setval(id, val) # Set the value of the game variable
Gv.addval(id, val) # Add value to the game variable
Gv.subval(id, val) # Subtract value from the game variable
Gv.multval(id, val) # Multiply value to the game variable
Gv.divval(id, val) # Divide value by the game variable
Â
id = variable id
val = the value you want to set/add/subtract/multiply/divide the variable to
=end
module Gv
 def self.getval(id)
  return $game_variables[id]
 end
 def self.setval(id, val)
  $game_variables[id] = val
 end
 def self.addval(id, val)
  $game_variables[id] += val
 end
 def self.subval(id, val)
  $game_variables[id] -= val
 end
 def self.multval(id, val)
  $game_variables[id] *= val
 end
 def self.divval(id, val)
  $game_variables[id] / val
 end
end
Â
Instructions
Ok instead of using something like this
$points = $game_variables[id]
you can use this instead
$points = Gv.getval(id)
To me it makes things alot quicker. Here are the different operatoins you can use
Gv.getval(id) # Get the value of the game variable
Gv.setval(id, val) # Set the value of the game variable
Gv.addval(id, val) # Add value to the game variable
Gv.subval(id, val) # Subtract value from the game variable
Gv.multval(id, val) # Multiply value to the game variable
Gv.divval(id, val) # Divide value by the game variable
id = variable id
val = the value you want to set/add/subtract/multiply/divide the variable to
FAQ
None
Compatibility
Compatible with everything.
Credits and Thanks
game_guy aka gameguy27 ~ making it
Author's Notes
I am not sure if this would be considered a scripters tools seeing you can also do this by script call. But I think of this mostly as a scripters tool.
Terms and Conditions
Use as you wish.