Making A Setup Procedure
By: StickToTheScript
Intro
Hello, everyone.
Today, I will be showing you how to write a setup for a script. We will learn how to login the player, exit the squeal of fortune, open or close the Action Bar, XP Bar, Money Pouch, and even turn on your character's run.
Before We Start
Before we start, let's make sure we have the basic default script.
Copy and paste this into Simba.
Simba Code:
program new;
{$DEFINE SMART8} //I have SMART8 installed. If you dont, remove the '8'. If you dont know, open press play and if you get a SMART PARAMS error, then you have 7.2. XD
{$i srl/srl.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].Active := True; // Set to true if you want to use Player 0
end;
begin
end.
Then, go to file and select "Save As Default"
Now that you have your basic script ready, let's get started.
Basics of the Procedure
Ok. To start, we will want to create a procedure by the name of "setup".
You should have this:
Simba Code:
procedure Setup;
begin
end;
This is the procedure that you will be making your setup run in!
The first thing we will want to do is place the following in the beginning of the setup.
Simba Code:
SetupSRL;
DeclarePlayers;
LoginPlayer;
These are the basics of the setup. The first one, "SetupSRL", is what you call in order to be able to use the SRL Include. "DeclarePlayers" calls the procedure named "DeclarePlayers", which you copied and pasted earlier. Then, you have "LoginPlayer" which is a procedure that allows you to login your player.
So, you should have a script that looks like this:
Simba Code:
program new;
{$DEFINE SMART8} //I have SMART8 installed. If you dont, remove the '8'. If you dont know, open press play and if you get a SMART PARAMS error, then you have 7.2. XD
{$i srl/srl.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].Active := True; // Set to true if you want to use Player 0
end;
procedure Setup;
begin
SetupSRL;
DeclarePlayers;
CheckSRLStats;
LoginPlayer;
end;
begin
end.
The Message
So, a lot of people tend to put a welcome message at the beginning of their script. This will show you how.
First off, you will want to know how to use Writeln. To properly use it, all you have to do is write:
Do notice the brackets and apostrophe? Inside the apostrophe you write your message you wish to display. So, we will write the following in our setup procedure:
Simba Code:
Writeln('');
Writeln('You''re reading StickToTheScript''s tutorial on Setups!');
Writeln('Please report anything on the thread along with anything else you wish to say! XD');
Writeln('Thanks!');
Writeln('');
So, as you see, i have the "Writeln('');" at the top and the bottom of the main text. This allows it to be paragraphed. It is just like pressing enter; it gives you a blank line.
So, if you were to run this, your debug box should say:
Code:
You're reading StickToTheScript's tutorial on Setups!
Please report anything on the thread along with anything else you wish to say! XD
Thanks!
So, all together, your script should show:
Simba Code:
program new;
{$DEFINE SMART} //I have SMART8 installed. If you dont, remove the '8'. If you dont know, open press play and if you get a SMART PARAMS error, then you have 7.2. XD
{$i srl/srl.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].Active := True; // Set to true if you want to use Player 0
end;
procedure Setup;
begin
SetupSRL;
Writeln('');
Writeln('You''re reading StickToTheScript''s tutorial on Setups!');
Writeln('Please report anything on the thread along with anything else you wish to say! XD');
Writeln('Thanks!');
Writeln('');
DeclarePlayers;
LoginPlayer;
end;
begin
setup;
end.
Notice that I have the setup in between the last begin and end? That lets the script run the setup procedure.
Now, your script will display a message, then login, and then your script will end. So, now all you need to do it take this and put it in your script.
The Extras
Now, there are a lot of extra things that people like to use in their setups. In this case, I will show you how to Exit the squeal of fortune, open or close the action bar, the xp bar, money pouch, and turn on your run.
Squeal Of Fortune
Ok. So, we start with exiting the squeal of fortune. To do this, all you need to add is this:
Simple, right? Yes and the following are simple as well.
Action Bar
The action bar is primarily used for Combat (So definitely attempt to use it for your combat scripts) but is also used for other simple and basic skills. You can use it for dropping, eating, etc.
For the action bar you will also want to put in a single line of code that looks like this:
This should also appear fairly simple. You are toggling the action bar. When the word in the brackets is false, then the action bar will be closed. If the word is true, then the action bar will be opened. Get it? XD
XP Bar
The XP bar keeps track of your XP Gain while you train a skill. For the XP Bar, it is roughly the same as the Action bar. You will want to use the following:
Again, the True means that the XP bar is open. False means the XP bar is closed.
Money Pouch
Your Money Pouch is primarily used to hold your coins. You can use it to track how many GP's you picked up or just to view the amount of money you have.
For this, you will want to write this:
And yes, the True means that the Money Pouch is open and False means the Money Pouch is closed.
Turn On Run
Turning on your run allows the player to run. The following is a very simple, built-in way of toggling it.
First you would want to write:
This allows you to set your run on. True = On. False = Off.
So, all together your script should now look like this:
Simba Code:
program new;
{$DEFINE SMART} //I have SMART8 installed. If you dont, remove the '8'. If you dont know, open press play and if you get a SMART PARAMS error, then you have 7.2. XD
{$i srl/srl.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].Active := True; // Set to true if you want to use Player 0
end;
procedure Setup;
begin
SetupSRL;
Writeln('');
Writeln('You''re reading StickToTheScript''s tutorial on Setups!');
Writeln('Please report anything on the thread along with anything else you wish to say! XD');
Writeln('Thanks!');
Writeln('');
DeclarePlayers;
LoginPlayer;
ExitSquealofFortune;
ToggleActionBar(False);
ToggleXPBar(True);
ToggleMoneyPouch(False);
SetRun(True);
end;
begin
setup;
end.
And that should be the very basics of it. The script will now print the message, login, exit the squeal of fortune, make sure the action bar is closed, make sure the XP bar is open, make sure the money pouch is closed and have your run on. Then, the script should terminate.
Conclusion
So, now you have the basic idea of how to write a setup in your scripts.
If you wanted, you could always have other setup procedures in your script that you could call. These would consist of loading DTMs, Bitmaps, SPS setup, XP Counters, Change the angle of camera, face the camera in a certain direction, etc.
So, there you go!
Hope that this has helped in one way or another.
Please let me know if there is a typo that you came across, or any issues with the coding. I will happily fix those. XD
If there is anything else that should be added, please let me know!
Feel free to also Comment, +Rep, or do whatever you want! XD
Thanks!
StickToTheScript