Results 1 to 18 of 18

Thread: An Example of Remote Control

  1. #1
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default An Example of Remote Control

    This is only my second script so please gimme ideas how to improve it.
    Ok this is a script I just wrote, and it basically is an example of how Remote control can be used. It contains six functions I wrote myself.
    • One function is to see if you got a message to, or from, and returns 'to' or 'from'.
    • The second function finds out who you messaged / messaged you.
    • The third function looks across the whole PM for a certain word works even if there is text before, or after the word. Returns true if the word is found.
    • The fourth function Looks at what is said, and returns what is said between the words you declared(easier to understand if you look at script.
    • The fith function looks up someones level in the highscores.
    • The sixth function looks up someones combat level, by finding their lvl from highscores.


    At the momment, all it does is
    • Add to your friendslist anyone who PM's you.
    • If the master PM's 'logout' to you, then you log out.
    • If someone PM's 'hi' to you, then you reply 'hey'.
    • If someone PM's 'Say:' to you, with the words 'Say:' and 'Fin:' in the sentence, you say the words between 'say:' and 'fin:'
    • If someone PM's "What is 'username','level'?" (note , and ? must be said) it replies with that usernames lvl.
    • If someone PM's"What 'username' combat" it replies with that usernames combat lvl.

    You can add more things if you know how to script.


    This is just an example of how you can use remote control, so feel free to change it, or edit it in anyway just gimme credit. It can also have security, so that it only listens to certain commands from a certain player, whose name is declared by the constant mastername.

    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.

    Thank you, and please post what you think of it.

  2. #2
    Join Date
    Jul 2006
    Posts
    152
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Isn't this basically RC... which is already programmed into SRL...

  3. #3
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    This is remote control, and there is some remote control built into SRL, but there is only a limited number of commands that can be given using the SRL commands. This is basically how to add more commands, and I this doesnt require Bitmaps and things.

  4. #4
    Join Date
    Feb 2007
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nice
    reporting all lvl 3-10 autoers with default clothes and stupid names auto correctley!...
    http://www.srl-forums.com/forum/botc...7.html?t=10137

    CLICKY help us out, join and be an active member

    http://www.fenjer.com/adnan/SRL/19/5...0scripting.png

  5. #5
    Join Date
    Aug 2006
    Posts
    408
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Good functions o.O

  6. #6
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    thanks for comments, I added more functions and commands, its now useful for looking up other users.

  7. #7
    Join Date
    May 2007
    Location
    in a pineapple under the sea
    Posts
    1,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    cool so this is an antiban type thingy nice
    [SIZE="4"][CENTER][URL="http://www.youtube.com/watch?v=5YsGJz3j4os"]LOL u mad bro?[/URL][/CENTER][/SIZE]

  8. #8
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    It can be anti ban in that it allows bots to basically talk to each other, but it can also be used for changing what a user is doing, or giving a user a command, like my highscore lookup commands

  9. #9
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    nght spud: Great stuff. Really nice work, reads like a charm. But, alas the runescape stats page only displays the HighScores. You could also try fillling the Player.Level[21] array with a call to GetAllLevels.

    What I have always wanted is a Speak command inside RC. So you can stand next to your autoer and actually have a conversation with it. Usually when RC-ing, I have a strategical spot I place the RC-Master. How do you use RC?
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  10. #10
    Join Date
    Dec 2006
    Posts
    2,244
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    should this be in tut island + the script download for an example?

  11. #11
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    The main reason I made the highscore lookup function was not to lookup your own characters, it was to look up other peoples characters, so instead of someone having to leave rs they just PM the bot a message, and it looks at the highscores for them, I guess it could be used to look at your own players though. I will add a command to fill the Player.Level[21] array sometime thanks for the idea.

    Unlike you, I see RC as a way to give commands to bots, for example you could give a command 'start fishing' and the bot will stop what its doing and start fishing (trying to make a script that does this at the moment).

    Quote Originally Posted by rudeboialex View Post
    should this be in tut island + the script download for an example?
    I hope not, I havent actually explained how to do anything, Ive just given an example, I might make it into a tutorial soon.

  12. #12
    Join Date
    Dec 2006
    Posts
    2,244
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    o lol, my bad soz

  13. #13
    Join Date
    May 2007
    Location
    http://www.srl-forums.com
    Posts
    265
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Not bad.

  14. #14
    Join Date
    May 2007
    Location
    Canada
    Posts
    261
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice stuff, good job.

  15. #15
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

  16. #16
    Join Date
    Apr 2007
    Location
    Shhhhhhh im right behind you
    Posts
    335
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    cool oh and no The devil it was me that made runescape unavalible and ill tell u why...well ill just say this...assasination was involved

  17. #17
    Join Date
    Jun 2007
    Location
    Kentucky, United States of America
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ah dude. . .that's really cool actually. . .lots of potential, I was unaware that anything like your fishing idea could be done.

  18. #18
    Join Date
    Mar 2007
    Posts
    674
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    That junk looks good to me!@@

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Remote Control Your Computer
    By ░░░░░ in forum Computer Help and Tutorials
    Replies: 66
    Last Post: 04-15-2008, 09:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •