Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gamma Eats
#1
Along with being a hobbyist programmer I've been a tabletop RPG fan for over 40 years now. this program was written as a simple utility for my own home RPG campaign. The output will be amusing and baffling if you have no idea what this is all for.   WhatI  really want to share here is how I generate the lists using data reads and tags inside the data to build the lists.   

The buildlist sub does most of the work. I keep fiddling with the data for lists like this so working up this sub to work as it does was the simplest approach for me.  I could get fancy and make it work when reading from a data file but I haven't had the need to do that yet. I had an older method that restored to specific blocks of data but tracking the locations is very cumbersome in a more dymanic program model (can't keep labels in strings all by themselves).

I use a simple trick to randomly select an entry from each list (which are each string arrays). I  record the upper bound when the list is read and shove it into element 0 for recalling later.  I could probably just do the Ubound call but I have another utility that uses similar lists where I use a more complicated dice roller algorithm that stores the dice range in that position so I'm keeping the general method consistent across programs. 

The output goes to a console window so I can copy and paste the output into another document with ease and don't have to worry about tracking data files and then just copying and pasting into my game documents  later.

I could have created a boringly generic example to share, but that's just not much fun.

Code: (Select All)
'gamma eats
'generate specific dishes available in Gamma World shelters, hovels, and roadside diners
'Some of data here comes from the 1st edition of the GammaWorld RPG orignally published by TSR games and is used without explict permission as fan support materials
$ScreenHide
'$dynamic
Randomize Timer
$Console
_Console On
_Dest _Console
_ScreenHide
Dim Shared critter$(999), bug$(999), egg$(999), larva$(999), milk$(999)
Dim Shared vegimal$(999), vegipart$(999), broth$(999), meatprep$(999), meatpart$(999)
Dim Shared eggprep$(999), cereal$(999), Baked$(999), pasta$(999), dairy$(999), vegprep$(999)
Dim Shared mixedmeal$(999), sauce$(999), oldfoodflavor$(999), oldfoodform$(999), oldcontainer$(999)

buildlist "/start:critter", critter$()
buildlist "/start:bug", bug$()
buildlist "/start:egg", egg$()
buildlist "/start:larva", larva$()
buildlist "/start:milk", milk$()
buildlist "/start:vegimal", vegimal$()
buildlist "/start:vegipart", vegipart$()
buildlist "/start:broth", broth$()
buildlist "/start:meatprep", meatprep$()
buildlist "/start:meatpart", meatpart$()
buildlist "/start:eggprep", eggprep$()
buildlist "/start:cereal", cereal$()
buildlist "/start:baked", Baked$()
buildlist "/start:pasta", pasta$()
buildlist "/start:dairy", dairy$()
buildlist "/start:mixedmeal", mixedmeal$()
buildlist "/start:vegprep", vegprep$()
buildlist "/start:sauce", sauce$()
buildlist "/start:oldfoodflavor", oldfoodflavor$()
buildlist "/start:oldfoodform", oldfoodform$()
buildlist "/start:oldcontainer", oldcontainer$()



For reps = 1 To 20

    pick = Int(1 + Rnd * 16)
    Select Case pick

        Case 1, 2
            DD$ = "Salad of "
            a$ = vegimal$(1 + Int(Rnd * 8)) + " " + vegipart$(1 + Int(Rnd * 8))
            If Rnd * 6 < 4.2 Then a$ = vegprep$(1 + Int(Rnd * 5)) + " " + a$
            b$ = vegimal$(1 + Int(Rnd * 8)) + " " + vegipart$(1 + Int(Rnd * 8))
            If a$ = b$ Then b$ = meatprep$(1 + Int(Rnd * 3)) + " " + vegimal$(1 + Int(Rnd * 8)) + " " + vegipart$(1 + Int(Rnd * 8))
            DD$ = DD$ + a$ + " and " + b$
        Case 3
            DD$ = vegimal$(1 + Int(Rnd * 8)) + " " + cereal$(1 + Int(Rnd * 4))
        Case 4
            a$ = eggprep$(1 + Int(Rnd * 9))
            b$ = " " + egg$(1 + Int(Rnd * 10)) + " eggs"
            C$ = " "
            If a$ = "Omelette" Then
                a$ = "Omelette of"
                C$ = " with " + vegimal$(1 + Int(Rnd * 8)) + " " + vegipart$(1 + Int(Rnd * 8))
            End If
            If Rnd * 6 < 4 Then
                DD$ = a$ + b$ + C$
            Else
                DD$ = a$ + b$ + C$ + " and " + Baked$(1 + Int(Rnd * 6))
            End If

        Case 4, 5, 6
            a$ = meatprep$(1 + Int(Rnd * Val(meatprep$(0))))
            b$ = critter$(1 + Int(Rnd * Val(critter$(0))))
            DD$ = a$ + " " + b$
            Select Case Int(1 + Rnd * 10)
                Case 1
                    DD$ = DD$ + " smothered in " + sauce$(1 + Int(Rnd * Val(sauce$(0)))) + " sauce"
                Case 2
                    DD$ = DD$ + " drizzled with " + sauce$(1 + Int(Rnd * Val(sauce$(0)))) + " sauce"
                Case 3
                    DD$ = DD$ + " served in a puddle of " + sauce$(1 + Int(Rnd * Val(sauce$(0)))) + " sauce"
                Case 4
                    DD$ = DD$ + " in red-eyed gravy"
                Case 5
                    DD$ = DD$ + " with a generous portion of seasoned pan-drippings"
                Case 6
                    DD$ = DD$ + " with a thin sauce of drippings"
                Case 7, 8
                    DD$ = DD$ + " with some " + sauce$(1 + Int(Rnd * Val(sauce$(0)))) + " sauce on the side"
                Case 9, 10
            End Select
        Case 7, 8
            a$ = pasta$(1 + Int(Rnd * Val(pasta$(0))))
            b$ = sauce$(1 + Int(Rnd * Val(sauce$(0))))
            C$ = milk$(1 + Int(Rnd * Val(milk$(0)))) + " cheese"
            Select Case Int(1 + Rnd * 12)
                Case 1, 2
                    DD$ = a$ + " served with a " + b$ + " sauce"
                Case 3, 4
                    DD$ = a$ + " mixed with a " + b$ + " sauce"
                Case 5, 6
                    DD$ = a$ + " and " + C$
                Case 7, 8, 9
                    DD$ = a$ + " served in a thin broth"
                Case 10
                    DD$ = a$ + " served with a " + b$ + " sauce and " + C$
                Case 11
                    DD$ = "Plain " + a$
                Case 12
                    DD$ = "Plain" + a$ + " and a bottle of ketchup"
            End Select
        Case 9
            Select Case Int(1 + Rnd * 9)
                Case 1, 2, 3, 4
                    a$ = critter$(1 + Int(Rnd * Val(critter$(0))))
                Case 5, 6
                    a$ = bug$(1 + Int(Rnd * Val(bug$(0))))
                Case 7, 8, 9
                    a$ = vegimal$(1 + Int(Rnd * Val(vegimal$(0))))
            End Select
            Select Case Int(1 + Rnd * 6)
                Case 1, 2, 3
                    b$ = "burger"
                Case 4, 5
                    b$ = "slider"
                Case 6
                    b$ = "patties"
            End Select
            Select Case Int(1 + Rnd * 8)
                Case 1, 2, 3
                    C$ = "with a melted slice of " + milk$(1 + Int(Rnd * Val(milk$(0)))) + " cheese"
                Case 4
                    C$ = "smothered in " + milk$(1 + Int(Rnd * Val(milk$(0)))) + " cheese"
                Case 5, 6
                    C$ = " with an ancient slice of processed cheese-food"
                Case 7, 8
                    C$ = "plain"
            End Select
            Select Case Int(1 + Rnd * 6)
                Case 1, 2
                    d$ = " on a toasted bun"
                Case 3
                    d$ = " on a stale bun"
                Case 4
                    d$ = " on toasted bread"
                Case 5, 6
                    d$ = " on soggy bread"
            End Select
            If C$ = "plain" Then
                DD$ = a$ + " " + b$ + d$
            Else
                DD$ = a$ + " " + b$ + " " + C$ + d$
            End If
        Case 10 'full gamma breakfast
             a$ = eggprep$(1 + Int(Rnd * Val(eggprep$(0)))) + " " + egg$(1 + Int(Rnd * Val(egg$(0)))) + " eggs " 
            b$ = meatprep$(1 + Int(Rnd * Val(meatprep$(0)))) + " " + critter$(1 + Int(Rnd * Val(critter$(0))))
            If Int(Rnd * 6) < 3.5 Then
                b$ = b$ + "," + Str$(2 + Int(Rnd * 3)) + " slices of CRAM"
            End If
            C$ = vegimal$(1 + Int(Rnd * Val(vegimal$(0)))) + " " + cereal$(1 + Int(Rnd * Val(cereal$(0))))
            d$ = vegprep$(1 + Int(Rnd * Val(vegprep$(0)))) + " " + vegimal$(1 + Int(Rnd * Val(vegimal$(0)))) + " " + vegipart$(1 + Int(Rnd * Val(vegipart$(0))))
            e$ = Baked$(1 + Int(Rnd * Val(Baked$(0))))
            Select Case Int(1 + Rnd * 12)
                Case 1, 2
                    e$ = " a warm " + e$
                Case 3
                    e$ = " rock hard " + e$
                Case 4
                    e$ = " stale " + e$
                Case 5, 6
                    e$ = " toasted " + e$
                Case 7
                    e$ = " crumbling " + e$
                Case 8
                    e$ = " soggy " + e$
                Case 9, 10, 11, 12
                    e$ = e$

            End Select

            DD$ = a$ + ", " + b$ + ", " + C$ + ", " + d$ + " and " + e$
        Case 11, 12, 13
            Select Case Int(1 + Rnd * 10)
                Case 1, 2, 3
                    a$ = critter$(1 + Int(Rnd * Val(critter$(0))))
                Case 5, 6
                    a$ = bug$(1 + Int(Rnd * Val(bug$(0))))
                Case 7, 8, 9, 10
                    a$ = vegimal$(1 + Int(Rnd * Val(vegimal$(0))))
            End Select
            b$ = vegimal$(1 + Int(Rnd * Val(vegimal$(0)))) + " " + vegipart$(1 + Int(Rnd * Val(vegipart$(0))))
            C$ = broth$(1 + Int(Rnd * Val(broth$(0))))
            Select Case Int(1 + Rnd * 12)
                Case 1, 2, 3
                    t$ = "A warm bowl of "
                Case 4, 5, 6
                    t$ = "A piping hot bowl of "
                Case 7
                    t$ = "A cold bowl of "
                Case 8, 9
                    t$ = "A tepid cup of "
                Case 10, 11, 12
                    t$ = "A warm cup of "

            End Select
            DD$ = t$ + a$ + " and " + b$ + " " + C$
        Case 14, 15, 16
            a$ = oldfoodflavor$(1 + Int(Rnd * Val(oldfoodflavor$(0))))
            b$ = oldfoodform$(1 + Int(Rnd * Val(oldfoodform$(0))))
            C$ = oldcontainer$(1 + Int(Rnd * Val(oldcontainer$(0))))
            Select Case Int(1 + Rnd * 6)
                Case 1, 2, 3
                    C$ = "A freshly opened " + C$ + " of"
                Case 4, 5
                    C$ = "Half a " + C$ + " of"
                Case 6
                    C$ = "Some"

            End Select
            DD$ = C$ + " " + a$ + " " + b$
            If Rnd * 6 < 4.5 Then
                Select Case Int(1 + Rnd * 8)
                    Case 1, 2
                        DD$ = DD$ + ", stale"
                    Case 3, 4
                        DD$ = DD$ + ", has a chemical aftertaste"
                    Case 5
                        DD$ = DD$ + ", surpirsingly tasty"
                    Case 6
                        DD$ = DD$ + ", bland"
                    Case 7
                        DD$ = DD$ + ", it smells a bit off"
                    Case 8
                        DD$ = DD$ + ", it smells a bit off but tastes fine"


                End Select
            End If
        Case 17, 18
            a$ = mixedmeal$(1 + Int(Rnd * Val(mixed$(0))))
            Select Case Int(1 + Rnd * 4)
                Case 1
                    b$ = critter$(1 + Int(Rnd * Val(critter$(0))))
                Case 2
                    b$ = bug$(1 + Int(Rnd * Val(bug$(0))))
                Case 3, 4
                    b$ = vegimal$(1 + Int(Rnd * Val(vegimal$(0))))
            End Select
            C$ = oldfoodflavor$(1 + Int(Rnd * Val(oldfoodflavor$(0)))) + " " + oldfoodform$(1 + Int(Rnd * Val(oldfoodform$(0))))
            If Rnd * 8 < 5 Then
                C$ = C$ + ", " + oldfoodflavor$(1 + Int(Rnd * Val(oldfoodflavor$(0)))) + " " + oldfoodform$(1 + Int(Rnd * Val(oldfoodform$(0))))
            End If
            d$ = sauce$(1 + Int(Rnd * Val(sauce$(0))))
            DD$ = a$ + " of " + b$ + "," + C$ + " with a " + d$ + " sauce "
            If Rnd * 8 < 4 Then
                DD$ = DD$ + "and " + milk$(1 + Int(Rnd * Val(milk$(0)))) + dairy$(1 + Int(Rnd * Val(dairy$(0))))
            End If
    End Select

    If reps < 10 Then Print "  ";
    If reps > 9 And reps < 100 Then Print " ";
    Print _Trim$(Str$(reps)); "." + " " + _Trim$(DD$)

Next reps





'eatbale critters
Data "/start:critter","Barl Nep","Blight","Brutorz","Centisteed","Cren Tosh","Ert","Fleshin","Herkel","Hopper"
Data "Keeshin","Podog","Rakox","Sep","Terl","Zarn","Rat","/END"

'edible bugs
Data "/start:bug","Arn","Blaash","Herp","Parn","Soul Besh","Locust","Roach","Ant","/END"

'critter eggs
Data "/start:egg","Arn","Barl Nep","Blassh","Blight","Cal Then","Ert Telden","Fleshin","Herp","Terl","Ant","/END"

'critter larva
Data "/start:larva","Arn","Blash","Blight","Cal Then","Herp","Parn","Soul Besh","Ant","/END"

'critter milk
Data "/start:milk","Brutorz","Hopper","Centisteed","Rakox","/END"
'vegimals
Data "/start:vegimal","Crep Plant","Horl Choo","Kai Lin","Kep","Narl Ep","Pineto","Seroon Lou","Zeeth","/END"
'vegparts
Data "/start:vegipart","Fronds","Shoots","Seeds","Roots","Starch","Leaves","Pulp","Stalk","Sprouts","/END"

'broths
Data "/start:broth","Broth","Stew","Soup","Chowder","Bisque","Goulash","Gumbo","/END"
'meatprep
Data "/start:meatprep","Dried","Pickled","Roasted","Salted","Jerked","Smoked","Corned","Minced","Shredded","Cured"
Data "Jellied","Deep-Fried","Seared","Fried","Baked","Boiled","/END"
'meatparts
Data "/start:meatpart","Brain","Tongue","Belly","Shank","Liver","Kidney","Foot","Ear","Chitlins","Offal","/END"
'eggprep
Data "/start:eggprep","Boiled","Fried","Scrambled","Poached","Omelette","Shirred","Basted","Pickled","Scotched","/END"
'mixedmeal
Data "/start:mixedmeal","Casserole","Dumplings","Pie","Turnovers","Jambalya","Scramble","Hash","/END"
'cereals
Data "/start:cereal","Porridge","Gruel","Mush","Mash","/END"
'bakedgoods
Data "/start:baked","Bread","Flatbread","Cake","Biscuit","Cracker","Muffin","/END"
'pasta
Data "/start:pasta","Noodles","Raviolli","Spaghetti","Couscous","Lasagna","/END"
'dairy
Data "/start:dairy","Milk","Cheese","Yogurt","Cream","Curds","Butter","Cottage Cheese","/END"
'vegprep
Data "/start:vegprep","Fresh","Dried","Sun-dried","Pickled","Fermented","Blanched","Seared","Roasted","/END"
'sauces
Data "/start:sauce","Garlic","Thin","Zesty","Fruity","Peppery","Spicy","Piquant","Tangy","Bar-B-Q","Bitter","Savory","Creamy","Green","Red","Cheese","/END"


Data "/start:oldfoodflavor","Cheez","Vega","Vegi","Vegamax","Krilla","Bean","Oat","Soy","Fruity","Choco","Berry","Baaf"
Data "Chucken","Tarkey","Fush","Lomb","Loobster","Crob","Clum","Chom","Nilla","Wheati","Graino","Corn"
Data "Tatter","Potato","Beef","Chicken","Turkey","Fish","Lamb","Soylent","Prawn","Mussel","Mackrel","Tuna"
Data "Pork","Pirk","Melom","Nut","Seed","Peanut","Ginger","Bar-B-Q","Nutri","Nutra","Nutria","Sugar"
Data "Sweet","Honey","Hunee","Coffee","Protien","Prolean","Simulean","Maxilean","Leano","Mushroom","Mashroom","Beefalo","/END"



Data "/start:oldfoodform","Paste","Chews","Tubes","Dumplings","Pockets","Loaf","Biscuits","Crackers","Wafers","Flakes"
Data "Powder","Jelly","Sauce","Curry","Soup","Stew","Broth","Chowder","Crisps","Sausage"
Data "Chili","Steak","Leather","Sticks","Jerky","Milk","Syrup","Nectar","Water","Spread","Puffs"
Data "Butter","Borritos","Wraps","Cubes","Mash","Drink","Granola","Cake","Pie","Muffin","/END"

Data "/start:oldcontainer","Can","Packet","Cup","Readi-Bowl","Insta-cup","Lunch-Pack","Box","Bottle","Jar","Pouch","/END"



Sub buildlist (flag$, list$())
    Restore
    n = 0
    flagfound = 0
    Do

        Read d$
        If flagfound = 1 And d$ <> "/END" Then
            n = n + 1
            list$(n) = d$
        End If
        '   Print d$
        If d$ = flag$ Then flagfound = 1
    Loop Until d$ = "/END" And flagfound = 1
    ReDim _Preserve list$(n)
    top$ = Str$(UBound(list$))
    list$(0) = _Trim$(top$)
    'Input check$
End Sub
Reply




Users browsing this thread: 1 Guest(s)