Page 2 of 2 FirstFirst 1 2
Results 11 to 13 of 13

Thread: Dungeon of Doom script

  1. #11
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    366

    Default

    Also, you can run adventures in while loops.

    PHP Code:
    while (item_amount($item[plus sign])==0) {
       
    adventure(1$location[The Enormous Greater Than Sign]);

    Originally Posted by ckb View Post
    I ran this:
    PHP Code:
        while (item_amount($item[plus sign]) == )
            {
            
    set_property("choiceAdventure451"3); // Get Plus Sign
            
    adventure(my_adventures(), $location[The Enormous Greater-Than Sign]);
            } 
    I got the plus sign, and it kept running...

    Ugh, I'm having so much trouble with this script. I really didn't think it would be this hard.

    I can't figure out how to tell the script to look for the non-combat "the oracle will be with you".

    I've tried this:
    if(!myloc.noncombat_queue.contains_text("The Oracle Will See You Now"))
    and
    while(!myloc.noncombat_queue.contains_text("The Oracle Will See You Now"))
    with and without the "!", neither worked.

    PHP Code:
        if ($item[plus sign].available_amount() == 1)
            {
            print(
    "have + sign");
            
    set_property("choiceAdventure451"5); // Get teleportitis
            
    if(have_effect($effect[teleportitis]) <= 1)
            {
            
    adventure(1$location[The Enormous Greater-Than Sign]);
            }
            
    cli_execute("use plus sign"); 
    this just tried to use the plus sign.
    Last edited by Pazleysox; 04-20-2018 at 01:55 PM.

  2. #12
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    820

    Default

    You are missing one key element of the while loop - it executes each task inside of it to completion before checking the conditional. So if you look at my original suggestion, it is this:
    adventure(1, $location[The Enormous Greater Than Sign]);

    your while loop runs through ALL your adventures before it checks if you have plus sign again.

    Also - you can set the property before you enter the while loop so that it does not have to reset it during every iteration.
    In thuis example, I also added a print statement to show what the "lastEncounter" property was so you can see what Mafia is reporting after every adventure.

    PHP Code:
    set_property("choiceAdventure451"3); // Get Plus Sign
    while (item_amount($item[plus sign])==0) {
       
    adventure(1$location[The Enormous Greater Than Sign]);
       print(
    "lastEncounter="+get_property("lastEncounter"),"blue");

    To adventure until you get the Encounter "The Oracle Will See You Now", we use a while loop to adventure one time until we get this set as the "lastEncounter"

    PHP Code:
    while (get_property("lastEncounter")!="The Oracle Will See You Now") {
       
    adventure(1$location[The Enormous Greater Than Sign]);
       print(
    "lastEncounter="+get_property("lastEncounter"),"blue");

    The tricky thing about using this method is that "lastEncounter" is a string, and you have to get it right to make sure that the text "The Oracle Will See You Now" matches exactly what Mafia reports it as. This is why printing "lastEncounter" after every adventure is useful to learn what each encounter is named.

    Hope this helps!

  3. #13
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    366

    Default

    Hope this helps!
    Originally Posted by ckb View Post
    It certainly did! I have to run a test on it again, but it seems to be working perfect now. I just have to tweak a few little things, and it should be good.

    Thank you everyone so much for your help. It's really appreciated! I have certainly learned something I didn't know before! I should be able to roll the script out in a day or so.
    Last edited by Pazleysox; 04-20-2018 at 05:03 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
  •