Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Scripts HELP! How to activate!?

When I paste a script into the editor... how do I make it work? (read the instructions.. not helping.) Just in general, no script specifically, is there anything you have to do to activate it?
 
I honestly don't know... lol.  I've never used custom content for rmvx.  Only xp.  And I thought YOU knew how to change color, ha ha!  Oh well.  Do a search for the tileset deal.  I'm sure you'll find something.
 
Lol saw a familiar name and decided to help out!

Question: are you learning HOW to script?

If so I can help! You see I've found out in my 6 months with VX and XP how to script quite well. You see everything is handled in 3 places...

Main
The Scene
The Window

Main you don't have to worry about lol. It just basicly starts your game.

The two big things are Scene and Window.

Scene IS the script. It basically dose EVERYTHING.  It  basicly calls out all of the other functions and says "Hay you! Start up!" or "Hay graphics! I want you to fade out now!". The Scene is like a scene in the moive. It;s were all of the script happens.

Windows are like the actors in the scene. you see a scene dose all of the work. It runs your main possesses, manages functions and calls out windows. The window actually dose all of the graphics. As the name says it's a WINDOW. It's like what you look though in the game. This is were you display text and information for the viewer to see.

Here's an example of how they work...

class Scene_Awesome
    def main (Main or Start in VX, is were the program begins)
       super(x, y, width, height) (Very important! always have this in main this is the SIZE of your scene)
       Window_display_name (This is the name of our window were calling out)
    end
end

Class Window_Display_Name < Window_Base (This means that it's a base window. Only used for displaying graphics)
   def main
       super(x,y,width,height) (The size of your window)
      self.contents.draw(x,y,size,"Hello! How are you!", side alingment)
  end
end

this will basically have a scene that calls out a box on the screen that will say "Hello! How are you!". Preaty easy no?

Now this is were most people get lost and I think this is were you got lost when you asked how to activate scripts. Remember how i told you scenes were important? well it's because you call your script out by the scene. 

In this case we would say this $ <= this means script
and then call our script, $Scene_Awesome
and we want it to be new right since it doesn't exist. so we say, $Scene_Awesome.new
then you go to an event and add in a script function.
Then add that code in there and Voila!
When the person clicks on the event a box will come up that says, "Hello!".

So to call out a script all you have to know is what Scene to call out.

I hope this helps I know it's a lot. If you want to learn to script or edit scripts. Like I've said before I'll give you more help one on one.

Hopes this also helps anyone else who want's to learn to script.  :thumb:

-Matt
 
Okay, Matt.  Honestly, out of all of the tutorials and things I've read about on scripts, this was DEFINITELY the easiest to follow, and the very best out of all of them because you give a short script to work on, instead of just teaching what every part does.

I know what most of the abbreviations and functions are for Ruby scripting, but making an actual scene used to blow me away.  You really helped!  But here's my question:

You said that window displays what the user sees pretty much, right?  So say I copied your script down word for word, where would we put it?

Do i make a new script all together on that page and what would I name it?  Or do I put it under the window script and just make a new line at the bottom?  This is what confuses me is the format that you have to script in to get it to work... 

But you did a great job explaining this.  I want to make a window within my menu screen that lists selected variables with their names and then their value.... I'm sure I could figure it out if I could just get the window to pop up.  Thanks again!  I think Drerius will appreciate this too, even though he's still got a bit to learn with variables and switches.
 
Wow! Once I learn a bit more like Mikee says, and once, I study over the scripts editor a bit more, I'm SURE I will know exactly how to do it! XD This is explained very well, as I said, I learn best with analogies, and your analogy of the movie worked quite well :D Thanks!
 

Zeriab

Sponsor

Hey Matt. It is much appreciated that you try to help.
Please do a test run before posting example code as that would have exposed the errors in your example.
I suggest you place the code in a
Code:
block and use the Ruby commenting so the code can be directly pasted into the editor without the comments giving errors. This would give you this:
Code:
class Scene_Awesome
    def main #(Main or Start in VX, is were the program begins)
       super(x, y, width, height) #(Very important! always have this in main this is the SIZE of your scene)
       Window_display_name #(This is the name of our window were calling out)
    end
end

Class Window_Display_Name < Window_Base #(This means that it's a base window. Only used for displaying graphics)
   def main
       super(x,y,width,height) #(The size of your window)
       self.contents.draw(x,y,size,"Hello! How are you!", side alingment)
   end
end
Whether or not the parenthesis should be there is merely are matter of style.
On to the more serious matters.
Ruby is case-sensitive meaning that Hello, hello and hELLo all are different to ruby.
Case-sensitive problems highlighted with red":x2rxiwl3 said:
class Scene_Awesome
    def main #(Main or Start in VX, is were the program begins)
       super(x, y, width, height) #(Very important! always have this in main this is the SIZE of your scene)
       Window_display_name #(This is the name of our window were calling out)
    end
end

Class Window_Display_Name < Window_Base #(This means that it's a base window. Only used for displaying graphics)
   def main
       super(x,y,width,height) #(The size of your window)
       self.contents.draw(x,y,size,"Hello! How are you!", side alingment)
   end
end

As you can see I have highlighted some more areas in your code.
The green area is just a little nitpick about you would normally call it side_alignment rather than side alignment so you have a local variable rather than a syntax error.
The blue area is about you first stating it's for VX while in VX you would have had Scene_Awesome < Scene_Base. The one shown is how it is done in XP.
The next is the main of super class you are calling with 4 arguments. The super class of Scene_Awesome is Object which by default do not have a method named main. In VX the main-method in Scene_Base takes no arguments. This line should simply be deleted. (You can't simply apply the logic from the Window_XXX classes in the Scene_XXX classes)
The orange area also includes Window_display_name where I wonder what the purpose is of simply looking at the constant. Right now you would simply return the class to whatever is calling the main-method.
Normally you would create a new window Window_Display_Name.new, store it in a variable and do stuff with it.
The teal area is about the main method in Window_Display_Name. This is not the method you want. You want the initialize method, which is called when you create an instance of the class.
The purple area is about self.contents, the Bitmap which you draw upon. You need to create it first with something like self.contents = Bitmap.new(width - 32, height - 32) or you will get an error.
The brown area is about a method which does not exist for Bitmaps. You want the draw_text method, not the draw method. (Note that the syntax can be looked up in the help file)

I would change the code to something like this:
Code:
class Scene_Awesome
  def main #(Main is were the program begins)
     window = Window_Display_Name.new #(This is the name of our window were calling out)
     
     # Do stuff
     
     window.dispose # Let's remove it again
  end
end

class Window_Display_Name < Window_Base #(This means that it's a base window. Only used for displaying graphics)
  def initialize
    super(0, 0, 230, 64) #(x, y, width, height) - The size of your window
    self.contents = Bitmap.new(width - 32, height - 32)
    side_alignment = 1 # 0 = left, 1 = center, 2 = right
    self.contents.draw_text(x, y, width - 32, height - 32, "Hello! How are you!", side_alignment)
  end
end

Do you see the difference? This is a working example. You can put Window_Display_Name.new in the script call of an event to test it. You can't really test the scene since its not finished at all. Had it been finished you could have tested it with $scene = Scene_Awesome.new, but right now I believe you will just get a Script Hanging error after a while.

This reminds me. It's not correct to do $Scene_Awesome.new since $Scene_Awesome is a global variable which is not the same as Scene_Awesome. Scene_Awesome is a constant.
Basically:
  • $variable is a global variable
  • Variable is a constant. (Yeah, it shouldn't really be a variable, it should be constant. I.e. not changing)
  • variable is a local variable
  • @variable is an instance variable
  • @@variable is a class variable

Nevertheless it's nice to see you have put an effort in your post despite the errors. Keep learning :D

@drerius: I am sorry for high-jacking your thread like this. I do hope that you have learned something about finding errors from this and even if a script looks alright at a first glance it might not be so.

*hugs*
- Zeriab
 
Figured there would be issues in this. I whipped it up pretty fast lol and at midnight and was a bit tired. I'll go into depth on how to script later today! First I've got things to do. Tata for now!

-Matt (Necro)

lol thanks btw. I've been in XP for far to long... I've been working on an xp project and it look like it stuck with me. I need to get back to my VX roots.
 
Hey, Matt.  I liked the way you explained everything.  You did it very simple, and gave example code... very SIMPLE example code with notes.  Though you had errors, I still think it was a great little bit of information.  Have you ever opened a tutorial thread in the tutorial page? 

And, Zeriab.  I appreciate that you looked into this and fixed the errors.  Do you know of any tutorials that give some simple scripting examples, or maybe just a basic tutorial on how to write a basic script?  This is what I've been looking for and it seems that you've really got a good grasp on this stuff. 
 
I'd love to have a simple scripting tutorial too. That'd be great!

I'm having a problem, I'm trying to install Mr. Bubble's scripts for the ATB system, but when I click on the game.exe in the folder after unzipping it, I get an error that says cannot find character data or something.

any idea?
 
game.exe?  Is that the actual game (demo) file or is it the rm file?  Try making a new project and dragging all the files that came with the demo (replace it with the "new" game files)  The demo or game project might be missing something when they tried to compress it and by moving those files into another project, you'll get all the files you need, plus the updated ones.

If this isn't a demo, and you're just copying a script into your game, then I'm not sure what to tell you except to read the instructions again (if there were any) and make sure you didn't leave something out, and make sure you don't have another conflicting script or something causing the error.  If the script has an error, you can usually tell by checking the thread you got the script from and reading the last ten replies or so.  If they complain about an error and there's nothing posted about it being fixed, then you might just have to wait or request it to be fixed.

Good luck, dude.  P.s. What does that script add exactly? Can you link it?
 
It runs fine AND I got the script hehe, the only thing is I copied them all over to my project and.. I somehow got a script error line 1 and erased them all to re-copy them into there, so guess what? Now, I lost the website I downloaded it from lol. so now I know I posted it somewhere on this forum it's a link to the Tankenai or something like that ATB battle system, side view thingy.

I'm gonna look for it.
 

Zeriab

Sponsor

Mikee":2g6l2ymq said:
(...)
And, Zeriab.  I appreciate that you looked into this and fixed the errors.  Do you know of any tutorials that give some simple scripting examples, or maybe just a basic tutorial on how to write a basic script?  This is what I've been looking for and it seems that you've really got a good grasp on this stuff. 

Yes. I personally like Khatharr's tutorials:
RGSS Graphics for Noobs - Part 1
RGSS Graphics for Noobs - Part 2
RGSS Graphics for Noobs - Part 3
RGSS Graphics for Noobs - Part 4

Good luck with learning how to script and how to get the scripts you find working ^_^
 
Wow nice contribution Zeriab!

I would say that if you have XP start with that. It's quite a bit easier then VX. Trust me I started with VX and was overwhelming at first. Then when I went back to XP I was like "WOW this is easy!" Then when I went back to VX I was like "Hay I know what that dose!". So I wouldn't recommend jumping right into scripting in VX.

On a side note I was practicing my RGSS2 again in VX and I made a few minor scripts! If you give me a second I'll post them here for you guys as a small tutorial. It might take a while I'm going to load them FULL of qudocode (The green text that helps you understand it but doesn't do anything lol)

One more thing maybe we should change the topic from Scripts HELP! How to activate!? To something like "Scripting: Find Support here" or something. Just saying. lol.
 
Okay...  This reply is actually for Matt.  I looked over your tutorial and I have some really noob questions.  Like this one:

Code:
def start
    super
    load_database                     # Load database
    create_game_objects               # Create game objects
    check_continue                    # Determine if continue is enabled
    
    #Part 3
    create_title_graphic              # Create title graphic
    create_command_window             # Create command window
    play_title_music                  # Play title screen music
  end

So this "start" area here.  Does this define what "start" does?  Or what "start" is?  And by adding "super" below it, is that defining what super does?  I'm a little confused because it seems that you should be defining the "start."  But you're actually defining "super."  And does this mean that it's going to DO these things when start happens, or when super happens?

Thanks.  I'll have more questions soon. lol.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top