Results 1 to 10 of 10

Thread: Redoing a procedure in the main loop

  1. #1
    Join Date
    Mar 2007
    Location
    Under a rock
    Posts
    813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Redoing a procedure in the main loop

    I am very good at scripting, but i ran into a problem. So heres the situation: Im cutting normal trees near a symbol, I want to click the symbol every 4 logs to prevent me from wandering off, but in the proecedure "FindFurnaceSymbolProcedure;", it looks for the furnace symbol and if it doesnt find it, it will log out. I am not near the furnace symbol while im cutting though and i only want the FindFurnaceSymbolProcedure to happen at the beggining of the loop after everything else happens so i can find the furnace then, now while im cutting.

    SCAR Code:
    repeat
          FindFurnaceSymbolProcedure; //I only want to use this procedure once the loop starts over
          repeat
          ChoppingTrees;
          if(invcount = 4)then
          FindSymbol; //I changed name of this, i have procedure to find the symbol in script that i want to click every 4 logs
          ChoppingTrees;
          if(invcount = 8)then
          FindSymbol;
          ChoppingTrees;
          if(invcount = 12)then
          FindSymbol;
          ChoppingTrees;
          if(invcount = 16)then
          FindSymbol;
          ChoppingTrees;
          if(invcount = 20)then
          FindSymbol;
          ChoppingTrees;
          if(invcount = 24)then
          FindSymbol;
          ChoppingTrees;
          if(invcount = 28)then
          OnceFullInventory; //This will walk back and sell/bank the stuff only the inv is full
          until(LoggedIn) and (Loads >= LoadsWanted)
          begin
            Logout;
            Nextplayer(True);
          end;
          until(false);
        end;
    end.

  2. #2
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm not sure I understand what the problem is. Does it not click the symbol? or what is wrong?

  3. #3
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Can you show us the procedures too so i can actually see whats wrong?
    And to prevent from wandering of, you should use

    SCAR Code:
    if(not(findsymbol)))then

    And

    BoredHuman;

  4. #4
    Join Date
    Mar 2007
    Location
    Under a rock
    Posts
    813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, im sorry for not fully explainign what i did, i undated the first post so it now makes sense.

  5. #5
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    You can eliminate all that stuff. Use mod instead.

    Mod returns the remainder after dividing by a number.

    10 mod 2 = 0
    10 mod 3 = 1
    10 mod 4 = 2
    10 mod 5 = 0
    10 mod 6 = 4
    10 mod 7 = 3
    10 mod 8 = 2
    10 mod 9 = 1
    etc

    So, if you want to check every 4 logs do this...

    Code:
    repeat
      repeat 
        FindFurnaceSymbolProcedure;
        repeat
          ChoppingTrees;
          if (invcount mod  4 = 0) then FindSymbol;
          if (invcount = 28) then
          begin
            OnceFullInventory;
            break;
          end;
        until (false);
      until (LoggedIn) and (Loads >= LoadsWanted);
      Logout;
      Nextplayer(True);
    until(false);

  6. #6
    Join Date
    Mar 2007
    Location
    Under a rock
    Posts
    813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I understand what you are saying and what it does, but thats is so confusing lol. I dont get how many mod things i should have, you have 9 that you typed, where do i put them in the script, and where do the numbers to the right coem from lol. Im sorry, im new to thsi function.

  7. #7
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Just use what I wrote there. You only need ONE mod function in the loop. It replaces all those if InvCount=blah lines you had.

    The simplest way to chop trees and have it click the symbol every 4 logs is like this...

    Code:
    repeat
      ChoppingTrees;
      if (InvCount mod 4 = 0) then FindSymbol;
    until false;
    So, you chop a tree. If you invcount = 1 then InvCount mod 4 = 1, so it skips the symbol click. So, it repeats and chops another tree. Now InvCount = 2, and InvCount mod 4 = 2, so it skips the click. Chops again, and InvCount mod 4 = 3, so it skips again. The fourth time it chops InvCount = 4, and InvCount mod 4 = 0, so it clicks the symbol.

    It will only click the symbol if your InvCount is a multiple of 4. Like 0, 4, 8, 12, 16, 20, 24, 28. If it's any other number, it skips the click.

    If you want it to click every 10 logs, you would use InvCount mod 10. If you want it to click every 12 logs you would use InvCount mod 12.

  8. #8
    Join Date
    Mar 2007
    Location
    Under a rock
    Posts
    813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thats awsoem Tarajunky, has this always been around? Its a pretty cool function. Ive never needed to use stuff like this, but this is cool lol. Where do you learn to use all of these things lol, or did you make it yourself

  9. #9
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, this has always been around. It's a core mathematical function in SCAR.

    I don't remember where I first saw it used, but I use it for lots of things. Like if I want to run antiban randomly, I'll put it into my anti-randoms procedures, which I run all the time.

    But I don't want anti-ban run every time so I'll do something like

    Code:
    if random(100) mod 12 = 0 then AntiBan;
    So on average it will run that function every 12 times it does an anti-random check. If you want it done less often than that, you just increase the number. You could use mod 27 or mod 52 or whatever.

  10. #10
    ronny.m.p Guest

    Default

    mods are VERY useful. I replaced a 20 line procedure with a 3 line procedure thanks to them!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Main loop???
    By cloutier15 in forum OSR Help
    Replies: 3
    Last Post: 05-11-2008, 09:53 PM
  2. Main Loop Problem
    By kryptonite in forum OSR Help
    Replies: 9
    Last Post: 07-25-2007, 02:22 PM
  3. Main Loop Issue
    By lefamaster in forum OSR Help
    Replies: 5
    Last Post: 03-22-2007, 09:11 PM
  4. main loop
    By syberium in forum OSR Help
    Replies: 5
    Last Post: 01-23-2007, 07:00 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
  •