Results 1 to 4 of 4

Thread: While .. do and other conditions

  1. #1
    Join Date
    Nov 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default While .. do and other conditions

    SO close to release time for my merchant.

    Anyway i'm pulling my hair out over a persistent problem. I have a functioning trader (buying and selling) to and from other players. It all works well if they do their part right lol. The problem occurs when they close the trade window early. I was using a while do loop that checked for the trade screen but it wasn't doing any good.

    I had something like

    Code:
    Procedure BeatTheGame;
    begin
    While (TradeScreen = True) do
    begin
    OwnZammy;
    TradeScreen;
    OwnZezima;
    TradeScreen;
    GetHotPockets;
    TraceScreen;
    end;
    end;
    I thought this was like the best thing ever...until it didn't work.

    So i figured it got stuck inside one of my smaller procedures

    So i added some more useless stuff like

    Code:
    Procedure OwnZammy;
    begin
    while (TradeScreen = True) do
    begin
    GetHugeKnife;
    TradeScreen;
    SharpenHugeKnife;
    TradeScreen;
    DontCutSelf;
    TradeScreen;
    end;
    end;
    I thought this would for sure solve it....wrongo

    I went all the way through down to the smallest loop and procedure and i'm down to the point where i would need to edit SRL files to have it check inside those procedure....then i got smart. I went to eat some food. So now i'm here hoping someone can help me.

    What i need to do is have the script skip to the end if the trade screen ever goes down. No matter where it gets closed. It's killing me.

    Hope you guys can help. The script will be free so I can post it if you want to see. It's probably not up to standards but i plan to clean it up a bit.

    Anyway thanks!

    Ransom

  2. #2
    Join Date
    Feb 2006
    Location
    New Zealand
    Posts
    1,330
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It tests the while param at the end of each loop. Really you need to put checks inside each Procedure . Then break and exit.

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

    Default

    Yeah, if it comes down to it, you can put

    Code:
    if not(TradeScreen) then break;
    for every other line.

    This would not be an elegant solution, but it would be effective.

  4. #4
    Join Date
    Nov 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by tarajunky View Post
    Yeah, if it comes down to it, you can put

    Code:
    if not(TradeScreen) then break;
    for every other line.

    This would not be an elegant solution, but it would be effective.

    Hehe, I do like the way you think. Most of my code tends to be a brute force solution. Not exactly neat and tidy but it gets the job done. I'll try it out. Thanks for the tips.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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