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.

Considering this and that...

Aran

Member

I have a question for the advanced scripters.

It's that I would like to know what you guys take in to consideration when you begin to make a script.

What I mean is: is there anything you think the script should have in terms of concepts or principles or anything?
 
That may be the most general question I have ever heard in my life.
But its a good one.

First of all the script get its own module. Everything special to this script will then be created inside this module. This includes functions, classes, constants and variables.
The most important thing for me is flexibility. As often as possible the user of the script should be able to alternate the behavior of the script by passing specific arguments the functions of the script. If the script is meant to be used by other people than me, than this becomes the goal of the script, to be as flexibile as possible. Most of the feature should be, if possible, be optional and can be enabled or disabled.
Also i like my scripts to be independent from the other script inside the script-editor, if possible they should rely only on the standard-libary of ruby or if needed RGSS-classes. This minimizes the chance that another script unwillingly changes the behavior of my script. (which will surely result in either a error or odd behavior)
I override functions only in my own classes or if the script is only meant to be used by me.

Oh and if i need a certain piece of code at several places (say at least 4 places) i create a function for it.
 

Aran

Member

@Dark Zero: Yeah, it was a bit hard to word out.

@Prexus: lol, all SDK-ed out, hunh? But what do you mean by constants module? why is that a 'default' thing to do? It sounds interesting.

@MagicMagor: Thanx! But what do you mean "when you need a certain piece of code at several places"? why create a function for it?
 
Most advanced scripters create a module that will essentially hold all the options, functions, etc. to the system.

Code:
module Some_Module
  module Constants
    Option1 = 'Something'
  end
  def self.function(parameters)
  end
  module Windows
    class Something < Window_Base
    end
    class Something_Else < Window_Selectable
    end
  end
  module Scenes
    class Map < Scene_Base
    end
    class Profile < Scene_Base
    end
  end
end


What MM means by lets say you want to send some object that has properties of x and y and return them as a mini-array or something.

Code:
module ModuleName
  def self.function(object)
    return [object.x, object.y]
  end
end

Of course, nothing that simple, but something that you wouldn't want to repeat 20 some times.
 

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