Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> First ever script, All it does is swap Item and save around!
kaimonkey
post Jan 22 2009, 12:55 AM
Post #1


Level 11
Group Icon

Group: Revolutionary
Posts: 193
Type: Scripter
RM Skill: Beginner




confused.gif Yeah, Im not sure if I should post here because my script will not be used, but I just want to say that I have made my first script, and will now begin to wander through the requests untill I find somthing easy, but any way, here's my swaps save and item round script- post above main as always!
[Show/Hide] swap save and item in menu
CODE
class Scene_Menu < Scene_Base
  def create_command_window
    s1 = Vocab::save
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::item
    s6 = Vocab::game_end
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)     # Disable item
      @command_window.draw_item(1, false)     # Disable skill
      @command_window.draw_item(2, false)     # Disable equipment
      @command_window.draw_item(3, false)     # Disable status
    end
    if $game_system.save_disabled             # If save is forbidden
      @command_window.draw_item(4, false)     # Disable save
    end
  end

  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
          when 0      # Save
        $scene = Scene_File.new(true, false, false)
      when 1,2,3  # Skill, equipment, status
        start_actor_selection
    when 4      # Item
        $scene = Scene_Item.new
      when 5      # End Game
        $scene = Scene_End.new
      end
    end
  end
end

#------------#
# Edit items #
#------------#
class Scene_Item < Scene_Base
  def return_scene
    $scene = Scene_Menu.new(4)
  end
end
class Scene_File < Scene_Base
   def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new(0)
    end
  end  
end

If there is anything I have done wrong/could do better, please tell me as I did this purely to learn! sweat.gif

This post has been edited by kaimonkey: Jan 22 2009, 01:12 AM
Go to the top of the page
 
+Quote Post
   
BigEd781
post Jan 22 2009, 01:05 AM
Post #2


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




Nothing wrong there really. All of the methods that you overrode had to be, they couldn't be aliased to do what you wanted. I would recommend that you list case statements in numerical order for readability, i.e.,

CODE
case @command_window.index
  when 0      # Save
    $scene = Scene_File.new(true, false, false)
  when 1,2,3  # Skill, equipment, status
    start_actor_selection
  when 4      # Item
    $scene = Scene_Item.new  
  when 5      # End Game
    $scene = Scene_End.new
end


Good job on your first script wink.gif


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
kaimonkey
post Jan 22 2009, 01:12 AM
Post #3


Level 11
Group Icon

Group: Revolutionary
Posts: 193
Type: Scripter
RM Skill: Beginner




Ok, Ive changed that, is it good now?!?
Go to the top of the page
 
+Quote Post
   
BigEd781
post Jan 22 2009, 01:15 AM
Post #4


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




Looks fine to me. I would recommend making something new now instead of editing existing scripts if you feel up to it.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
SojaBird
post Jan 22 2009, 02:12 AM
Post #5


Level 51
Group Icon

Group: Revolutionary
Posts: 1,573
Type: Scripter
RM Skill: Advanced




Well sure it's going the right way.
Though as you say, you could go check the requests.
You'll find something suitable, I'm sure wink.gif

Good job.


Greatzz,
SojaBird.


__________________________
Art from the highest shelf?

Scriptology, scripting podcast



HUD's Request Lobby (multiple hud-scripts)


------------------------------------------------------------------

Random Stuff
OMG, it's Hab!!


This is a crazy drawing application! (by me)

How did I learned to script
QUOTE
Hey pim! I'm the Law G14!

For the past couple of months I've been learning RGSS and I've got the basic stuff down such windows, variables, conditional statements, ect. But, I can't see myself making big scripts such as a jumping system or a side view battle system. I was wondering how you learned to script because I really want to know how to script really well.

Thanks in advance.


Hey there,

Well I don't make battle neither though I can still teach you some things :)...
The way I've learned to script is by reading other scripts for the most part.
I've allways been interested in other peoples work but this time I though I had to try to make something myself...and it worked!!
The most importand thing when you go scripting is (at least in my case) that you want to make something to help an other wich can't script.
You also need to feel the competition that's around in the scripting-community.
Cause, I have to say, if you get pushed to get a sertain request done before an other scripter does, you feel POWERFULL!! :P
So that's an other thing...
You also don't need to be afraid to learn from others or helpfiles.
When I write my scripts, I actualy always have the helpfiles open to look things up I don't know or remember.
Then, you must be calm, cause you need to try the script a lot of times.
When I write a script, I test it after almost every changes.
First I set up the major structure.
Like when I make a window-script or part of a script I start with something like this:
CODE
class Window_Name < Window_Base
def initialize(x,y,width,height)
super(x,y,width,height)
refresh
end

def refresh
self.contents.clear
draw_contents
end

def draw_contents
draw_something(with, some, parameters)
end

def update
refresh if @something != @what_it_should_be
end
end
So that's also very important.
Then, the biggest thing I learned scripting from is TRIAL AND ERROR.
That's the most irritating way to learn something, cause it's more ERROR than TRIAL, but it does the trick realy good.

So that's it how I did it.
Now it's up to you.
Do some requests (if I didn't do it allready :P) and learn from them.

Hope that helped you out a little.
If not, keep your eye on the Scriptology-topic (see my sig) where I'll be updating for my scripting(video)tutorials.
Perhaps they're going to be usefull for you one day ;)


Greatzz,
SojaBird.
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th June 2013 - 07:04 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker