PDA

View Full Version : Scripting Simplified Using All-In-One RS3 Include



klamor
03-01-2018, 10:17 PM
Preface:
If this is your first time diving into the world programming/scripting the I highly suggest heading over to The Mayor's beginner scripting guide which can be found here: https://villavu.com/forum/showthread.php?t=118119
This guide assumes that you understand the basics of programming (eg. constants, variables, function, procedures, arrays, etc.) and you wish to contribute to the community All-In-One RS3 include which can be found here: https://villavu.com/forum/showthread.php?t=118119&p=1391031#post1391031

Creating a new kTask:

Pick a kTaskArea, or define a new one:
Within kTask.simba, there are several pre-defined kTaskAreas that we can use for tasks that operate within said areas. If the area you wish to use is not already defined, then simply add it to the list of vars, and initialize it within the global procedure: setupTaskAreas();
Example: var
Edgeville: kTaskArea;

procedure setupTaskAreas()
begin
Edgeville.init('Edgeville',
[(*bankLoc*)],
[(*gatherLoc*)],
[[(*objectLoc*)], [(*objectLoc*)]],
[[(*toBank*)],[(*toBank*)]],
[[(*toGather*)],[(*toGather*)]],
[[(*toObject*)],[(*toObject*)]],
'Edgeville');
end;
Each location should be filled with four points that encompass the location desired. Usually this will look like a box that is slightly larger than the area we will be botting in.
Each path should be filled with points that will navigate us to the respective locations.
The path variables are declared as two-dimensional arrays, so that we can use as many paths as we want to create randomness.
Object Locations are used for navigating to specific objects, that wouldn't normally be required.
For a more complicated task, such as crafting urns with mined clay at barbarian village, we can use object locations to find the well, the pottery wheels, and the furnace.

Define a new kTask var, and initialize it via initTasks()
var
yewCutAndBank: kTask;

procedure initTasks()
begin
yewCutAndBank.init('Cut Yews & Bank', Edgeville, SKILL_WOODCUTTING, 60, 99, [], Yew, [], [], [], [], Blue);
end;
Create a procedure specific to the task
procedure kTask.cut&bankYews()
begin
if tabBackpack.isFull() then
self.doBank(false, false)
else
self.doGatheringTask();
end;
Modify kTask.doTask() to accept our new kTask
case self.name of
'Cut Yews & Bank': self.cut&bankYews();
end;
Modify kPlayerManager.doMain() to set our task as current
self.changeTask(yewCutAndBank)


To test our new task, simply head back over to kNXT.simba and hit play! Don't forget to share what you've made over at the community All-In-One RS3 thread!