SRL Archive - First Scripts

Here is a VERYYYYYYY basic Guilded altar script


nero_dante

2015-06-03 21:48:15

Hey, I need 95 prayer, and so I decided to try a bit more scripting. This script is INCREDIBLY bare. However it does do the job…. kinda. I would love for more feedback on this.


These are the requirements for this to work however………


  • Have completed Elder Kiln Quest for the ToKkul ring
  • Have preset like I show
  • Have altar North of your house entrance like I show
  • Make sure your action bar looks like mine
  • Make sure you have enough Bones, clean Marrentill and House Teletabs

Action bar must have the ring in slot 2 and the teletab in slot 3 (forget about the summoning in slot 1, that's just there in case I am able to implement summoning in the future)


The preset must have the inventory with those items (Of course change to whichever bones you are using) The equipment MUST have the ring there, or no teleporting back


Set you House to look like this. your altar must be north of the entrance and the incense burners must be on each side like that.


(v0.2) Few little tweaks, inserted player form (still no antiban though, will bring that out once i fix it sometimes not clicking the banker because he moves around) ¬_¬
(v0.3) should last a little longer, will still mess up if the banker moves when trying to click him, if anyone can help with that. Let me know if there is a way to repeat that specific section until the banker is found etc. Also, when clicking altar, it now uses colour for it and the mouse randomly goes off the screen, as a very tiny antiban. :P

yourule97

2015-06-03 22:04:24

Yay, congrats on your first script! It's pretty well done for a first script, but here are some pointers if you'd like them.

For your "SwitchtoNorthHigh" procedure, there's no need to make your own method to click the compass as there is one already defined as minimap.clickCompass() which accomplishes the same thing.

I see that you have a decent grasp of scripting so far, but you should try to use some sort of coding convention in your scripting style. Personally, I use the Java style as I picked that up when I learned comp sci so something like "SwitchtoNorthHigh" would instead be "switchToNorthHigh." This can also be applied to variables. Java would change "resetcamera" to "resetCamera." It's all up to you, and people range greatly on their styles, but its good practice to be consistent.

While we are on the topic of conventions, I see that some of the spacing is iffy. Some procedures haven't been indented at all, and some spacing is a little weird. I learned the particular conventions for Lape while reading some other people's scripts on this forum. Again, the code works, but it's just easier to read for other people and is good practice to practice the little things.

Lastly, it's also quite important in scripting for Runescape in general to use a random range for wait times as static waiting times is repetitive and suspicious to Jagex. Some people choose to use randomRange(x, y) to generate a random number between x and y for their wait times, other like to use gaussRangeInt(x, y) for a slightly different distributed number range.

nero_dante

2015-06-03 22:35:00

From: yourule97
Yay, congrats on your first script! It's pretty well done for a first script, but here are some pointers if you'd like them.

For your "SwitchtoNorthHigh" procedure, there's no need to make your own method to click the compass as there is one already defined as minimap.clickCompass() which accomplishes the same thing.

I see that you have a decent grasp of scripting so far, but you should try to use some sort of coding convention in your scripting style. Personally, I use the Java style as I picked that up when I learned comp sci so something like "SwitchtoNorthHigh" would instead be "switchToNorthHigh." This can also be applied to variables. Java would change "resetcamera" to "resetCamera." It's all up to you, and people range greatly on their styles, but its good practice to be consistent.

While we are on the topic of conventions, I see that some of the spacing is iffy. Some procedures haven't been indented at all, and some spacing is a little weird. I learned the particular conventions for Lape while reading some other people's scripts on this forum. Again, the code works, but it's just easier to read for other people and is good practice to practice the little things.

Lastly, it's also quite important in scripting for Runescape in general to use a random range for wait times as static waiting times is repetitive and suspicious to Jagex. Some people choose to use randomRange(x, y) to generate a random number between x and y for their wait times, other like to use gaussRangeInt(x, y) for a slightly different distributed number range.


The reason i made my own switchtoNorthHigh procedure, is because the already defined one, doesn't make put it completely north for some reason.

yourule97

2015-06-03 22:39:23

minimap.clickCompass() is not the same as minimap.setAngle(MM_DIRECTION_NORTH) which is what I think you are thinking of. I don't like to use the latter method as well.

It literally clicks the compass, which is exactly what your procedure does.

nero_dante

2015-06-03 22:47:08

From: yourule97
minimap.clickCompass() is not the same as minimap.setAngle(MM_DIRECTION_NORTH) which is what I think you are thinking of. I don't like to use the latter method as well.

It literally clicks the compass, which is exactly what your procedure does.


ohhh, I get you. Yeah I'll implement that now :) then I'll bring out my next little tweaked version :P

nero_dante

2015-06-03 23:07:59

Guys I have attempted to implement
if (tabBackpack.isEmpty) then
this into the script so that I don't have to make it wait a random time when finishing off an inventory, however, as soon as it clickes to offer the altar it just instantly goes to the next step in the script. Any reason for this?


[SIMBA=procedure ClickAltar();
var
Altar: Tbox;
begin
wait(gaussRangeInt(3000,3400));
Altar := intTobox(200, 157, 245, 183);
mouseBox(Altar, MOUSE_RIGHT);
chooseOption.select(['ffer Altar'], 200)
end;

procedure OfferBones();
begin
mouseOffClient(OFF_CLIENT_RANDOM);
if (tabBackpack.isEmpty) then
end;

procedure TeleportToBank();
begin
typeSend('2', false);
wait(1000);
conversationBox.selectOption(2);
wait(gaussRangeInt(3000,3400));
end; ]

J_R

2015-06-03 23:49:59

You're not looping in OfferBones so it sees that the backpack isn't empty and says "great, I'm done! Next step"

you need to replace the if with:

repeat
wait(xxxx); //can do other antiban here if you want
until(tabbackpack.isempty);
so that your script keeps looping until the backpack is empty and doesn't exit immediately

Citrus

2015-06-04 00:27:25

From: nero_dante
Guys I have attempted to implement
if (tabBackpack.isEmpty) then
this into the script so that I don't have to make it wait a random time when finishing off an inventory, however, as soon as it clickes to offer the altar it just instantly goes to the next step in the script. Any reason for this?


[SIMBA=procedure ClickAltar();
var
Altar: Tbox;
begin
wait(gaussRangeInt(3000,3400));
Altar := intTobox(200, 157, 245, 183);
mouseBox(Altar, MOUSE_RIGHT);
chooseOption.select(['ffer Altar'], 200)
end;

procedure OfferBones();
begin
mouseOffClient(OFF_CLIENT_RANDOM);
if (tabBackpack.isEmpty) then
end;

procedure TeleportToBank();
begin
typeSend('2', false);
wait(1000);
conversationBox.selectOption(2);
wait(gaussRangeInt(3000,3400));
end; ]


As J_R said, there is no loop and nothing written after then, so it will just run right though it. I prefer while do over repeat until in this situation

procedure offerBones();
begin
mouseOffClient(OFF_CLIENT_LEFT);
while (not tabBackPack.isEmpty()) do wait(500);
end;
You can improve your teleport function by replacing the static wait() with conversationBox.isOpen(waitTime)

if conversationBox.isOpen(1000) then
if conversationBox.selectOption(2) then
wait(gaussRangeInt(3000, 3400);

nero_dante

2015-06-04 00:27:35

From: J_R
You're not looping in OfferBones so it sees that the backpack isn't empty and says "great, I'm done! Next step"

you need to replace the if with:

repeat
wait(xxxx); //can do other antiban here if you want
until(tabbackpack.isempty);
so that your script keeps looping until the backpack is empty and doesn't exit immediately



Soooo I could put

[SIMBA=, 200)
end;

procedure OfferBones();
begin
mouseOffClient(OFF_CLIENT_RANDOM);
until(tabBackpack.isEmpty) then
end;

procedure TeleportToBank();
begin
typeSend('2', false);
wait(1000);
conversationBox.selectOption(2);
wait(gaussRangeInt(3000,3400));
end;]

or would that not solve it?

nero_dante

2015-06-04 00:29:34

From: evilcitrus
As J_R said, there is no loop and nothing written after then, so it will just run right though it. I prefer while do over repeat until in this situation

procedure offerBones();
begin
mouseOffClient(OFF_CLIENT_LEFT);
while (not tabBackPack.isEmpty()) do wait(500);
end;
You can improve your teleport function by replacing the static wait() with conversationBox.isOpen(waitTime)

if conversationBox.isOpen(1000) then
if conversationBox.selectOption(2) then
wait(gaussRangeInt(3000, 3400);


Thanks :) …. I'll change the conversation box teleport in next lot of fixes :)

Still need to find a way to repeat the steps of finding the banker if it misses to find it. Any help on that?

Citrus

2015-06-04 00:51:34

From: nero_dante
Soooo I could put



procedure OfferBones();
begin
mouseOffClient(OFF_CLIENT_RANDOM);
until tabBackpack.isEmpty) then
end;

or would that not solve it?


No, there is still no loop. You have until but no repeat. You also don't need a then after until, just something equivalent to true or false.

As for banking, I usually make it a function that returns a boolean and use if bank() then … in my mainLoop

There's something weird going on with your simba tags. Just put 'simba' in brackets and '/simba' also in brackets (no quotes)

mocrosoft

2015-06-04 01:40:59

Gratz on your first, script, looks nice for your first script maynn

nero_dante

2015-06-04 14:09:04

From: evilcitrus
As J_R said, there is no loop and nothing written after then, so it will just run right though it. I prefer while do over repeat until in this situation

procedure offerBones();
begin
mouseOffClient(OFF_CLIENT_LEFT);
while (not tabBackPack.isEmpty()) do wait(500);
end;
You can improve your teleport function by replacing the static wait() with conversationBox.isOpen(waitTime)

if conversationBox.isOpen(1000) then
if conversationBox.selectOption(2) then
wait(gaussRangeInt(3000, 3400);


Can't seem to get the conversation box way your saying to work at all.

yourule97

2015-06-04 15:45:04

It should be something like

procedure TeleportToBank();
begin
typeSend('2', false);
if conversationBox.isOpen(1000) then
if conversationBox.selectOption(2) then
wait(gaussRangeInt(3000, 3400);
end;

Also, indentation should be


procedure doSomething
var
i : integer;
begin
//code
end;