Results 1 to 7 of 7

Thread: Problem with "delete"...

  1. #1
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default Problem with "delete"...

    Can someone please tell me how I have this set up wrong? It's supposed to GetTextAtEx the name of the last chatter, then get the position of the colon, then delete the colon, and finally Writeln the NewText.

    SCAR Code:
    program New;
    {.include SRL/SRL.Scar}
    var
    Text, NewText: String;
    Position: Integer;
    begin
    SetupSRL;
    Text := Trim(GetTextAtEx(21, 415, 0, SmallChars, False, False, 0, 0, 0, 50, False, tr_AllChars));
    Position := Pos(':', Text);
    NewText := delete(':', Text, Position);
    Writeln(IntToStr(NewText));
    end.

  2. #2
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Delete is a procedure, not a function. It doesn't return a string. It actually deletes whatever you put into it. So take out the NewText:= stuff and on the next line do NewText:= Text.

  3. #3
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    program New;
    {.include SRL/SRL.Scar}
    var
    Text: String;
    Position: Integer;
    begin
    SetupSRL;
    Text := Trim(GetTextAtEx(21, 415, 0, SmallChars, False, False, 0, 0, 0, 50, False, tr_AllChars));
    Position := Pos(':', Text);
    delete(':', Text, Position);
    Writeln(IntToStr(Text));
    end.

    Like that?

    Blasted thing is still giving me an error

  4. #4
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    program New;
    {.include SRL/SRL.Scar}
    var
      Text: String;
      Position: Integer;
     
    begin
      SetupSRL;
      Text := Trim(GetTextAtEx(21, 415, 0, SmallChars, False, False, 0, 0, 0, 50, False, tr_AllChars));
      Position := Pos(':', Text);
      delete(Text, Position, 1);
      Writeln(Text);
    end.
    You were using delete wrong. The first variable in it is the string you want to delete the text from. The second variable is what character to start deleting the text at. The third is how many characters to delete.

  5. #5
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Ahhhh

    The parambox made it sound like the first area was the text to delete, the second area (ifrom) was where you wanted the text to be deleted from, and the third area (icount) was the position of the text you wanted to delete.

    Quite confusing

    Thanks, mate. You've been a big help!

  6. #6
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Yeah first time I used it I was like WTF IS THIS CRAP??? WTF OMFG!

    Yeah no problem man

  7. #7
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Heh

    Just incase you were wondering what I was working on...

    Two things came from it actually:

    1)

    SCAR Code:
    program New;
    {.include SRL/SRL.Scar}
    var
    Text: String;
    Position1, Position2: Integer;
    begin
    SetupSRL;
    Wait(2000);
    Text := LowerCase(Trim(GetTextAtEx(7, 7, 100, UpChars, False, True, 0, 2, -1, 50, False, tr_AllChars)));
    Position1 := Pos('w', Text);
    delete(Text, Position1, 10);
    Position2 := Pos(' (l', Text);
    delete(Text, Position2, 30);
    Writeln(Text);
    Mouse(457, 482, 10, 10, True);;
    Wait(500 + Random(500));
    TypeSend(Text);
    Mouse(72, 307, 2, 2, True);
    end.

    Not much of anything right now, but it'll collect the name from the uptext, and report under "Macroing." It could be better, but I really don't feel like making that kinda script right now.

    2) Updated version of my AutoRepper. Will collect names from the chatbox and report under "Macroing." The only real difference between the pre- and post- update is that this one will shave off the colon from the username, making it look a lot neater

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. "back buffer" problem with java
    By JAD in forum Java Help and Tutorials
    Replies: 2
    Last Post: 03-16-2008, 12:13 AM
  2. action="www.site.com" method="post"
    By Jason2gs in forum General
    Replies: 4
    Last Post: 05-17-2007, 11:50 PM
  3. Replies: 3
    Last Post: 04-19-2007, 03:44 AM
  4. Replies: 5
    Last Post: 10-26-2006, 11:30 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
  •