SRL Archive - OSR Help

Need help with my Alching script!


RSisDead

2012-06-17 21:31:26

Ok, so here is my code after putting execute inside my main loop
program Lukes_KickAss_Alcher;
//*********************************************************************************//
// //
// //
// WELCOME TO LUKE'S KICK ASS ALCHER! //
// Made by Fredbear/RSisDead(Simba username) //
// 1. Fill out the setup //
// 2. Hit "Run"! //
// 3. Enjoy! //
// //
// //
//*********************************************************************************//
{$DEFINE SMART}
{.include SRL/SRL/Misc/Smart.simba}
{.include SRL/SRL.simba}
{.include SRL/SRL/Skill/Magic.simba}
{$i sps/sps.simba}
{$i SRL/SRL/misc/paintsmart.simba}
var
AlchStacked :Boolean;
Function IDKWhatImDoing :extended;
begin
AlchStacked := False; // If the item you are alching is stacked (I.E arrows, bolts etc,) change this to true!
// If you are using a stacked item, place it in your second Item slot, the first being your nature runes.
Procedure Execute;
begin
smart_server := 91;
smart_members := false;
smart_signed :=true;
smart_superdetail := false;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Alch_Multislot;
end;
end;
const
NUMBER_OF_ALCHS =27; //Replace this number with the number of alchs you plan on performing


procedure DeclarePlayers;
begin
HowManyPlayers := 0;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Member := True;
Active := True;
end;
end;

procedure Alch_Multislot;
begin
while AlchStacked = False do;
Mouse(784, 190, 2, 2, true);
Mouse(571, 375, 2, 2, true);
Mouse(611, 226, 2, 2, true);
Mouse(565, 377, 2, 2, true);
Mouse(662, 221, 2, 2, true);
Mouse(577, 368, 2, 2, true);
Mouse(703, 228, 2, 2, true); // fourth slot
Mouse(566, 377, 2, 2, true);
Mouse(576, 257, 2, 2, true); //fifth slot
Mouse(566, 377, 2, 2, true);
Mouse(616, 265, 2, 2, true); // sixth
Mouse(566, 377, 2, 2, true);
Mouse(656, 262, 2, 2, true); // seventh
Mouse(566, 377, 2, 2, true);
Mouse(706, 268, 2, 2, true); // eighth
Mouse(566, 377, 2, 2, true);
Mouse(580, 297, 2, 2, true); // 9th slot
Mouse(566, 377, 2, 2, true);
Mouse(622, 297, 2, 2, true); // 10th
Mouse(566, 377, 2, 2, true);
Mouse(657, 299, 2, 2, true); // 11th
Mouse(566, 377, 2, 2, true);
Mouse(698, 303, 2, 2, true); // 12th
Mouse(577, 368, 2, 2, true);
Mouse(569, 341, 2, 2, true); // 13th
Mouse(577, 368, 2, 2, true);
Mouse(627, 330, 2, 2, true); // 14th
Mouse(577, 368, 2, 2, true);
Mouse(668, 331, 2, 2, true); // 15th
Mouse(577, 368, 2, 2, true);
Mouse(702, 342, 2, 2, true); // 16th
Mouse(577, 368, 2, 2, true);
Mouse(573, 370, 2, 2, true); // 17th
Mouse(577, 368, 2, 2, true);
Mouse(624, 369, 2, 2, true); // 18th
Mouse(577, 368, 2, 2, true);
Mouse(653, 368, 2, 2, true); // 19th
Mouse(577, 368, 2, 2, true);
Mouse(707, 373, 2, 2, true); // 20th
Mouse(577, 368, 2, 2, true);
Mouse(574, 414, 2, 2, true); // 21st
Mouse(577, 368, 2, 2, true);
Mouse(621, 407, 2, 2, true); // 22nd
Mouse(577, 368, 2, 2, true);
Mouse(656, 408, 2, 2, true); // 23rd
Mouse(577, 368, 2, 2, true);
Mouse(698, 408, 2, 2, true); // 24th
Mouse(577, 368, 2, 2, true);
Mouse(573, 447, 2, 2, true); // 25th
Mouse(577, 368, 2, 2, true);
Mouse(620, 439, 2, 2, true); // 26th
Mouse(577, 368, 2, 2, true);
Mouse(660, 439, 2, 2, true); // 27th
Mouse(577, 368, 2, 2, true);
Mouse(702, 447, 2, 2, true); // 28th
end;

Function Execute :Integer;
begin
smart_server := 91;
smart_members := false;
smart_signed :=true;
smart_superdetail := false;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Alch_Multislot;
end;
begin
end.

Now i get this error:

[Error] (26:1): Identifier expected at line 25
Compiling failed.

Based Lord

2012-06-17 21:42:10

begin
end.
This is your main loop put Execute inside and it should work.

PS - Probably do not need to use function in that situation use procedure instead. And I recommend looking at the beginner's scripting tutorials

riwu

2012-06-17 21:49:14

The [Hint] is just a …. hint, wont really cause script failure. The reason why u get the hint is because u made a function, but u did not use its result (since u are not going to use its result, u should just use procedure instead), but it doesn't really matter that much.

If u want to let the user set what they want to do (in this case AlchStacked=true/false), u should just let them set it under Const (like what u did with the NUMBER_OF_ALCHS).
Also u have: while AlchStacked = False do, while…do is actually a loop, in that case u should have just used "if (not AlchStacked) then" instead, and u will also need a begin and end. But in that case its better to use a for to do loop and MouseItem to handle it.

The reason why SMART doesn't start is because u have absolutely nothing in ur mainloop. If u create the functions/procedures but not call them in the mainloop its as good as u did not create them.

I have make some edits but it is still not a complete script because u dont have procedure to select the high alch spell yet.
program Lukes_KickAss_Alcher;
//*********************************************************************************//
// //
// //
// WELCOME TO LUKE'S KICK ASS ALCHER! //
// Made by Fredbear/RSisDead(Simba username) //
// 1. Fill out the setup //
// 2. Hit "Run"! //
// 3. Enjoy! //
// //
// //
//*********************************************************************************//
{$DEFINE SMART}
{.include SRL/SRL/Misc/Smart.simba}
{.include SRL/SRL.simba}
{.include SRL/SRL/Skill/Magic.simba}
{$i sps/sps.simba}
{$i SRL/SRL/misc/paintsmart.simba}

Const
AlchStacked=false; // If the item you are alching is stacked (I.E arrows, bolts etc,) change this to true!
// If you are using a stacked item, place it in your second Item slot, the first being your nature runes.

NUMBER_OF_ALCHS =27; //Replace this number with the number of alchs you plan on performing


procedure DeclarePlayers;
begin
HowManyPlayers := 0;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Member := True;
Active := True;
end;
end;

procedure Alch_Multislot;
var
i:integer;
begin
for i:=1 to 28 do
MouseItem(i,mouse_Left);
//see how i simplify 28lines of code into 1 line? learn more about for loops in beginner scripting tutorial
end;

procedure Execute;
begin
smart_server := 91;
smart_members := false;
smart_signed :=true;
smart_superdetail := false;
SetupSRL;
DeclarePlayers;
LoginPlayer;
if (not AlchStacked) then
Alch_Multislot;
end;

begin
Execute;
end.

RSisDead

2012-06-17 22:12:49

Ok so now my code is
program Lukes_KickAss_Alcher;
//*********************************************************************************//
// //
// //
// WELCOME TO LUKE'S KICK ASS ALCHER! //
// Made by Fredbear/RSisDead(Simba username) //
// 1. Fill out the setup //
// 2. Hit "Run"! //
// 3. Enjoy! //
// //
// //
//*********************************************************************************//
{$DEFINE SMART}
{.include SRL/SRL/Misc/Smart.simba}
{.include SRL/SRL.simba}
{.include SRL/SRL/Skill/Magic.simba}
{$i sps/sps.simba}
{$i SRL/SRL/misc/paintsmart.simba}
const
ALCHSTACKED = False; // If the item you are alching is stacked (I.E arrows, bolts etc,) change this to true!
// If you are using a stacked item, place it in your second Item slot, the first being your nature runes.
NUMBER_OF_ALCHS = 27;

procedure DeclarePlayers;
begin
HowManyPlayers := 0;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Member := True;
Active := True;
end;
end;

procedure Alch_Multislot;
begin
if ALCHSTACkED = False then;
Mouse(784, 190, 2, 2, true);
Mouse(571, 375, 2, 2, true);
Mouse(611, 226, 2, 2, true);
Mouse(565, 377, 2, 2, true);
Mouse(662, 221, 2, 2, true);
Mouse(577, 368, 2, 2, true);
Mouse(703, 228, 2, 2, true); // fourth slot
Mouse(566, 377, 2, 2, true);
Mouse(576, 257, 2, 2, true); //fifth slot
Mouse(566, 377, 2, 2, true);
Mouse(616, 265, 2, 2, true); // sixth
Mouse(566, 377, 2, 2, true);
Mouse(656, 262, 2, 2, true); // seventh
Mouse(566, 377, 2, 2, true);
Mouse(706, 268, 2, 2, true); // eighth
Mouse(566, 377, 2, 2, true);
Mouse(580, 297, 2, 2, true); // 9th slot
Mouse(566, 377, 2, 2, true);
Mouse(622, 297, 2, 2, true); // 10th
Mouse(566, 377, 2, 2, true);
Mouse(657, 299, 2, 2, true); // 11th
Mouse(566, 377, 2, 2, true);
Mouse(698, 303, 2, 2, true); // 12th
Mouse(577, 368, 2, 2, true);
Mouse(569, 341, 2, 2, true); // 13th
Mouse(577, 368, 2, 2, true);
Mouse(627, 330, 2, 2, true); // 14th
Mouse(577, 368, 2, 2, true);
Mouse(668, 331, 2, 2, true); // 15th
Mouse(577, 368, 2, 2, true);
Mouse(702, 342, 2, 2, true); // 16th
Mouse(577, 368, 2, 2, true);
Mouse(573, 370, 2, 2, true); // 17th
Mouse(577, 368, 2, 2, true);
Mouse(624, 369, 2, 2, true); // 18th
Mouse(577, 368, 2, 2, true);
Mouse(653, 368, 2, 2, true); // 19th
Mouse(577, 368, 2, 2, true);
Mouse(707, 373, 2, 2, true); // 20th
Mouse(577, 368, 2, 2, true);
Mouse(574, 414, 2, 2, true); // 21st
Mouse(577, 368, 2, 2, true);
Mouse(621, 407, 2, 2, true); // 22nd
Mouse(577, 368, 2, 2, true);
Mouse(656, 408, 2, 2, true); // 23rd
Mouse(577, 368, 2, 2, true);
Mouse(698, 408, 2, 2, true); // 24th
Mouse(577, 368, 2, 2, true);
Mouse(573, 447, 2, 2, true); // 25th
Mouse(577, 368, 2, 2, true);
Mouse(620, 439, 2, 2, true); // 26th
Mouse(577, 368, 2, 2, true);
Mouse(660, 439, 2, 2, true); // 27th
Mouse(577, 368, 2, 2, true);
Mouse(702, 447, 2, 2, true); // 28th
Alch_Multislot;
end;
Function Execute :Integer;
begin
smart_server := 91;
smart_members := false;
smart_signed :=true;
smart_superdetail := false;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Alch_Multislot;
end;


begin
Execute;

end.

It says Out of Range at line 32 if i fill in my username or password, it now starts up the client but doesnt actually do anything.

riwu

2012-06-17 22:24:17

Did u fill ur username&pw within the ' ' thing? And all ur coordinates seem to be wrong. U did not drag the crosshair to the RS client when reading the coordinate (so ur points are outside of RS window). U should just use InvMouse/MouseItem though, its much easier, accurate, wider coordinate randomness. But u dont have the choose spell procedure yet so all its going to do is to click ur whole inven slots?