The Dink Network

Reply to Re: Dynamically generated choices

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
December 17th, 09:44 PM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
Oh, NOW YOU'VE DONE IT! 
It's an attempt to programmatically add options to a choice menu which isn't possible in DinkC due to the line parser changing completely once it hits menu options (edit: my reply looks nonsensical since lep changed his post). It's fairly straightforward in DinkLua however:

function talk()
    -- Store references
    local refs = {"beans", "pasta", "salad", "rice"}
    local mymenu = dink.create_choice_menu()
    -- Add random foods to it
    for i = 1, 20 do
      local randint = math.random(1, #refs)
      mymenu:add_choice(refs[randint])
    end

    local mychoice = mymenu  how()
    player  ay("I chose option " .. global.result)
end