Log in

View Full Version : Add potion drinking to a script?



zmarchbank
05-31-2012, 04:19 AM
I'm using a stay logged in script at bandits and I wanted to know if there's an easy way to add taking doses of super sets into the script. Would that be relatively easy or even possible? Would the entire script have to be rewritten?

riwu
05-31-2012, 05:03 AM
It would be extremely easy, u just need to add MarkTime(t); to ur setup, then a procedure to ur mainlooop, like:
if (TimeFromMark(t)>500000) then //how long you want it to wait before it drinks again
begin
DrinkPotion; //make this procedure using either color or DTM
MarkTime(t);
end;

CephaXz
05-31-2012, 05:21 AM
It would be extremely easy, u just need to add MarkTime(t); to ur setup, then a procedure to ur mainlooop, like:
if (TimeFromMark(t)>500000) then //how long you want it to wait before it drinks again
begin
DrinkPotion; //make this procedure using either color or DTM
MarkTime(t);
end;

Well, I'm also curious to know about this. From what you had said, I assume you made it drink the potion when you reached the fighting spot, then after 500000ms, you drink again. What happens after that? What if I have 10 potions to drink? I have to make 40 codes like that? With 1 each dose of potion.

EDIT: Oh wait. I think I just understood the code LOL.

zmarchbank
05-31-2012, 05:22 AM
I'm just learning scripting so I'm not really sure how to implement what you said. I want to take doses of super attack and super strength. Not sure exactly how to do that just based on what you said.

Er1k
05-31-2012, 05:30 AM
Riwu is correct with the general idea. You first need to detect where your supersets are, and then you drink them, mark time, and after time T has elapsed, drink again.

I am working on a potting include, I'll see I can do anything about releasing it later.

zmarchbank
05-31-2012, 05:31 AM
Thank you guys for your replies and help. Here is the script I'm using.


program R4StayLoggedIn;
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}
//{$i SRL/SRL/misc/paintsmart.simba}

var
//CStatus: String;
x, y :Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; // This is the player to start with
Players[0].Name := ''; // Username
Players[0].Pass := '; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username;
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;

{Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,8388736);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end; }

{function GetRandomFact: string;
//This function returns a random fact from
// the website 'http://randomfactgenerator.net/'
// Author: kanah
// Special thanks to Euphemism for the idea
var
SearchString0, SearchString1, Text: string;
begin
//Search strings are used to mark the begining and end of useful info
SearchString0 := '<div id="facts">';
SearchString1 := '<br/><br/>';

//Text is loaded with the raw html text from the website
Text := GetPage('http://randomfactgenerator.net/');

//Text is now broken down from the entire html page into the random fact
Text := Between(SearchString0,SearchString1,Text);

//Now trim to remove spaces and get rid of the "<div>" text
Trim(Text);
delete(Text,1,pos('>',Text));
Result := Text;
Wait(randomrange(5000, 10000));
end;


Procedure Painting;
begin
PrintOnSmart(['R4_StayLoggedIn','-----------', 'Status:', CStatus,
'-----------', 'Fact:', GetRandomFact], Point(40, 50),16777215);
end; }


procedure Antiban;
begin
case Random(60) of
10: RandomRClick;
20: HoverSkill(SKILL_ATTACK + Random(SKILL_DUNGEONEERING + 1), False);
30: PickUpMouse;
40: RandomMovement;
50: BoredHuman;
59: ExamineInv;
end;
end;

{procedure RandomComments;
begin
case Random(60) of
10: CStatus := 'Randomly Moving';
20: CStatus := 'So so bored';
30: CStatus := 'Lifting the mouse';
40: CStatus := 'Randomly moving...';
50: CStatus := 'I bored.';
59: CStatus := 'Staying logged in...';
end;
Painting;
end; }
Procedure Loop();
begin
repeat
Antiban;
{RandomComments;}
FindNormalRandoms;
Wait(1000+Random(1000));
until false;
end;


begin
{
case Random(60) of
10: CStatus := 'Randomly Moving';
20: CStatus := 'So so bored';
30: CStatus := 'Lifting the mouse';
40: CStatus := 'Randomly moving...';
50: CStatus := 'I bored.';
59: CStatus := 'Staying logged in...';
end; }
Smart_Server := 1;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
{Painting; }
Loop;
end.


It's R4and0m's stay logged in script with a couple modifications. Where would I put the pot drinking code? Sorry for the noob questions.

riwu
05-31-2012, 05:38 AM
Put the marktime(t) after loginplayer,
and the if timefrommark thing in the procedure call "Loop" (within the repeat..until loop);
You'll also have to make another "DrinkPotion" procedure:
procedure DrinkPotion;
begin
if Findcolortolerance/FindDTMblabla then //learn about these functions (http://villavu.com/forum/forumdisplay.php?f=191) if u dont know how to use them
Mouse(x1,y1,5,5,true);
wait(randomrange(500,1500);
if FindColorblabla then
Mouse(x2,y2,5,5,true); //for ur 2nd potion if u r drinking 2
end;
U will also have to declare these variables, refer to the scripting tutorials if u dont know what that means.