Rgss Tutorial - basics

Started by Blizzy April 7th, 2005 9:52 AM
  • 3471 views
  • 12 replies

Blizzy

me = Scripter.new("Noob")

Age 33
~The Netherlands~
Seen September 2nd, 2007
Posted September 2nd, 2007
492 posts
18.4 Years
ok, i've made another toturial:
read it carefully...

RGSS Toturial [Basics]

● Drawing a picture on screen:
  @image = Sprite.new
  @imate.bitmap = RPG::Cache.picture("name of picture")
You can give @image any other name you could think of,
but it needs to start with @.
This will draw a picture at x 0 and y 0,
To set the cordinates of the x & y: (you can use any number)
  @image.x = 100
  @image.y = 100
To set a layer, use:
  @image.z = 100 # 1 - 9999+.
to move pictures, use .ox and .oy
example:
  @image.ox += 1 or -= 1
  @image.oy += 1 or -= 1
● Drawing text on Screen
To draw text, you'll need to have the following in "def initialize"
  self.contents = Bitmap.new(width - 32, height - 32)
If you don't have this in the method, no text will be draw on screen.
to set text, use the following line:
  self.contents.draw_text(x,y,width,height, "text")
x is the x-cordinate of the text
y is the y-cordinate of the text
width is the lengt of the text
height is the height of the text
the width & height is the same as the size of the font!
example:
"this is text", if width is "8"
it'll display something like this:
"this i" and the rest is invisible

● Switches
to modify switches, you*ll need to do:
    $game_switches[ID] = flag value
ID is the number of the switch
flag value is: true or false (on/off)

● Variables
to modify variables:
    $game_variables[ID] = number
ID is the number of the variable
you can do the following with variable:
set equal: =
add : +=
substract: -=
multiply : *=
divide : /=
there are more, but the're not hard to find

you can also store text in variables!
example:
$game_variables[1] = "look! text"
to test it, use this in a call script:
print $game_variables[1].to_s
● Local_Switches
to modify local_switches:
    $game_self_switches = {[MapID, EventID, "LOCAL-SWITCH"] => flag value} 
    $game_map.need_refresh = true
MapID is the ID of the map
ID is the event ID
"Local-Switch" is "a,b,c or d"
flag value is true or false
after each local switch modify, you'll need to refresh the map:
    $game_map.need_refresh = true
this is it for now.
i might do some more toturials about rgss.
if you have any ideas for next toturials plz post them.

comments & questions are welcome

USA
Seen June 29th, 2011
Posted July 16th, 2006
535 posts
18.3 Years
Really good tutorial! (though I already knew about 40% of it) This tutorial should help many people out :)

~The River~

Current project

Pokemon Light Progress:

Light is starting over! I'll update this once I progress more in Light again.


:: Pokemon Light Links ::
:: Site :: :: Forums :: :: Thread ::
Age 35
Australia
Seen April 4th, 2017
Posted December 14th, 2015
1,279 posts
19.2 Years
Great work Virtual, I tried to do Dubalex's tutorial but I couldn't concentrate on the 2nd tutorial for long enough to learn much :(
Perhaps you will go a bit more in-depth for your next tutorial :D

Pokemon Indigo League is a re-creation of the original Pokemon TV series in game form

Blizzy

me = Scripter.new("Noob")

Age 33
~The Netherlands~
Seen September 2nd, 2007
Posted September 2nd, 2007
492 posts
18.4 Years
Great work Virtual, I tried to do Dubalex's tutorial but I couldn't concentrate on the 2nd tutorial for long enough to learn much :(
Perhaps you will go a bit more in-depth for your next tutorial :D
i guess i could go more in-depth next time,
but this is only explaining basic syntax