Results 1 to 3 of 3

Thread: Need Help Making a function

  1. #1
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default Need Help Making a function

    hi im making a superheater script and i have pretty much finished but one bug that i have found is that each load it cast superheat it tries to cast on more superheat then can not find the ore because the uptext of the bank is cast superheat with ...... i have tried several ways on how to do this but nothing has worked for me i was thinking of just making in randomly click somewhere before it banked but that to me seems a little to much like a bot anyways i can not see y what i have doesnt work

    heres my superheat procedure any help anyone can give me would be great

    SCAR Code:
    procedure CastSuperheats;
    begin
    c:= 0;
    if (not (Loggedin)) then exit;
        if players[currentplayer].Strings[0] = 'bronze' then
           castz := 27;
        if players[currentplayer].Strings[0] = 'iron' then
           castz := 27;
        if players[currentplayer].Strings[0] = 'steel' then
          castz := 9;
        if players[currentplayer].Strings[0] = 'mithril' then
           castz := 5;
        if players[currentplayer].Strings[0] = 'adamantite' then
           castz := 3;
        if players[currentplayer].Strings[0] = 'runite' then
           castz := 3;
        if players[currentplayer].Strings[0] = 'gold' then
           castz := 27;
        if players[currentplayer].Strings[0] = 'silver' then
          castz := 27;
      Gametab(7);
      repeat
      wait(200)
      if not CastSpell(26) then break;
      Wait(450 + random(150));
      if players[currentplayer].Strings[0] = 'bronze' then
          if not findOre('copper', x, y, MIX1, MIY1, MIX2, MiY2) then
          begin
            writeln('didnt find copper');
            break;
          end;
        if players[currentplayer].Strings[0] = 'iron' then
          if not findOre('iron', x, y, MIX1, MIY1, MIX2, MiY2) then
          begin
            writeln('didnt find iron');
            break;
          end;
        if players[currentplayer].Strings[0] = 'steel' then
          if not findOre('iron', x, y, MIX1, MIY1, MIX2, MiY2) then
          begin
            writeln('didnt find steel');
            break;
          end;
        if players[currentplayer].Strings[0] = 'mithril' then
          if not findOre('mithril', x, y, MIX1, MIY1, MIX2, MiY2) then
          begin
            writeln('didnt find mith');
            break;
          end;
        if players[currentplayer].Strings[0] = 'adamantite' then
          if not findOre('adamantite', x, y, MIX1, MIY1, MIX2, MiY2) then
          begin
            writeln('didnt find addy');
            break;
          end;
        if players[currentplayer].Strings[0] = 'runite' then
          if not findOre('runite', x, y, MIX1, MIY1, MIX2, MiY2) then
          begin
            writeln('didnt find rune');
            break;
          end;
        if players[currentplayer].Strings[0] = 'gold' then
          if not findOre('gold', x, y, MIX1, MIY1, MIX2, MiY2) then
          begin
            writeln('didnt find gold');
            break;
          end;
        if players[currentplayer].Strings[0] = 'silver' then
          if not findOre('silver', x, y, MIX1, MIY1, MIX2, MiY2) then
          begin
            writeln('didnt find silver');
            break;
          end;
      begin
        MMouse(x, y, 2, 2);
        wait(250 + random(150));
        if IsUpText('ore') then
        begin
          Mouse(x, y, 5, 5, True);
          Wait(450 + random(150));
          AntiRandoms;
          castz := c + 1;
        end else
        begin
          writeln('Can not find ore');
          break;
          WithdrawOres;
          castz := c + 1;
        end;
      end;
      until(false)
    end;



  2. #2
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    The problem is that you cast the spell before finding the ore, so if it doesn't find an ore, then it tries to withdraw ores (with the spell still selected). What you can do is use a bit of script to randomly click on 1 of the empty slots using ExistsItem() to make sure there isn't anything in it e.g.
    SCAR Code:
    MarkTime(randomClick);
      repeat
        i:= Random(27)+1;
        if(not(ExistsItem(i))) then
        begin
          MouseItem(i,True);
          Break;
        end;
      until(TimeFromMark(randomClick)>=10000)
    You just have to add i and randomClick as integers in the var section. The randomClick is just there as a saftey measure (mainly incase all slots are full) so it won't keep on searching until you get logged out or something.

    Also, you might want to look into cases to replace your long line if()then's as that looks very untidy/unprofessional and cases will make it look all nice and pretty
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  3. #3
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    thanks heaps for that that fixed my problem



Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 02-27-2008, 05:20 PM
  2. Replies: 2
    Last Post: 02-26-2008, 08:26 PM
  3. [FUNCTION] FindDoorColour: integer; By ZephyrsFury [FUNCTION]
    By ZephyrsFury in forum Research & Development Lounge
    Replies: 10
    Last Post: 07-27-2007, 08:45 AM

Posting Permissions

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