Jump to content

Custom Console Command With Autocomplete?


Recommended Posts

Looking through consolescreen.lua, you can find things like:

self.console_edit:EnableWordPrediction({width = 1000, mode=Profile:GetConsoleAutocompleteMode()})
	self.console_edit:AddWordPredictionDictionary({words = prefab_names, delim = '"', postfix='"', skip_pre_delim_check=true})
	self.console_edit:AddWordPredictionDictionary({words = prefab_names, delim = "'", postfix="'", skip_pre_delim_check=true})

In modmain, how would I be able to create a custom console command, and then add it to the Dictionary ? 

Link to comment
Share on other sites

13 hours ago, ant7735 said:

In modmain, how would I be able to create a custom console command, and then add it to the Dictionary ? 

You just need to define a global function starting with "c_", it will be imported automatically.

You can set your environment to global by calling GLOBAL.setfenv(1, GLOBAL) at the start of modmain.

Link to comment
Share on other sites

47 minutes ago, ant7735 said:

Thanks

I'm not entirely sure, since I'm not a developer or an expert modder. Definitely get a second opinion to check first.

Edited by The Starver
Link to comment
Share on other sites

1 hour ago, The Starver said:

I'm not entirely sure, since I'm not a developer or an expert modder. Definitely get a second opinion to check first.

Yep, after a bit of messing around the only other thing that 'cloud' work, is d_, 
It seems d_ and c_ are the only scanned prefixes inside of the consolecommandscreen.lua.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...