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

Thread: allow property choiceAdventureXXX=URL

  1. #11
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,253

    Default

    I adventured in the relay browser until I got the battlefield choice:

    Code:
    [351] The Exploaded Battlefield
    Encounter: Rationing out Destruction
    
    > choice
    
    choice 1: Toss!
      select = tossid (22 options)
        0 => --- select an item ---
        10179 => plain snowcone (5) (5 casualties)
        10320 => space chowder (8) (21 casualties)
        161 => ghuol egg (5 casualties)
        1769 => fricasseed brains (2) (5 casualties)
        1776 => stale baguette (2) (5 casualties)
        1954 => dehydrated caviar (5 casualties)
        2063 => blackberry (4) (5 casualties)
        2841 => antique packet of ketchup (5 casualties)
        471 => hot wing (6) (5 casualties)
        4959 => Knob nuts (5 casualties)
        589 => cocoa eggshell fragment (5 casualties)
        669 => ghuol guolash (18 casualties)
        6705 => jungle floor wax (6 casualties)
        672 => cranberries (2) (5 casualties)
        7368 => extra-flat panini (2) (8 casualties)
        7372 => pie man was not meant to eat (25 casualties)
        7375 => actual tapas (5 casualties)
        7509 => Mornington crescent roll (9 casualties)
        8526 => pink slime (3) (5 casualties)
        9514 => meteoreo (7 casualties)
        9953 => PB&J with the crusts cut off (2) (5 casualties)
    choice 2: Never Mind
    
    > choice 1 tossid=7372
    
    You defeated 25 hippies with some pie man was not meant to eat
    That worked. That was my only pie. Let's see what happens if I set that as my choice setting and automate.

    Code:
    > inv pie
    
    > set choiceAdventure1391=1&tossid=7372
    
    choiceAdventure1391 => 1&tossid=7372
    
    Validating adventure sequence...
    
    Request 1 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [352] The Exploaded Battlefield
    Encounter: War Hippy Windtalker
    ...
    2 hippies defeated; 33 down, 300 left.
    
    Request 2 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [353] The Exploaded Battlefield
    Encounter: War Hippy F.R.O.G.
    ...
    2 hippies defeated; 35 down, 298 left.
    
    Request 3 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [354] The Exploaded Battlefield
    Encounter: War Hippy Baker
    ...
    2 hippies defeated; 37 down, 296 left.
    
    Request 4 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [355] The Exploaded Battlefield
    Encounter: War Hippy Fire Spinner
    ...
    2 hippies defeated; 39 down, 294 left.
    
    Request 5 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [356] The Exploaded Battlefield
    Encounter: sausage goblin
    ...
    This combat did not cost a turn
    
    Request 5 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [356] The Exploaded Battlefield
    Encounter: War Hippy Rigger
    ...
    2 hippies defeated; 41 down, 292 left.
    
    Request 6 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [357] The Exploaded Battlefield
    Encounter: Rationing out Destruction
    Choice option 1391/1 requires 'tossid' but '7372' is not a valid value.
    choice 1: Toss!
      select = tossid (21 options)
        0 => --- select an item ---
        10179 => plain snowcone (5) (5 casualties)
        10320 => space chowder (8) (21 casualties)
        161 => ghuol egg (5 casualties)
        1769 => fricasseed brains (2) (5 casualties)
        1776 => stale baguette (2) (5 casualties)
        1954 => dehydrated caviar (5 casualties)
        2063 => blackberry (4) (5 casualties)
        2841 => antique packet of ketchup (5 casualties)
        471 => hot wing (6) (5 casualties)
        4959 => Knob nuts (5 casualties)
        589 => cocoa eggshell fragment (5 casualties)
        669 => ghuol guolash (18 casualties)
        6705 => jungle floor wax (6 casualties)
        672 => cranberries (2) (5 casualties)
        7368 => extra-flat panini (2) (8 casualties)
        7375 => actual tapas (5 casualties)
        7509 => Mornington crescent roll (9 casualties)
        8526 => pink slime (3) (5 casualties)
        9514 => meteoreo (7 casualties)
        9953 => PB&J with the crusts cut off (2) (5 casualties)
    choice 2: Never Mind
    Click here to continue in the relay browser.
    Let's give some space chowder, set that as my choice property, and automate again.

    Code:
    > choice 1 tossid=10320 always
    
    choiceAdventure1391 => 1&tossid=10320
    You defeated 21 hippies with some space chowder
    Validating adventure sequence...
    
    Request 1 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [358] The Exploaded Battlefield
    Encounter: War Hippy Infantryman
    ...
    2 hippies defeated; 64 down, 269 left.
    
    Request 2 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [359] The Exploaded Battlefield
    Encounter: War Hippy Baker
    ...
    2 hippies defeated; 66 down, 267 left.
    
    Request 3 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [360] The Exploaded Battlefield
    Encounter: War Hippy Rigger
    ...
    2 hippies defeated; 68 down, 265 left.
    
    Request 4 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [361] The Exploaded Battlefield
    Encounter: invader bullet
    ...
    
    Request 5 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [362] The Exploaded Battlefield
    Encounter: War Hippy Homeopath
    ...
    2 hippies defeated; 70 down, 263 left.
    
    Request 6 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [363] The Exploaded Battlefield
    Encounter: War Hippy F.R.O.G.
    ...
    2 hippies defeated; 72 down, 261 left.
    
    Request 7 of 7 (Exploathing: The Exploaded Battlefield) in progress...
    
    [364] The Exploaded Battlefield
    Encounter: Rationing out Destruction
    You defeated 21 hippies with some space chowder
    
    Requests complete.
    Revision 19540 has this.

    Next up, I will make the extra fields work for non-select inputs - text fields, for example.

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

    Default

    Veracity,
    Your work here is amazing and much appreciated. This is going to make a bunch of my scripts much nicer and more robust. Thank you!

  3. #13
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,253

    Default

    Got text inputs to work:

    Code:
    Visiting the Spacegate Terminal
    Using data override: relay/choice.1235.ash
    
    > choice
    
    choice 1: Open the gate using the dials
      select = letter1 (26 options)
    ...
      select = letter2 (26 options)
    ...
      select = letter3 (26 options)
    ...
      select = letter4 (26 options)
    ...
      select = letter6 (26 options)
    ...
      select = letter7 (26 options)
    ...
    choice 2: Open the gate to a specific planet
      text = word
    choice 3: Open the gate to a random planet
    
    > choice 2 word=BRIANNA
    
    > vsg status
    
    Visiting the Spacegate Terminal
    Planet Name: Omicron Stipe II (difficulty = 1)
    Coordinates: BRIANNA
    
    The sky is a bright orange, with a dense covering of lilac-colored clouds.
    The landscape is lit by a pale yellow sun.
    A single medium-sized moon punctuates the expanse of sky.
    
    Environmental Hazards:
      toxic atmosphere
    Plant Life: anomalous (sgplantc3.gif)
    Animal Life: none detected
    Intelligent Life: none detected
    ALERT: ANCIENT RUINS DETECTED (Space Pirates 3: Paradise under a Strange Sun)
    
    You have used 0 turns in the Spacegate today and have 20 turns available to adventure there.
    Other inputs that could be supported are radio buttons and checkboxes - but I know of no examples of either of those in a KoL choice adventure.
    Easy enough to add support for them in ChoiceUtilities, should they appear.

    I think this is done now.

    Revision 19541

  4. #14
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,253

    Default

    Note that I decided not to validate the extra stuff for run_choice(). I validate for automation using the choiceAdventureXXXX property and for the choice command, but if your ASH script gives invalid input, it's not coded correctly.

    I suppose I could add more ASH functions to support this. We have available_choice_options() which returns a map from int => string of available decisions and the text from the game. There could be something like available_choice_select_inputs(int decision) which returns a map from string => string and available_choice_text_inputs( int decision ) which returns a map from string to boolean, or something. Seems pretty specialized. Your script which handles the exploaded battlefield should know which foods and boozes you have.
    Last edited by Veracity; 09-14-2019 at 04:48 AM.

  5. #15
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,253

    Default

    I can't stop. I decided to add the ASH functions, since possible select inputs are variable at runtime - and it might be amusing to, for example, look at the food/drink options and calculate which is the best currently available.

    string[string][string] available_choice_select_inputs( int decision );

    For the specified decision, returns a map from NAME to a map from VALUE to DESCRIPTION.

    string[string] available_choice_text_inputs( int decision );

    For the specified decision, return a map from NAME to DESCRIPTION. Not that we parse the description, currently; it's not embedded in the input, but is freeform text in the HTML that labels the text box.

    Given this little ASH script:

    Code:
    foreach decision, description in available_choice_options() {
        print( "Choice " + decision + ": " + description );
        string[string][string] selects = available_choice_select_inputs( decision );
        foreach name in selects {
    	string[string] mapping = selects[name];
    	print( "  select = " + name + " (" + count(mapping) + " options)" );
    	foreach value, desc in mapping {
    	    print( "    " + value + " => " + desc );
    	}
        }
        string[string] texts = available_choice_text_inputs( decision );
        foreach text, desc in texts {
    	print( "  text = " + text );
        }
    }
    Here is the Exploaded Battlefield choice:

    Code:
    > test load selects.txt
    
    Read 2,659 bytes into a 2,659 character string
    
    > test visit-choice
    
    choice = 1391
    choice 1: Toss!
      select = tossid (24 options)
        0 => --- select an item ---
        10179 => plain snowcone (12) (5 casualties)
        161 => ghuol egg (2) (5 casualties)
        1769 => fricasseed brains (5 casualties)
        1776 => stale baguette (5 casualties)
        1778 => ancient frozen dinner (6 casualties)
        1952 => desiccated apricot (5 casualties)
        1954 => dehydrated caviar (5 casualties)
        2063 => blackberry (2) (5 casualties)
        2843 => dire fudgesicle (2) (5 casualties)
        330 => glass of goat's milk (5 casualties)
        3555 => sea carrot (5 casualties)
        471 => hot wing (6) (5 casualties)
        6416 => mana curds (10 casualties)
        6422 => vampire chowder (10 casualties)
        669 => ghuol guolash (18 casualties)
        6705 => jungle floor wax (6 casualties)
        672 => cranberries (3) (5 casualties)
        7368 => extra-flat panini (2) (8 casualties)
        7375 => actual tapas (5 casualties)
        8412 => succulent marrow (3) (6 casualties)
        8413 => salacious crumbs (5) (6 casualties)
        8526 => pink slime (2) (5 casualties)
        9953 => PB&J with the crusts cut off (4) (5 casualties)
    choice 2: Never Mind
    
    > choice-inputs.ash
    
    Choice 1: Toss!
      select = tossid (24 options)
        0 => --- select an item ---
        10179 => plain snowcone (12) (5 casualties)
        161 => ghuol egg (2) (5 casualties)
        1769 => fricasseed brains (5 casualties)
        1776 => stale baguette (5 casualties)
        1778 => ancient frozen dinner (6 casualties)
        1952 => desiccated apricot (5 casualties)
        1954 => dehydrated caviar (5 casualties)
        2063 => blackberry (2) (5 casualties)
        2843 => dire fudgesicle (2) (5 casualties)
        330 => glass of goat's milk (5 casualties)
        3555 => sea carrot (5 casualties)
        471 => hot wing (6) (5 casualties)
        6416 => mana curds (10 casualties)
        6422 => vampire chowder (10 casualties)
        669 => ghuol guolash (18 casualties)
        6705 => jungle floor wax (6 casualties)
        672 => cranberries (3) (5 casualties)
        7368 => extra-flat panini (2) (8 casualties)
        7375 => actual tapas (5 casualties)
        8412 => succulent marrow (3) (6 casualties)
        8413 => salacious crumbs (5) (6 casualties)
        8526 => pink slime (2) (5 casualties)
        9953 => PB&J with the crusts cut off (4) (5 casualties)
    Choice 2: Never Mind
    And here is the Spacegate choice:

    Code:
    > test load selects2.txt
    
    Read 7,349 bytes into a 7,349 character string
    
    > test visit-choice
    
    choice = 1235
    choice 1: Open the gate using the dials
      select = letter1 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter2 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter3 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter4 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter5 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter6 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter7 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
    choice 2: Open the gate to a specific planet
      text = word
    choice 3: Open the gate to a random planet
    
    > choice-inputs.ash
    
    Choice 1: Open the gate using the dials
      select = letter1 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter2 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter3 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter4 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter5 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter6 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
      select = letter7 (26 options)
        A => A
        B => B
        C => C
        D => D
        E => E
        F => F
        G => G
        H => H
        I => I
        J => J
        K => K
        L => L
        M => M
        N => N
        O => O
        P => P
        Q => Q
        R => R
        S => S
        T => T
        U => U
        V => V
        W => W
        X => X
        Y => Y
        Z => Z
    Choice 2: Open the gate to a specific planet
      text = word
    Choice 3: Open the gate to a random planet
    Revision 19543

Posting Permissions

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