Setting up questions Similar to SVO's vinstall?

How hard would it be to code in something similar to VINSTALL, where you type a command and a series of prompts come up and you set misc. variables (in my case)?

For example, I'd type ZTEST there would be an echo that pops up "What would you like to set X too?" and the alias to set that X variable would already be in my command bar. 

Just curious, Thanks!

Comments

  • Basically, you want the install variable to like... Set a variable.. Say.. zinstall, to true.
    Then in all of the aliases, you want a secondary part to each of them that is like...
     if zinstall == true then
        <whatever> 
     end

    For the command line thing, you want something like this:

    tempTimer(0.1, [echo("\n Whatever has now been set... What would you like to do for <next alias>")]])

    tempTimer(1, [[clearCmdLine()]])

    tempTimer(1.5, [[appendCmdLine("zalias whatever ")]])

    Then you can put what you want at the end of that 'zalias whatever' ... Then you'd put one of the aforementioned 'if zinstall == true' in that next alias, and go until necessary. Then on the final alias, you'd set zinstall to false, if it's currently true.

  • KlendathuKlendathu Eye of the Storm
    I'd do it thus:

    Have a table set up with all of the variable names and their (default) values in it:

    zukoVar = zukoVar or {}
    zukoVar.tbl = zukoVar.tbl or {
    ["elmpipe"] = "123456",
    ["left_arm"] = "5",
    --put in whatever you want here as default
    }

    Then have an alias to update them *not tested, probably got errors:

    $zconfig (\w+) (.+)$

    if not matches[2] then				--no argument, display all
    	for k,v in pairs(zukoVar.tbl) do
    		cecho("\n<white>[<green>-<white>]<reset>"..k.." "..v)
    	end
    else
    	if not table.contains(zukoVar.tbl,matches[2]) then
    		cecho("\n<red>///<reset> "..matches[2].." not found in table <red>///<reset>")
    
    	elseif not matches[3] then		--display current entry
    		cecho("\n<white>[<green>-<white>]<reset>"..matches[2].." "..zukoVar.tbl[matches[2]])
    	else
    		zukoVar.tbl[matches[2]] = matches[3]
    		cecho("\n"<green>/// <reset> "..matches[2].." set to <white>"..matches[3].." <green>///<reset>")
    	end
    end

    You could add links to the variable names to click them to autopopulate the command line, etc. You'll probably want some kind of mechanism to save the contents of the table to an external file and automatically re-import them when you log in so they persist through sessions, etc.

    Tharos, the Announcer of Delos shouts, "It's near the end of the egghunt and I still haven't figured out how to pronounce Clean-dat-hoo."
Sign In or Register to comment.