#(drjoenh) Tab completions

26 messages · Page 1 of 1 (latest)

ripe swallow
#

Hello, im working on world manager script (for yk.. managing my worlds) and got really confused with tab completions. I have this procedure -> https://paste.denizenscript.com/View/114527
so each arg should have its own numbered definition, but for some freackin reason the first arg is always list..?
debug -> https://paste.denizenscript.com/View/114526 (See line 28)

frigid knollBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

ripe swallow
#

nvm im dumb it makes sense now

#

tho i would like to improve that script

#

anyone got any examples on how does advanced tab complete logic looks like?

tropic pelican
#

whys that a proc?

ripe swallow
#

felt like it would be pretty messy over-time as im adding new things to it

tropic pelican
#

Depending on your command structure, you could use tab completions as opposed to tab complete which you turn into a proc

#

which you could simplify yeah

#

Also I have no idea why you're using choose on an ElementTag.. do you mix your proc with tab completions?

ripe swallow
#

ye imma share the whole thing

#

im using tab completsion, and made a procedure for that

tropic pelican
#

We used to use counting the arguments by the space, so case 0 would be the first argument and so on, with a filter - determine <[keys].filter[starts_with[<context.args.first.if_null[<empty>]>]]> to sort the arguments out

   tab complete:
   - choose "<context.raw_args.to_list.count[ ]>":

note that's tab complete, tab completions do that by default which makes that handy to have and tab completions better imo

#

you can handle most commands with a simple element.if_true.if_false chain

#

but if you want to do it your way, it's basically what you have yeah, minus all list contructors

#

though I would reconsider the naming of definitions

#

btw, <context.args.proc[procname].context[1]> and the first definitions a whole list, and the second one is an element

#

that will escape the list automatically

ripe swallow
tropic pelican
#

you could get the current size by <[arguments].size> in the proc no

#

would make passing the number of arguments redundant

ripe swallow
#

awesome!

#

thanks for ya help