Results 1 to 8 of 8

Thread: Challenge roller

  1. #1
    Join Date
    Mar 2008
    Location
    Kentucky
    Posts
    5,067

    Default Challenge roller

    This post is regarding a challenge bot that has been implimented on #adom on freenode.

    I did most of the blue collar programming on it myself (which explains its ugly/nonsensical structure), but was
    turned into an actual working bot by somebody who actually knows what they are doing. For now it only gives
    quests such as 'kill a mimic/rust monster' or 'find a mithril sword' 'by turn 5000' or such. Very few options
    for now, only 3 or 4 types of monsters/items. I really just posted the idea to see if it was possible, and was
    quite surprised to wake up to a working bot.

    So now it is time to try to expand it by adding more quests, and even assigning points based on quest difficulty.
    I think the lists we used for the last mission impossible challenge could be referred to for assigning points
    based on class, meaning rolling a wiz would give maybe 1 point, but a thief 5? For now I have separated them
    into 3 catagories, 11 in the wiz/archer/barb class, 5 in the assassin/ranger area, and 4 in the farmer/merchant
    catagory. I can't really see how a scale of points for race would work, except to give humans +1 for suckiness,
    while giving drakes -1 for awesome? Problem is, trolls would probably do better on most quests than drakes, as
    I tried to keep the quests rather short. Maybe limiting them to 20 minutes type things? Maybe things that could
    be accomplished in 5000 turns?

    Anyhow, I will post what I have so far (minus blokem's code, that actually makes it work ) in hopes of ideas
    regarding a point system, quest options, and other various feedbacks.

    EDIT: please ignore this code, the next is the one with point system
    Code:
    import random
    
    INTRO = 'Your challenge is to roll a'
    RACE = ['human', 'troll', 'high elf', 'gray elf', 'dark elf', 'dwarf', 'gnome', 'hurthling', 'orc', 'drakeling']
    CLASS1 = ['wizard.', 'fighter.', 'paladin.', 'priest.', 'monk.', 'archer.', 'barbarian.', 'druid.', 'necromancer.', 'elementalist.', 'beastfighter.']
    CLASS2 = ['assassin.', 'ranger.', 'bard.', 'healer.', 'weaponsmith.']
    CLASS3 = ['merchant.', 'thief.', 'mindcrafter.', 'farmer.']
    
    QUEST_TYPE = ['return the cute puppy to the tiny girl ', 'kill ', 'find ', 'commit suicide in ']
    QUEST_MONSTER = ['a mimic ', 'a rust monster ', 'a master swordsman ', 'a ratling duelist ']
    QUEST_ITEM = ['an amulet of willpower ', 'a mithril shield ', 'a mithril sword' , 'pair of mithril boots ']  
    LOCATION = ['the pyramid, \ndungeon level 3, ', 'GriffYard, \ndungeon level 2, ', ' the tomb of the high kings, \ndungeon level 6, ', 'caverns of chaos, \ndungeon level 15, ']
    TURN_COUNT = ['5000', '6000', '8000', '10000']
    
    CRUEL_RESTRICTION = ['cruel restriction, you must drop all your \nitems in the wilderness on turn 1.', 'cruel restriction, you must pray until your \ninventory is cursed upon game start.', 'cruel restriction, you must pray until you are doomed upon game start.', 'cruel restriction, you must forego all armor \nfor 5000 turns, starting on game turn 1.', 'cruel restriction, you must forego melee attacks \nfor 5000 turns, starting on game turn 1.']
    RESTRICTION = ['restriction, you must drop all your \nfood in the wilderness upon game start.', 'restriction, you must kick the air until \nyour HPs are under 5 upon game start.', 'restriction, you must forego all armor for 2000 turns.', 'restriction, you must forego melee attacks \nfor 2000 turns, starting on game turn 1.', 'restriction, you must not intentionally acquire the detect traps skill.']
    
    def Choose_Quest():
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:
            a = QUEST_TYPE[0]
            b = 'by turn count '
            c = Choose_Turns()
            d = '.'
            return a+b+c+d
        if RNG == 1:
            a = QUEST_TYPE[1]
            b = Choose_Monster()
            c = 'by turn count '
            d = Choose_Turns()
            e = '.'
            return a+b+c+d+e
        if RNG == 2:
            a = QUEST_TYPE[2]
            b = Choose_Item()
            c = 'by turn count '
            d = Choose_Turns()
            e = '.'
            return a+b+c+d+e
        if RNG == 3:
            a = QUEST_TYPE[3]
            b = Choose_Location()
            c = 'by turn count '
            d = Choose_Turns()
            e = '.'
            return a+b+c+d+e
    
    def Choose_Turns():
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:
            return TURN_COUNT[0]
        if RNG == 1:
            return TURN_COUNT[1]
        if RNG == 2:
            return TURN_COUNT[2]
        if RNG == 3:
            return TURN_COUNT[3]
    
    def Choose_Monster():
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:
            return QUEST_MONSTER[0]
        if RNG == 1:
            return QUEST_MONSTER[1]
        if RNG == 2:
            return QUEST_MONSTER[2]
        if RNG == 3:
            return QUEST_MONSTER[3]
    
    def Choose_Item():
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:
            return QUEST_ITEM[0]
        if RNG == 1:
            return QUEST_ITEM[1]
        if RNG == 2:
            return QUEST_ITEM[2]
        if RNG == 3:
            return QUEST_ITEM[3]
    
    def Choose_Location():
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:
            return LOCATION[0]
        if RNG == 1:
            return LOCATION[1]
        if RNG == 2:
            return LOCATION[2]
        if RNG == 3:
            return LOCATION[3]
    
    def Choose_Race():
        RNG = random.randrange(0, 10, 1)
        if RNG == 0:
            return RACE[0]
        if RNG == 1:
            return RACE[1]
        if RNG == 2:
            return RACE[2]
        if RNG == 3:
            return RACE[3]
        if RNG == 4:
            return RACE[4]
        if RNG == 5:
            return RACE[5]
        if RNG == 6:
            return RACE[6]
        if RNG == 7:
            return  RACE[7]
        if RNG == 8:
            return RACE[8]
        if RNG == 9:
            return RACE[9]
    
    def Choose_Class():
        RNG = random.randrange(0, 20, 1)
        if RNG == 0:
            return CLASS1[0]
        if RNG == 1:
            return CLASS1[1]
        if RNG == 2:
            return CLASS1[2]
        if RNG == 3:
            return CLASS1[3]
        if RNG == 4:
            return CLASS1[4]
        if RNG == 5:
            return CLASS1[5]
        if RNG == 6:
            return CLASS1[6]
        if RNG == 7:
            return CLASS1[7]
        if RNG == 8:
            return CLASS1[8]
        if RNG == 9:
            return CLASS1[9]
        if RNG == 10:
            return CLASS1[10]
        if RNG == 11:
            return CLASS2[0]
        if RNG == 12:
            return CLASS2[1]
        if RNG == 13:
            return CLASS2[2]
        if RNG == 14:
            return CLASS2[3]
        if RNG == 15:
            return CLASS2[4]
        if RNG == 16:
            return CLASS3[0]
        if RNG == 17:
            return CLASS3[1]
        if RNG == 18:
            return CLASS3[2]
        if RNG == 19:
            return CLASS3[3]
    
    def Choose_Restriction():
        RNG = random.randrange(0, 5, 1)
        if RNG == 0:
            RNG = random.randrange(0, 5, 1)
            if RNG == 0:
                return CRUEL_RESTRICTION[0]
            if RNG == 1:
                return CRUEL_RESTRICTION[1]
            if RNG == 2:
                return CRUEL_RESTRICTION[2]
            if RNG == 3:
                return CRUEL_RESTRICTION[3]
            if RNG == 4:
                return CRUEL_RESTRICTION[4]
        else:
            RNG = random.randrange(0, 5, 1)
            if RNG == 0:
                return RESTRICTION[0]
            if RNG == 1:
                return RESTRICTION[1]
            if RNG == 2:
                return RESTRICTION[2]
            if RNG == 3:
                return RESTRICTION[3]
            if RNG == 4:
                return RESTRICTION[4]
    
    def Challenge():
            print INTRO, Choose_Race(), Choose_Class()
            print 'You must', Choose_Quest()
            print 'As a', Choose_Restriction(), '\n'
    
    Challenge()
    P.S.
    The purpose (or at least intention) behind all the 'if' statements is that is how I intended to add in
    a points system, before realizing I didn't really know what I was doing. Why should I let a little
    thing like that stop me?
    Last edited by gut; 10-21-2011 at 07:19 PM.
    "Whip me!" pleads the adom player. The rng replies... "No."

  2. #2
    Join Date
    Mar 2008
    Location
    Kentucky
    Posts
    5,067

    Default

    yay for being the first to reply to my own thread!

    anyway, I worked more on the challenge roller and added a point system.
    I don't know for sure if it makes sense or not, as I may have lost perspective by now -_-

    Code:
    import random
    
    QUEST_VALUE = 0
    INTRO = 'Your challenge is to roll a'
    RACE = ['human', 'troll', 'high elf', 'gray elf', 'dark elf', 'dwarf', 'gnome', 'hurthling', 'orc', 'drakeling']
    CLASS1 = ['wizard.', 'fighter.', 'paladin.', 'priest.', 'monk.', 'archer.', 'barbarian.', 'druid.', 'necromancer.', 'elementalist.', 'beastfighter.']
    CLASS2 = ['assassin.', 'ranger.', 'bard.', 'healer.', 'weaponsmith.']
    CLASS3 = ['merchant.', 'thief.', 'mindcrafter.', 'farmer.']
    
    QUEST_TYPE = ['return the cute puppy to the tiny girl ', 'kill ', 'find ', 'commit suicide in ']
    QUEST_MONSTER = ['a mimic ', 'a rust monster ', 'a master swordsman ', 'a ratling duelist ']
    QUEST_ITEM = ['an amulet of willpower ', 'a mithril shield ', 'a mithril sword' , 'pair of mithril boots ']  
    LOCATION = ['the pyramid, \ndungeon level 3, ', 'GriffYard, \ndungeon level 2, ', ' the tomb of the high kings, \ndungeon level 6, ', 'caverns of chaos, \ndungeon level 15, ']
    TURN_COUNT = ['5000', '6000', '8000', '10000']
    
    CRUEL_RESTRICTION = ['cruel restriction, you must drop all your \nitems in the wilderness on turn 1.', 'cruel restriction, you must pray until your \ninventory is cursed upon game start.', 'cruel restriction, you must pray until you are doomed upon game start.', 'cruel restriction, you must forego all armor \nfor 5000 turns, starting on game turn 1.', 'cruel restriction, you must forego melee attacks \nfor 5000 turns, starting on game turn 1.']
    RESTRICTION = ['restriction, you must drop all your \nfood in the wilderness upon game start.', 'restriction, you must kick the air until \nyour HPs are under 5 upon game start.', 'restriction, you must forego all armor for 2000 turns.', 'restriction, you must forego melee attacks \nfor 2000 turns, starting on game turn 1.', 'restriction, you must not intentionally acquire the detect traps skill.']
    
    def Choose_Quest():
        global QUEST_VALUE
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:                # puppy quest
            QUEST_VALUE = QUEST_VALUE + 1
            a = QUEST_TYPE[0]
            b = 'by turn count '
            c = Choose_Turns()
            d = '.'
            return a+b+c+d
        if RNG == 1:                # kill quest
            QUEST_VALUE = QUEST_VALUE + 2
            a = QUEST_TYPE[1]
            b = Choose_Monster()
            c = 'by turn count '
            d = Choose_Turns()
            e = '.'
            return a+b+c+d+e
        if RNG == 2:               # find item
            QUEST_VALUE = QUEST_VALUE + 2
            a = QUEST_TYPE[2]
            b = Choose_Item()
            c = 'by turn count '
            d = Choose_Turns()
            e = '.'
            return a+b+c+d+e
        if RNG == 3:                # suicide
            QUEST_VALUE = QUEST_VALUE + 1
            a = QUEST_TYPE[3]
            b = Choose_Location()
            c = 'by turn count '
            d = Choose_Turns()
            e = '.'
            return a+b+c+d+e
    
    def Choose_Turns():
        global QUEST_VALUE
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:              # 6000 turn limit
            QUEST_VALUE = QUEST_VALUE + 6
            return TURN_COUNT[0]
        if RNG == 1:              # 7000 turn limit
            QUEST_VALUE = QUEST_VALUE + 4
            return TURN_COUNT[1]
        if RNG == 2:              # 8000 turn limit
            QUEST_VALUE = QUEST_VALUE +2
            return TURN_COUNT[2]
        if RNG == 3:              # 10000 turn limit
            QUEST_VALUE = QUEST_VALUE + 1
            return TURN_COUNT[3]
    
    def Choose_Monster():
        global QUEST_VALUE
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:              # mimic
            QUEST_VALUE = QUEST_VALUE + 1
            return QUEST_MONSTER[0]
        if RNG == 1:              # rust monster 
            QUEST_VALUE = QUEST_VALUE + 1
            return QUEST_MONSTER[1]
        if RNG == 2:              # master swordsman
            QUEST_VALUE = QUEST_VALUE +2
            return QUEST_MONSTER[2]
        if RNG == 3:              # ratling duelist
            QUEST_VALUE = QUEST_VALUE +3
            return QUEST_MONSTER[3]
    
    def Choose_Item():
        global QUEST_VALUE
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:              # wp ammy
            QUEST_VALUE = QUEST_VALUE +1
            return QUEST_ITEM[0]
        if RNG == 1:              # mithril shield
            QUEST_VALUE = QUEST_VALUE +1
            return QUEST_ITEM[1]
        if RNG == 2:              # mithril sword
            QUEST_VALUE = QUEST_VALUE +1
            return QUEST_ITEM[2]
        if RNG == 3:              # mithril boots
            QUEST_VALUE = QUEST_VALUE +2
            return QUEST_ITEM[3]
    
    def Choose_Location():
        global QUEST_VALUE
        RNG = random.randrange(0, 4, 1)
        if RNG == 0:              # pyramid
            QUEST_VALUE = QUEST_VALUE +1
            return LOCATION[0]
        if RNG == 1:              # griffyard
            QUEST_VALUE = QUEST_VALUE +2
            return LOCATION[1]
        if RNG == 2:              # tothk
            QUEST_VALUE = QUEST_VALUE +3
            return LOCATION[2]
        if RNG == 3:              # D15
            QUEST_VALUE = QUEST_VALUE +3
            return LOCATION[3]
    
    def Choose_Race():
        global QUEST_VALUE
        RNG = random.randrange(0, 10, 1)
        if RNG == 0:                       # human
            QUEST_VALUE = QUEST_VALUE + 2
            return RACE[0]
        if RNG == 1:                       # troll
            QUEST_VALUE = QUEST_VALUE +1
            return RACE[1]
        if RNG == 2:                       # high elf
            QUEST_VALUE = QUEST_VALUE +2
            return RACE[2]
        if RNG == 3:                       # gray elf
            QUEST_VALUE = QUEST_VALUE +2
            return RACE[3]
        if RNG == 4:                       # dark elf
            QUEST_VALUE = QUEST_VALUE +2
            return RACE[4]
        if RNG == 5:                       # dwarf
            QUEST_VALUE = QUEST_VALUE +1
            return RACE[5]
        if RNG == 6:                       # gnome
            QUEST_VALUE = QUEST_VALUE +2
            return RACE[6]
        if RNG == 7:                       # hurthling
            QUEST_VALUE = QUEST_VALUE +2
            return RACE[7]
        if RNG == 8:                       # orc 
            QUEST_VALUE = QUEST_VALUE +1
            return RACE[8]
        if RNG == 9:                       # drake
            QUEST_VALUE = QUEST_VALUE +1
            return RACE[9]
    
    def Choose_Class():
        global QUEST_VALUE
        RNG = random.randrange(0, 20, 1)
        if RNG == 0:                       # wizard
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[0]
        if RNG == 1:                       # fighter
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[1]
        if RNG == 2:                       # paladin
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[2]
        if RNG == 3:                       # priest
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[3]
        if RNG == 4:                       # monk
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[4]
        if RNG == 5:                       # archer
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[5]
        if RNG == 6:                       # barbarian
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[6]
        if RNG == 7:                       # druid
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[7]
        if RNG == 8:                       # necromancer
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[8]
        if RNG == 9:                       # elementalist
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[9]
        if RNG == 10:                      # beastfighter
            QUEST_VALUE = QUEST_VALUE + 1
            return CLASS1[10]
        if RNG == 11:                      # assassin
            QUEST_VALUE = QUEST_VALUE + 3
            return CLASS2[0]
        if RNG == 12:                      # ranger
            QUEST_VALUE = QUEST_VALUE + 3
            return CLASS2[1]
        if RNG == 13:                      # bard
            QUEST_VALUE = QUEST_VALUE + 3
            return CLASS2[2]
        if RNG == 14:                      # healer
            QUEST_VALUE = QUEST_VALUE + 3
            return CLASS2[3]
        if RNG == 15:                      # weaponsmith
            QUEST_VALUE = QUEST_VALUE + 3
            return CLASS2[4]
        if RNG == 16:                      # merchant
            QUEST_VALUE = QUEST_VALUE + 5
            return CLASS3[0]
        if RNG == 17:                      # thief
            QUEST_VALUE = QUEST_VALUE + 5
            return CLASS3[1]
        if RNG == 18:                      # mindcrafter
            QUEST_VALUE = QUEST_VALUE + 5
            return CLASS3[2]
        if RNG == 19:                      # farmer 
            QUEST_VALUE = QUEST_VALUE + 5
            return CLASS3[3]
    
    def Choose_Restriction():
        global QUEST_VALUE
        RNG = random.randrange(0, 5, 1)
        if RNG == 0:                            # +4 if cruel restriction
            QUEST_VALUE = QUEST_VALUE + 4
            RNG = random.randrange(0, 5, 1)
            if RNG == 0:
                return CRUEL_RESTRICTION[0]
            if RNG == 1:
                return CRUEL_RESTRICTION[1]
            if RNG == 2:
                return CRUEL_RESTRICTION[2]
            if RNG == 3:
                return CRUEL_RESTRICTION[3]
            if RNG == 4:
                return CRUEL_RESTRICTION[4]
        else:
            RNG = random.randrange(0, 5, 1)    # +1 for regular restriction
            QUEST_VALUE = QUEST_VALUE + 1
            if RNG == 0:
                return RESTRICTION[0]
            if RNG == 1:
                return RESTRICTION[1]
            if RNG == 2:
                return RESTRICTION[2]
            if RNG == 3:
                return RESTRICTION[3]
            if RNG == 4:
                return RESTRICTION[4]
    
    def Challenge():
            print INTRO, Choose_Race(), Choose_Class()
            print 'You must', Choose_Quest()
            print 'As a', Choose_Restriction(), '\n'
            print 'Your quest is worth', QUEST_VALUE, 'points.'
    
    Challenge()
    Last edited by gut; 10-21-2011 at 07:27 PM.
    "Whip me!" pleads the adom player. The rng replies... "No."

  3. #3
    Join Date
    Mar 2008
    Location
    Kentucky
    Posts
    5,067

    Default

    either I am the only adomer awake, or this was a much more horrible idea than I thought

    anyhoo, I reworked the code to (hopefully) not be so ugly, thanks to bloody lemon's encouragement.
    Should be easier to expand upon anyway...
    Code:
    import random
    
    INTRO = 'Your challenge is to roll a'
    
    RACE = ['human', 2, 'troll', 1, 'high elf', 2, 'gray elf', 2, 'dark elf', 2, \
    'dwarf', 2, 'gnome', 2, 'hurthling', 2, 'orc', 1, 'drakeling', 1]
    
    OCCUPATION = ['wizard.', 1, 'archer.', 1, 'barbarian.', 1, 'necromancer.', 1, 'elementalist.', 1, \
    'fighter.', 2, 'paladin.', 2, 'priest.', 2, 'monk.', 2, 'druid.', 2, 'beastfighter.', 2, \
    'assassin.', 4, 'ranger.', 4, 'bard.', 4, 'healer.', 4, 'weaponsmith.', 4, \
    'merchant.', 8, 'thief.', 8, 'mindcrafter.', 8, 'farmer.', 8]
    
    QUEST_TYPE = ['return the cute puppy to the tiny girl', 1, 'kill', 2, 'find', 2, 'commit suicide in', 1]
    QUEST_MONSTER = ['a mimic', 2, 'a rust monster', 2, 'a master swordsman', 2, 'a ratling duelist', 4]
    QUEST_ITEM = ['an amulet of perserverance', 2, 'a mithril shield', 2, 'a mithril sword', 2, \
    'a pair of mithril boots', 3]  
    LOCATION = ['the pyramid, \ndungeon level 3,', 4, 'GriffYard, \ndungeon level 2,', 3, \
    'the tomb of the high kings, \ndungeon level 6,', 4, 'caverns of chaos, \ndungeon level 15,', 3]
    TURN_COUNT = ['6000.', 4, '7000.', 3, '8000.', 2, '9000.', 1, '10000.', 1]
    
    CRUEL_RESTRICTION = ['cruel restriction, you must drop all your \nitems in the wilderness on turn 1.', 4, \
    'cruel restriction, you must pray until your \ninventory is cursed upon game start.', 5, \
    'cruel restriction, you must pray until you are doomed upon game start.', 8, \
    'cruel restriction, you must forego all armor \nfor 5000 turns, starting on game turn 1.', 6, \
    'cruel restriction, you must forego melee attacks \nfor 5000 turns, starting on game turn 1.', 5]
    
    RESTRICTION = ['restriction, you must drop all your \nfood in the wilderness upon game start.', 1, \
    'restriction, you must kick the air until \nyour HPs are under 5 upon game start.', 1, \
    'restriction, you must forego all armor \nfor 2000 turns, starting from game turn 1.', 3, \
    'restriction, you must forego melee attacks \nfor 2000 turns, starting from game turn 1.', 2, \
    'restriction, you must forego the detect traps skill.', 1]
    
    class DETAILS():
        """storage for challenge details and points"""
    
    DETAILS.race_points = 0
    DETAILS.occupation_points = 0 
    DETAILS.turn_points = 0
    DETAILS.monster_points = 0
    DETAILS.item_points = 0
    DETAILS.location_points = 0
    DETAILS.quest_points = 0
    DETAILS.restriction_points = 0
    
    def Choose_Race():
        RNG = random.randrange(0, 19, 2)
        DETAILS.race = RACE[RNG]
        DETAILS.race_points = RACE[RNG+1]
    
    def Choose_Occupation():
        RNG = random.randrange(0, 39, 2)
        DETAILS.occupation = OCCUPATION[RNG]
        DETAILS.occupation_points = OCCUPATION[RNG+1]
    
    def Choose_Turns():
        RNG = random.randrange(0, 9, 2)
        DETAILS.turns = TURN_COUNT[RNG]
        DETAILS.turn_points = TURN_COUNT[RNG+1]
    
    def Choose_Monster():
        RNG = random.randrange(0, 7, 2)
        DETAILS.monster = QUEST_MONSTER[RNG]
        DETAILS.monster_points = QUEST_MONSTER[RNG+1]
    
    def Choose_Item():
        RNG = random.randrange(0, 7, 2)
        DETAILS.item = QUEST_ITEM[RNG]
        DETAILS.item_points = QUEST_ITEM[RNG+1]
    
    def Choose_Location():
        RNG = random.randrange(0, 7, 2)
        DETAILS.location = LOCATION[RNG]
        DETAILS.location_points = LOCATION[RNG+1]
    
    def Choose_Quest():
        RNG = random.randrange(0, 7, 2)
        DETAILS.quest = QUEST_TYPE[RNG]
        DETAILS.quest_points = QUEST_TYPE[RNG+1]
    
    def Choose_Restriction():
        RNG = random.randrange(0, 5, 1)
        if RNG == 0:                            # +4 if cruel restriction
            RNG = random.randrange(0, 9, 2)
            DETAILS.restriction = CRUEL_RESTRICTION[RNG]
            DETAILS.restriction_points = CRUEL_RESTRICTION[RNG+1]
        else:
            RNG = random.randrange(0, 9, 2)
            DETAILS.restriction = RESTRICTION[RNG]
            DETAILS.restriction_points = RESTRICTION[RNG+1]
    
    def Challenge():
        
        Choose_Race() 
        Choose_Occupation()
        Choose_Turns()
        Choose_Restriction()
        Choose_Quest()
        print INTRO, DETAILS.race, DETAILS.occupation
    
        if DETAILS.quest == 'return the cute puppy to the tiny girl':
            print 'You must', DETAILS.quest, 'by turn count', DETAILS.turns
        if DETAILS.quest == 'kill':
            Choose_Monster()
            print 'You must', DETAILS.quest, DETAILS.monster, 'by turn count', DETAILS.turns
        if DETAILS.quest == 'find':
            Choose_Item()
            print 'You must', DETAILS.quest, DETAILS.item, 'by turn count', DETAILS.turns
        if DETAILS.quest == 'commit suicide in':
            Choose_Location()
            print 'You must', DETAILS.quest, DETAILS.location, 'by turn count', DETAILS.turns
    
        i = DETAILS.race_points + DETAILS.occupation_points + DETAILS.turn_points + DETAILS.monster_points + DETAILS.item_points + DETAILS.location_points + DETAILS.quest_points + DETAILS.restriction_points
    
        print 'As a', DETAILS.restriction
        print 'Your quest is worth', i, 'points.'
    
    Challenge()
    Last edited by gut; 10-22-2011 at 02:19 AM.
    "Whip me!" pleads the adom player. The rng replies... "No."

  4. #4
    Join Date
    Aug 2011
    Location
    New Zealand
    Posts
    4

    Default

    Keep up the good work Gutt.

    personally I never use the \ escape for my lists. iirc it isn't needed

    Code:
    def __init__(self):
        x = [
        something, somthing else,
        another thing, even more things
        ]
    Also, how do you use the whole 'CLASSNAME.variable = a var' thing?
    Is this some python 3 wizardry?

  5. #5
    Join Date
    Mar 2008
    Location
    Kentucky
    Posts
    5,067

    Default

    yes, the backslashes aren't needed. I only put them in
    to avoid having to scroll horizontally, as I don't use
    word wrap.

    As for the 'CLASSNAME.variable = a var' thing... um, I
    only tried using a class for the first time on the day
    I wrote this, so I don't think I can give much of an
    explaination of how. I didn't have any trouble setting
    CLASSNAME.variable to anything though. I didn't even have
    to set them all to zeros before creating/modifying them,
    I only did that because it made the message generating
    code easier to work with. I only use python 2.7.

    Hopefully I can get time to get a decent quest list going soon.
    "Whip me!" pleads the adom player. The rng replies... "No."

  6. #6
    Join Date
    May 2008
    Posts
    1,540

    Default

    Hang on, so the mission impossible is to create ugly hacks of ADOM?

  7. #7
    Join Date
    Oct 2011
    Location
    Oxfordshire, England
    Posts
    52

    Default

    Wow I really like this, more because I started learning python not so long ago and it gives me millions of ideas of practice scripts to write.

    Do you know any easy way of making python scripts into exe's? I don't fully understand how to work py2exe.

    More related to adom though, I really do like the script I think it has lots of potential and could make some really interesting challenges.
    Life is measured not by the breaths that you take, but by the moments which take your breath away

    Last killed by: Killer fish. Forgot about ice bridge weight limit >_<

  8. #8
    Join Date
    Mar 2008
    Location
    Kentucky
    Posts
    5,067

    Default

    py2exe is all I have heard of, but that is probably because I am a programming noob
    "Whip me!" pleads the adom player. The rng replies... "No."

Posting Permissions

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