SRL Archive - OSR Help

Variables?


okokokok

2012-02-22 13:49:16

Hello SRL

I am working on my script for SIN's competition and i want to make some constants, but i can't really get them to work.

The variable is:


const
WaitTime = '';
//Desired time to wait after clicking a guard
//Determine this by checking it yourself (depends on cb level)
//WaitTime = '1000' Means the script will wait 1 s after clicking the guard

The piece of code where it should be added (check WaitTime in the code after clicking):


procedure FightGuards;
var x, y, i: Integer;
Guard: Array [0..13] of Integer;
begin
Writeln('Looking for a Guard');
Guard[0] := DTMFromString('mQwAAAHicY2ZgYDgDxKeA+DwQrwDipUC8HIhtra0ZvNzcGAz09Bj4gXwQZkTDQAAANLYGlA==');
Guard[1] := DTMFromString('mQwAAAHicY2ZgYIhnZGBIAeIEIPYE8t2B2AdEW4kyeNuJM9ibCDPAAD8QMyJhIAAAqicD1A==');
Guard[2] := DTMFromString('mQwAAAHicY2ZgYJBmZGCQBGI5IK4D8quBuAaIo8PDGRLjYsEYBviBmBEJAwEAyLcFIQ==');
Guard[3] := DTMFromString('mQwAAAHicY2ZgYGBkZGD4B6T/AnEAEPsCcTAQ11ZWMORlZYJpGOAHqUfCQAAAK6gHIA==');
Guard[4] := DTMFromString('mQwAAAHicY2ZgYPgKxJ+A+DMQezAyMHgCsSsQWxkqMLhbqzP4OWozwAA/EDMiYSAAABO8Bbc=');
Guard[5] := DTMFromString('mQwAAAHicY2ZgYDgGxIeh2IWRgcEdiJ2A2FRHliFZS44hyFWXAQb4gZgRCQMBAPDzBR8=');
Guard[6] := DTMFromString('mQwAAAHicY2ZgYDgPxKeB+BIQbwPinVBaWVmaQUFBAoxhgB+IGZEwEAAAGnoFuA==');
Guard[7] := DTMFromString('mQwAAAHicY2ZgYNBnZGDQAmIDIH7BAMFvgVhHR4lBWVmaQVNTgQEG+IGYEQkDAQDPmwSs');

for i:= 0 to 7 do
If FindDTM(Guard[i], x, y, MSX1, MSY1, MSX2, MSY2) then
begin
Writeln('Guard found KILL IT!');
MMouse(x,y,0,0);
Wait(50 + (random(50)));
repeat
Wait(50 + random(50));
case Random(2) of
0:
begin
Mouse(x,y,0,0,false);
ChooseOption('ttac');
Writeln('Derpin it like a baws');
Wait(WaitTime + Random(1000));
end;
1:
Begin
Mouse(x,y,0,0,true);
Writeln('Derpin it like a baws');
Wait(WaitTime + Random(1000));
end;
end;
until (InFight) or (not OthersInFight) or (not LoggedIn)
end;
FreeDTM(Guard[0]);
FreeDTM(Guard[1]);
FreeDTM(Guard[2]);
FreeDTM(Guard[3]);
FreeDTM(Guard[4]);
FreeDTM(Guard[5]);
FreeDTM(Guard[6]);
FreeDTM(Guard[7]);
end;

I would really appreciate the help!

greetz

poopy2177

2012-02-22 14:38:59

you have
const
WaitTime = '';
should be
const
WaitTime = 1000; // example of waiting one second
no '' on it that's like saying Wait('5000');
if it was for example
const
WhatToWrite = 'boobs'; //then it would have ''

procedure boobs;
begin
WriteLn(WhatToWrite);
end;

begin
boobs;
end.

okokokok

2012-02-23 02:33:25

Ok thanks for your help, but i have one more question left.
I want to make the script eat too, atm i use a lobster DTM, so the script will eat lobsters only atm. Do i have to make a procedure or something to support multiple foods for the script?

Runescape Pro

2012-02-23 02:41:01

You dont have to but that would be better. And for the variables question, if you want to store a number in a constant, you dont need the little dashes because that is for surrounding a string. Like: FoodToUse = 'lobster';//options: lobster, swordfish, monkfish, shark

You could do a procedure to load the food dtms and have the dtm variable be set globally(at the beginning of a script, not in a proc/func).