LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

The only one
The only one
#1 Ruby/RGSS Lessons Empty Ruby/RGSS Lessons
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
Someone want to learn to script in Ruby/RGSS? GubiD's RGSS tutorials are here for you! I've found this today and I really wanted to share this with you guys. If you have some ruby video tutorials, share them here. Very Happy


Tutorial 1
Spoiler:

Tutorial 2
Spoiler:

Tutorial 3
Spoiler:

Tutorial 4
Spoiler:



Tutorial 5
Spoiler:





Tutorial 6
Spoiler:

Tutorial 7
Spoiler:









Tutorial 8
Spoiler:

Tutorial 9
Spoiler:

Tutorial 10
Spoiler:

Tutorial 11
Spoiler:



Tutorial 12
Spoiler:



Tutorial 13
Spoiler:



Tutorial 14
Spoiler:





Tutorial 15
Spoiler:









Tutorial 16
Spoiler:







Tutorial 17
Spoiler:


The only one
Show Signature


___________________________________________________________________________

Booyah!

...._
._|_|_
. ( ')>
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
Active Member
Active Member
#2 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
self.contents.draw_text(0, 0, 0, 0,"Stage to Display!", 1)

I don't know how to adjust the width and height.
At times the text doesn't show, and when it does it looks funny.

Can you help me out?
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
The only one
The only one
#3 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
You must ajust the window dimensions OR ajust the text size OR make the text shorter.
draw_text(x, y, width, height, "Yo'text!", alignment)
The only one
Show Signature


___________________________________________________________________________

Booyah!

...._
._|_|_
. ( ')>
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
Active Member
Active Member
#4 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
The text is like a custom help bar I'll upload a screen shot.

Ruby/RGSS Lessons HelpScreen

In the help screen it changes depending on what the cursor is on(in the left.) Well that's what I'm trying to do. Can I do it?
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
The only one
The only one
#5 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
As mr_wiggles did for me, try to find the answer and I'll keep you on the good way to succeed by yourself. If it's possible, maybe send your code in private or on this topic. For that kind of menu, you must do as for the Scene_Menu script. For such thing, it's better to use a new Scene so you'll use main instead of initialize method. Or you could simply create the four windows separatly and update them in a scene. The problem is maybe only the dimensions. That's why I want you to send me the code. If you want to make the window separatly, use Window_ShopCommand as reference, I won't give you the answer, else, it's not funny Razz.

For a scene:
s1="Title"
s2="Project Rising Sun"
s3="GEt OUt! Teaser"
s4="Hello Sukita."

@command_window = Window_Command.new(160, [s1, s2, s3, s4])
@command_window.index = @menu_index
The only one
Show Signature


___________________________________________________________________________

Booyah!

...._
._|_|_
. ( ')>
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
Active Member
Active Member
#6 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
I'm sorry, but I'm lost.

But what I did is edited the title to have a Gallery Scene, replacing Continue.

So if I uploaded it would I give you both my script plus the edited Scene_Title?
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
The only one
The only one
#7 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
Send me all the codes modified/added so I'll understand what you try to make and could help you to achieve it.
The only one
Show Signature


___________________________________________________________________________

Booyah!

...._
._|_|_
. ( ')>
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
EVENTALIST
EVENTALIST
#8 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
This site is the best, i reference it all the time.

http://www.ruby-doc.org/docs/ProgrammingRuby/
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#9 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Code:
class Scene_Gallery
  def initialize
    @gallery_index = 0
    music_change
  end
 
  def main

    # Stop playing ME and BGS
    Audio.me_stop
    Audio.bgs_stop
   
    # Execute transition
    Graphics.transition
   
    # Make title graphic
    @bg = Sprite.new   
    @bg.bitmap = RPG::Cache.title("2473675.png")
    @bg.flash(nil, 3)
   
   
    # Making other Images
    @ima = Sprite.new
    @ima.x = 160 + 4
    @ima.y = 4
    @ima.z = 4
    @ima.opacity = 200
   
    #Help Messages
    @m1 = "Return to Title Screen."
    @m2 = "Project Rising Sun"
    @m3 = "Logo for Project  Rising Sun"
    @m4 = "Promo image for GEt OUt!"
    @m5 = "nil"
    @m6 = "nil"
   
    # Make command window
    s1 = "Title"
    s2 = "Project Rising Sun"
    s3 = "GEt OUt! Teaser"
    s4 = "Hello Sukita."
    # Something with Commands
    @command_window = Window_Command.new(240, [s1, s2, s3, s4])
    @command_window.y = 100
    @command_window.height = 480
    @command_window.opacity = 190
    @command_window.z = 5
    @command_window.active = true
    @command_window.index = @gallery_index
   
    # Make Image window
    @image_window = Window_Image.new
    @image_window.back_opacity = 130
    @image_window.x = 160
    @image_window.y = 0
    @image_window.z = 2
    # Make Title Window and Help Window
    @title = Window_Title.new
    @help = Window_Helping.new
    @help.back_opacity = 230
    @help.z = 6
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Disposing of things
    @command_window.dispose
    @image_window.dispose
    @title.dispose
    @help.dispose
    # Dispose of title graphic
    @bg.bitmap.dispose
    @bg.dispose
    @ima.dispose
  end
 
  def music_change
      @random_bga = rand(5)
      # Play Random BGM
      case @random_bga
      when 0
        Audio.bgm_play("Audio/BGM/Seoleim", 70, 0)
        @random_bga
      when 1
        Audio.bgm_play("Audio/BGM/Temptation", 70, 0)
        @random_bga
      when 2
        Audio.bgm_play("Audio/BGM/I Want YouM", 70, 0)
        @random_bga
      when 3
        Audio.bgm_play("Audio/BGM/Piano Concerto No.1", 70, 0)
        @random_bga
      when 4
        Audio.bgm_play("Audio/BGM/Say it From Your Heart", 70, 0)
        @random_bga
      end
end

#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
  def update
    @bg.update
    @command_window.update   
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    #Skip Song
    if Input.trigger?(Input::L)|| Input.trigger?(Input::R)
      # Fade out BGM, BGS, and ME
      Audio.bgm_fade(800)
      music_change
    end
  end
end
#--------------------------------------------------------------------------
# * Update_Command
#--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    if Input.trigger?(Input::B)
        # Play decision SE
        $game_system.se_play($data_system.cancel_se)
        # Fade out BGM, BGS, and ME
        Audio.bgm_fade(800)
        Audio.bgs_fade(800)
        Audio.me_fade(800)
        # Shutdown
        @random_bga
        $scene = Scene_Title.new
      end
    # If Cursor is hovered over
    case @command_window.index
    when 0
      if Input.trigger?(Input::C)
        # Play decision SE
        $game_system.se_play($data_system.cancel_se)
        # Fade out BGM, BGS, and ME
        Audio.bgm_fade(800)
        Audio.bgs_fade(800)
        Audio.me_fade(800)
        # Shutdown
        @random_bga
        $scene = Scene_Title.new
      end
      @ima.bitmap = nil
      @help_mess = @m1
    when 1
      @ima.bitmap = RPG::Cache.picture("2473109.png")
      @help_mess = @m2
    when 2
      @ima.bitmap = RPG::Cache.picture("2473675.png")
      @help_mess = @m3
    when 3
      p "Nil"
      @command_window.index = 0
      @help_mess = @m4
    end
    return
   
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  # Title
        # Play decision SE
        $game_system.se_play($data_system.cancel_se)
        # Fade out BGM, BGS, and ME
        Audio.bgm_fade(800)
        Audio.bgs_fade(800)
        Audio.me_fade(800)
        # Shutdown and random song
        @random_bga
        $scene = Scene_Title.new
      when 1  # This
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
      when 2  # That
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
      when 3  # Image
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
      end
      return
    end
  end
#--------------------------------------------------------------------------
# * Image Window
#--------------------------------------------------------------------------
class Window_Image < Window_Base
  def initialize
    super(0, 0, 480, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 50, 50,"")
  end
end

#--------------------------------------------------------------------------
# * Title Window
#--------------------------------------------------------------------------
class Window_Title < Window_Base
  def initialize
    super(0, 0, 160, 100)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.color = system_color
    self.contents.font.size = 44
    self.contents.draw_text(0, 0, 100, 50,"Gallery", 1)
  end
end

#--------------------------------------------------------------------------
# * Help Window
#--------------------------------------------------------------------------
class Window_Helping < Window_Base
  def initialize
    super(0, 430, 640, 50)
    self.contents = Bitmap.new(width - 32, height - 32)
    @help_mess = @m1
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.color = system_color
    self.contents.font.size = 7
    self.contents.draw_text(0, 0, 50, 50,@help_mess.to_s)
  end
end
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
The only one
The only one
#10 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
Problem:
Your windows sizes are simply not correctly defined.
@command_window = Window_Command.new(240, [s1, s2, s3, s4])
@command_window.height = 480
super(0, 0, 480, 480) # Window_Image

The game interface dimensions are: (640, 480) (x, y).
Look at your super method. 640 - 480 = 160. So you should set the command to 160 instead of 240 so the width will be the game interface. It's the same problem with the height, you've forgot to substract 32 (I suppose that you made it 64px height Wink ) from your help window to the Window_Image height and @command_window.height .

If I remember, you said that the text looks funny? Try to change the text size. If you want to do it, now could try to alias the Window_Command initialize and refresh methods like this:

Code:
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================
class Window_Command < Window_Selectable
  attr_accessor :text_size
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    width    : window width
  #    commands : command text string array
  #--------------------------------------------------------------------------
  alias handy333_scenegallery_windowcommand_initialize initialize
  def initialize(width, commands)
    handy333_scenegallery_windowcommand_initialize(width, commands)
    @text_size = 24
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  alias handy333_scenegallery_windowcommand_refresh refresh
  def refresh
    handy333_scenegallery_windowcommand_refresh
    self.contents.font.size = @text_size
  end
end

Personally, I use long and precise aliasing method so I know where and what it's supposed to be aliased. What this code do? It call Window_Command::initialize and add in the method at the top, center or the bottom, depending on where you put the alias name, everything you write. It's like if you create a new method and call it instead of initialize. I added in the attr_writer : text_size too so you could change it later like this:
@command_window.text_size = choosen_size

I don't know actually if that work but, it should.

Suggestions:
Ok, first, at the end, the class Window_Helping, I think it's useles. There's already a class name Window_help in rpg maker that you can call like this: @window_help = window_help.set_text(text, align = 0) and set is position x or y like this: @window_help.x and @window_help.y .

Line 129 to 134, delete one of the comment Laughing .

At the end of the music call, use rescue nil:
Code:
Audio.bgm_play("Audio/BGM/Say it From Your Heart", 70, 0) rescue nil
If the player don't have the music, the game won't crash and simply return nil. Should use it for the pictures too. But, if you do that, in the end of the loop in main, you should do this:
Code:
@bg.bitmap.dispose if @bg.bitmap != nil
@bg.dispose if @bg != nil
@ima.dispose if @ima != nil

Instead of using Window_Image. Just call a dummy_window Cool . @dummy_window = Window_Base.new(x, y, width height) will save your time by creating an empty window.

I may have miss something so ask again if you still have a problem. Still edit on this post.


EDIT: Ok, so the post about aliasing the method don't work. I made this and it does. Just modify your windows sizes now.
Spoiler:

Code:
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :scene_gallery
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias handy333_scenegallery_gametemp_initialize initialize
  def initialize
    handy333_scenegallery_gametemp_initialize
    @scene_gallery = false
  end
end

#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  alias handy333_scenegallery_windowcommand_refresh refresh
  def refresh
    self.contents.font.size = 18 if $game_temp != nil and $game_temp.scene_gallery == true
    handy333_scenegallery_windowcommand_refresh
  end
end

You must unactive $game_temp.scene_gallery when the gallery is disposed and active it when initialize. I give you this because, I want you to read and understand what I made.
The only one
Show Signature


___________________________________________________________________________

Booyah!

...._
._|_|_
. ( ')>
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
Active Member
Active Member
#11 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Let me begin by saying thanks for your time and help.

Some of the window sizes are on purpose.

The only problem I'm having is the help bar at the bottom. I was experimenting with the - 32 thing and lots of other ideas but no dice. Things started out with the text saying help via example. So I decided to change some stuff. Then the text turned tiny and sometimes was cut off.

When I tried to change the text size nothing happened, then after that the text didn't display from that point on.


"You must unactive $game_temp.scene_gallery when the gallery is disposed and active it when initialize. I give you this because, I want you to read and understand what I made.
I'm very confused about the aliasing."

The other things with text is confusing me.
I'm still learning the programming lingo.
So most of it I don't understand.

I use most of the strategy I use in eventing.

What exactly does "rescue" do?
What exactly does "alias" do?
...I think that's about it.

^I don't really understand this.^


Thanks in advance.


I would like to fully understand all of this.
For Project Rising Sun.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#12 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
rescue, is do this if the code fails.

Code:

File.open("my name") rescue print("file not found")

and alias is making edits that involve the original code.
Code:

def update
  do_this
  ... ect
end

if you where to just do this:
Code:

def update
  do_this_instead
  ... ect
end

it will write over the first code and never run it. but if you want to make an edit that adds to the previous code you make an alais.
Code:

alias :new_update :update
def update
  do_this_code_first
  ... ect
  new_update # this will call the old method
  now_do_this_after # do some more new code if necessary
  ... ect
end

@nuka - you graduate from school. Very Happy
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#13 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Now I feel bad...
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
The only one
The only one
#14 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
lol!

Try this: mediafire.com ?ysuhp9qqload5yh

It's 1 of my 11 references/tutorials I took from the web.
The only one
Show Signature


___________________________________________________________________________

Booyah!

...._
._|_|_
. ( ')>
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
Active Member
Active Member
#15 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Alias is just my enemy.
I can't seem to fully understand it.
I've looked everywhere on the topic
but its explanation is hazy.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
Administrator
Administrator
#16 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
handy333 wrote:Alias is just my enemy.
I can't seem to fully understand it.
I've looked everywhere on the topic
but its explanation is hazy.

Yo Handy! One of my most common mistakes that I repetitively make when it comes to code is "over thinking"

what part of the alias method do you not get?

the alias method is mostly used so that one script can write to another and use an existing method without have to rewrite the whole sha-bang-bang.


Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
Active Member
Active Member
#17 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Is it like this?

class You
def this
alsdj;fkl;
end
end

class Me
alias this
end

If it is, isn't super() the same way?

I think I get confused when I read about more than one topic and try to try them all at once.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
Administrator
Administrator
#18 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
you're getting it...

class You
def this
blah
blah
blah
blah
end
end

class Me < You
alias do_this this
def this
more_blah
do_this
end
end

^,^
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
The only one
The only one
#19 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
Over Power this sample Shocked
The only one
Show Signature


___________________________________________________________________________

Booyah!

...._
._|_|_
. ( ')>
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
Active Member
Active Member
#20 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
So the "<" in "Me < You" is needed for alias?
Is alias like include?
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
The only one
The only one
#21 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
Yes, alias are like include but, for a method.
The only one
Show Signature


___________________________________________________________________________

Booyah!

...._
._|_|_
. ( ')>
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
Active Member
Active Member
#22 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Okay, now that I understand that...
What is include used for.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
Administrator
Administrator
#23 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
'include' is one of my favorite keywords in RGSS

let's say you make a module


module Bottle

WATER = 10

end


(and then a class/method...)

class Drink

def cup

sip = Bottle::Water - 1

end

end


so if you were to use 'include' it would be:


module Bottle

WATER = 10

end

class Drink

include Bottle

def cup

sip = WATER - 1

end

end

it allows you to access the CONSTANTS in the module without having to type the extra "BOTTLE::WATER" just WATER

~I think I'm thirsty~
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
Active Member
Active Member
#24 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Okay now I know this will annoy you(not that I'm trying to) but,
how does modules work, don't slap me!
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
Administrator
Administrator
#25 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
looks like an incoming slap ~ no wait it's a hi-5 Cool

modules are like containers for a chunks of code (big or small) in which you can use CONSTANTS (variables that are all in CAPS) to even a whole entire class with it's own methods, which can be accessed from one script to another without the use of global variables $

module Handy_Man
THIS = true
end

^ 'module' is in lower case
the name of the module is just like a class first letter is Cap
THIS is a CONSTANT all caps

should you ever access the constant in the module without the include method it would be with 2 colons

i.e. Handy_Man::THIS

again if you use the include method inside a class
it would be after the class and before the method

so

class Lessons
include Handy_Man
def learning
THIS
end
end

Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
Active Member
Active Member
#26 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Very easily learned but I'll check back to this for references.

I guess that was everything...so far...
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
Active Member
Active Member
#27 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Just to be sure, I can't use Include for classes right?
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
The only one
The only one
#28 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
Right, but you can simply do that:

class Noob

def initialize
end

def refresh
end

end


class Noob

def lobster
end

def ninja
end

end

That will add the methods lobster and ninja in the original class. No need to call anything.
The only one
Show Signature


___________________________________________________________________________

Booyah!

...._
._|_|_
. ( ')>
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
Active Member
Active Member
#29 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
Is that a hint of me bothering you guys?
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
Administrator
Administrator
#30 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
@Nuka - :~P


@handy - HA! no way handy <3

it's all about sharing what we know so others can learn = 101

what amazes me, is how fast you some of you guys learn...it took me a while to understand basics.

edit: uhm, I'm still learning basics :~P



Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
Active Member
Active Member
#31 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
It's kind of hard to follow the vids when he's only using RMVX or higher. That's why I'm sort of confused on all of the topics.

Noob, nerd, or geek aren't a set of my favorite words...
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
Administrator
Administrator
#32 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
what vids are you talking about?


is there a script that you are currently using, editing, trying to make?

maybe we can break down a few lines with comments to understand/learn some more... ?
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
Active Member
Active Member
#33 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
I'm working on a padlock system for my one of my training project games here's the code:

Code:
class Pad
   def initialize(com, angle = 0)
       $angle = angle
      @com = com
       @times = -1
       @combo = []
       @close = false
       main
   end
   
   def main
      @show = Viewport.new(0, 0, 640, 480)
      @show.z = 3
      
      @back = Sprite.new(@show)
      @back.bitmap = RPG::Cache.picture("Lock-back")
      @back.x = 87
      @back.y = 7
      @mid= Sprite.new(@show)
      @mid.bitmap = RPG::Cache.picture("Lock-Dial")
      @mid.x = 320
      @mid.y = 240
    @mid.ox = 150.5
    @mid.oy = 152
      @glint = Sprite.new(@show)
      @glint.bitmap = RPG::Cache.picture("Lock-Glint")
      @glint.x = 319
      @glint.y = 176
    @glint.opacity = 150
   
    @stats_window = Results.new
    @stats_window.back_opacity = 130
      
       # Main loop
      loop do
          # Update game screen
          Graphics.update
          # Update input information
         Input.update
          # Frame update
         update
         # Abort loop if screen is changed
          if @close == true
            break
         end
    end
   
    @back.dispose
    @mid.dispose
    @glint.dispose
    @stats_window.dispose
   end
   
   def update
      @back.update
      @mid.update
      @glint.update     
      if Input.press?(Input::LEFT)
      $angle = @mid.angle += 1.to_i
      Audio.se_play("Audio/SE/032-Switch01", 70, 0) rescue nil
     
      if @mid.angle >= 1
        @mid.angle = 0
        Audio.se_stop       
      end
    end
   
      if Input.press?(Input::RIGHT)
      $angle = @mid.angle += -1.to_i
      Audio.se_play("Audio/SE/032-Switch01", 70, 0) rescue nil
     
     
      if @mid.angle <= -319
        @mid.angle = -318
        Audio.se_stop       
      end 
      end
   
    if Input.trigger?(Input::R)
      $angle = @mid.angle += -50
      Audio.se_play("Audio/SE/032-Switch01", 70, 0) rescue nil
      if @mid.angle <= -318
        @mid.angle = -318
        $angle = -318
      end
    end
   
    if Input.trigger?(Input::L)
      @angle = @mid.angle += 50
      Audio.se_play("Audio/SE/032-Switch01", 70, 0) rescue nil
      if @mid.angle >= 1
        @mid.angle = 0
        @angle = 0
      end     
    end
 
      if Input.trigger?(Input::B)
         @back.dispose
         @mid.dispose
         @glint.dispose
      @close = true
      end
   
    if Input.trigger?(Input::C)
      p @angle
      ini = @angle.to_a
      @times += 1   
      if @times == 2
        @times = 0
        if @com == @combo
          p "Got it!"
          Audio.se_play("Audio/SE/054-Right01", 70, -100) rescue nil
          @back.dispose
          @mid.dispose
          @glint.dispose
          @close = true
        else
          Audio.se_play("Audio/SE/057-Wrong01", 70, -100) rescue nil
          @combo.clear
        end

      end
      case @times
      when 0
        @combo += ini
        p @combo
      when 1
        @combo += ini
        p @combo       
      when 2
        @combo += ini
        p @combo       
      end
      end
   end
end


class Results < Window_Base
  def initialize
    super(0, 0, 130, 130)
    self.contents = Bitmap.new(width - 32, height - 32) 
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 130, 130,"")
  end
end

There are probably millions of things wrong with this but I got what I needed to work, now what I'm trying to do is make the coordinates display on a window so the player could see what they inputed.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#34 Ruby/RGSS Lessons Empty Re: Ruby/RGSS Lessons
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
Handy, do you still need help with this? It's been a while since i've had internet.

Also noob is just a word, when i programed my first window it was the title of the window class i chose because it seemed fitting. Much like 'Hello world' to me words dont have meaning unlesss you put meaning behind them. But much like that meaning influences emotions it can also be a driving force to learn. Smile

I think i'll try to include 'noob' somewhere in my next script title, because why not? A_Noob_Made_Extractor.

But serriously, dont be afraid to ask questions if you still have any. Smile
EVENTALIST
Show Signature
EVENTALIST

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled