Like my color guide, this guide is not meant to show or teach any specific techniques. Rather, it's aimed at complete beginners who are only just starting up with scripting. It'll introduce basic concepts, common terms, and various theories that are important (or at least useful) when reading and when writing scripts. That aside, let's get started.
I. Basic Concepts
Before anything else, what exactly is a script? In a nutshell, a script is a set of instructions written using a specific syntax that tells the engine how to do things that are beyond the scope of the default capabilities of the program. Specifically, a script is a series of instructions written outside of the engine, compiled, and then imported into the engine. As it is right now, the OHRRPGCE is rather capable by itself. You'll be able to do a great deal without ever touching scripting. Once you start wanting to implement things beyond the default capabilities of the engine though, you're going to need to do some scripting.
Because scripts are simple text files without any sort of interface, a lot of people may be scared off by the idea of mucking about with a bunch of meaningless symbols, words, and code. While it's certainly true that scripting can get very complicated, it's nowhere near as difficult as it initially seems. Some tasks are hard to do, others are easy to do, and as you gain more experience you'll get a better idea of what's possible, what's difficult, and everything in between.
The list below should give you an idea as to what sort of things you can accomplish:
- ⬆Easier⬆
- Tracking the number of battles fought
. - Moving characters around a map
. - Animating a custscene to tell the story
. - Changing a map's scenery depending on in-game vents
. - Getting guards to patrol a specific area
. - A day/night cycle or weather effects
. - Getting guards to patrol an area and attack on sight
. - Making a randomly generated map
. - A dynamic lighting system affected by walls
. - Creating a custom combat engine
. - Card Games
. - Making a platformer
⬇Harder⬇
As you can see, there are many things you can do with scripting. It'll certainly take time and effort, but all sorts of things can be done with scripting. However, when starting scripting, it's a good idea to start small before moving onto bigger and grander things. It doesn't take long to master the basics, but even so it's still important to get a firm grasp on them first.
Now that you've gotten an idea as to what scripts are, let's move on to some basic concepts in scripting.
II. Commands
If you've done any sort of coding or scripting before, you'll know that the scripts are not written in plain English. Instead, they're written using a specific set of instructions and structured in a specific way. The language used by the OHRRPGCE is called HamsterSpeak. Everything in a script is written using HamsterSpeak and is then compiled upon importing into Custom. When writing anything in HamsterSpeak, you'll need to use a specific set of commands or functions. All the different functions are listed in the <a href="http://hamsterrepublic.com/ohrrpgce/doc ... tscripting Dictionary</a> along with how they're used, their proper syntax, and examples of their usage.
These functions govern what can be done and how things are written in HamsterSpeak. An important thing to note about HamsterSpeak is that everything is case insensitive and whitespace insensitive as well. This means that the following are all identical:
Code: Select all
walk hero (me, north, 5)
WALK HERO (me, north, 5)
walkhero(me,north,5)
Walk Hero (Me, North, 5)These commands, no matter how you write them, will govern the flow of your script and how it acts. It is important then, to know what you want to do, and what the corresponding command is. Over the course of this guide, we'll be covering some of the more basic and more common commands and how to use them. We will also cover some of the more complicated or advanced ones, but not until the basics are covered.
However, commands by themselves are fairly useless. You'll need something to work with, and those are variables.
III. Variables
What exactly are variables then? In a nutshell, a variable is pretty much like a little box where you can store stuff in (programmers please pardon my description). This little box has a name, and you can use that to put things inside. You can use these variables to store many different things, a few of which are listed below:
- Values to be used in computation
- Specific NPC references
- Hero stats
- Coordinates of party members
- Tag values for plot events
- The number of items in inventory
Code: Select all
variable(
currentx
Current Y
CoUnTeR
)
In other chapters, we'll talk more about how to manipulate variables, assign values to them, and get them to do some actual work. For now, it's enough to cover what they are. There are also different types of variables, but we will cover those in greater detail later on.
And that's all for this segment, in the next article, we'll compile our first script and import it into Custom.