SCAR Code:
{By Nght Spud
Its basically a demonstration of what can be done with remote control.
This script adds anyone that messages you to its friends.
If someone messages the caracter logout, the character should log out
Feel free to copy anything from this script just gimme credit please.
It could be used as anything from a autoreplier, too a command reciever
to change what the script does.
Have fun adding new commands}
program Remotecontrol;
{.include SRL/SRL.scar}
{.include SRL/SRL\Misc\Friends.scar}
var text,fid,tof,username:string;
k,l:integer;
const
mastername='------'; //put mastername here
{
function: CombatCalc(username:String):String;
By: Nght Spud
Description: Finds a users combat level by looking at the
runescape highscores}
function CombatCalc(username:String):String;
var A,B,C,Base,D,E,F,G,MeleeClass,RangeClass,MageClass,M,CMB:Extended;
Attack,Strength,Defence,Mage,Range,Prayer,Hitpoints,k:integer;
Page,t1,t2,t3:String ;
begin
Page:=(GetPage('http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1='+username) );
t1:=(between('Attack','</tr>',Page)) ;
t2:=(between('</td>'+Chr(10)+'<td align="right">','</td>',t1))
t3:=(between(t2+'</td>'+Chr(10)+'<td align="right">','</td>',t1))
if (not(t3=''))then Attack:=(strtoint(t3)) else Attack:=1
t1:=(between('Strength','</tr>',Page)) ;
t2:=(between('</td>'+Chr(10)+'<td align="right">','</td>',t1))
t3:=(between(t2+'</td>'+Chr(10)+'<td align="right">','</td>',t1))
if (not(t3=''))then Strength:=(strtoint(t3)) else Strength:=1
t1:=(between('Defence','</tr>',Page)) ;
t2:=(between('</td>'+Chr(10)+'<td align="right">','</td>',t1))
t3:=(between(t2+'</td>'+Chr(10)+'<td align="right">','</td>',t1))
if (not(t3=''))then Defence:=(strtoint(t3)) else Defence:=1
t1:=(between('Magic','</tr>',Page)) ;
t2:=(between('</td>'+Chr(10)+'<td align="right">','</td>',t1))
t3:=(between(t2+'</td>'+Chr(10)+'<td align="right">','</td>',t1))
if (not(t3=''))then Mage:=(strtoint(t3)) else Mage:=1
t1:=(between('Range','</tr>',Page)) ;
t2:=(between('</td>'+Chr(10)+'<td align="right">','</td>',t1))
t3:=(between(t2+'</td>'+Chr(10)+'<td align="right">','</td>',t1))
if (not(t3=''))then Range:=(strtoint(t3)) else Range:=1
t1:=(between('Prayer','</tr>',Page)) ;
t2:=(between('</td>'+Chr(10)+'<td align="right">','</td>',t1))
t3:=(between(t2+'</td>'+Chr(10)+'<td align="right">','</td>',t1))
if (not(t3=''))then Prayer:=(strtoint(t3)) else Prayer:=1
t1:=(between('Hitpoints','</tr>',Page)) ;
t2:=(between('</td>'+Chr(10)+'<td align="right">','</td>',t1))
t3:=(between(t2+'</td>'+Chr(10)+'<td align="right">','</td>',t1))
if (not(t3=''))then Hitpoints:=(strtoint(t3)) else Hitpoints:=10
A:= (Defence*100)
B:= (Hitpoints*100)
k:=Prayer+1;
if ((Prayer/2)+0.5=k/2)then C:=((Prayer-1)*50)else C:=Prayer*50;
Base:=((a+b+c)/400)
D:=Attack*130
E:=Strength*130
k:=Range+1;
if ((Range/2)+0.5=k/2)then F:=((Range*195)-65)else F:=Range*195;
k:=Mage+1;
if ((Mage/2)+0.5=k/2)then G:=((Mage*195)-65)else G:=Mage*195;
MeleeClass:=((D+E)/400)
RangeClass:=(F/400)
MageClass:=(G/400)
M:=MaxE(MeleeClass,RangeClass)
M:=MaxE(M,MageClass)
CMB:=M+Base
Result:=(floattostr(CMB))
end;
{
function: ToOrFrom: String;
By: Nght Spud
Description: Finds out if you messaged someone, or they messaged you.
Returns with 'to' or 'from'.}
function ToOrFrom: String;
begin
if (IsTextAtEx(20, 415,'To',0, SmallChars, False,
False, 0, 1, 0))
then result:='to';
if (IsTextAtEx(20, 415,'From',0, SmallChars, False,
False, 0, 1, 0))
then result:='from';
end;
{
function: GetBlackChatName: String;
By: Nght Spud
Description: Gets the name of who your talking to.
Returns with their name}
function GetBlackChatName: String;
var messagefrom:string;
begin
if (IsTextAtEx(20, 415,'To',0, SmallChars, False,
False, 0, 1, 0))
then messagefrom:='to';
if (IsTextAtEx(20, 415,'From',0, SmallChars, False,
False, 0, 1, 0))
then messagefrom:='from';
if (messagefrom='from') then
Result := Trim(GetTextAtEx(50, 415, 0, SmallChars, False,
False, 0, 1, 0, 80, False, tr_AlphaNumericChars));
if (messagefrom='to') then
Result := Trim(GetTextAtEx(35, 415, 0, SmallChars, False,
False, 0, 1, 0, 80, False, tr_AlphaNumericChars));
end;
{
function: IsWordSaid(Text:string):boolean;
By: Nght Spud
Description: Looks across the whole PM for a certain word
works even if there is text before, or after
the word. Returns true if word is found.}
function IsWordSaid(Text:string):boolean;
var x,y:integer;
begin
if (IsTextInAreaEx(20, 415,470, 430,x,y,Text,0,SmallChars, False,
False,0,1,128)=true)then result:=true
else result:=false;
end;
{
function: RcSayCommand(Start,Finish:string):String ;
By: Nght Spud
Description: Looks at what is said, and returns what is
said between the words you declared.
i.e. RcSayCommand('Say:','Fin:')would return
the words between Say: and Fin:}
function RcSayCommand(Start,Finish:string):String ;
var text:string;
begin
Text:=Trim(GetTextAtEx(20, 415, 0, SmallChars, False,
False, 0, 1, 128, 80, False, tr_AllChars));
Result:=Between(Start,Finish, Text);
end;
{
function: GetLvlCommand(Command:string):String ;
By: Nght Spud
Description: Finds a users level by looking at the runescape
highscores}
function GetLvlCommand(Command:string):String ;
var a,b,c,text,Level,Name:string;
begin
Text:=Trim(GetTextAtEx(20, 415, 0, SmallChars, False,False, 0, 1, 128, 80, False, tr_AllChars))
Name:=(between(Command+' ',',',Text));
Writeln(Name)
Level:=(between(',','?',text))
Writeln(Level)
a:=(GetPage('http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1='+Name) )
b:=(between(Level,'</tr>',a))
c:=((between('</td>'+Chr(10)+'<td align="right">','</td>',b)))
Result:=(between(c+'</td>'+Chr(10)+'<td align="right">','</td>',b))
end;
procedure readndwrite;
begin
wait(500);
tof:=ToOrFrom;
fid:= GetBlackChatName;
text:= RCReadCommand;
writeln(tof+' '+fid+' : '+text)
if (tof='from')
then begin
if (not(FriendIsOnline(k,l,fid)))
then AddFriend(fid)
end;
if (IsWordSaid('Logout')// this is where the logout command is recieved
and (fid=mastername)) // how to add security.
then begin
logout;
writeln('got msg logout, logging out');
end;
if IsWordSaid('Hi') // this is where the hi command is recieved
then begin
MessageFriendEx(fid,'Hey') //how it can be used to autorespond
writeln('got msg hi,replied')
end;
if IsWordSaid('Say:') // this is where the Say: command is recieved
then begin
TypeSend(RcSayCommand('Say:','Fin:')) //Says whats in between the two words
writeln('got msg Say,Said it')
end;
if IsWordSaid('What is')
then begin
MessageFriendEx(fid,(GetLvlCommand('What is')));
writeln('got msg What is, told them lvl')
end;
if IsWordSaid('combat')
then begin
Text:=Trim(GetTextAtEx(20, 415, 0, SmallChars, False,False, 0, 1, 128, 80, False, tr_AllChars))
username:=(Trim(between('What ',' combat',text)));
writeln('username is '+username);
MessageFriendEx(fid,(CombatCalc(username)));
writeln('got msg combat, told them lvl')
end;
end;
begin
activateclient;
MouseSpeed:=10
wait(5000);
SetChat('off',1);
SetChat('off',3);
repeat
MouseSpeed:=(10+random(5))
readndwrite;
if(FlagDistance<10)then MouseBox(MMX1, MMY1, MMX2, MMY2, 1);
until (false);
end.