Page 1 of 1

[Information] Text Inputs for user commands

Posted: Tue Mar 12, 2013 8:28 am
by MassDivide
I'm looking for a function or library that gives a console based textinput box that can be placed and have callbacks for commands and etc.

Example:

/help
would print a few console commands.
/clear
would clear the window


Does anyone know of a library or function that can do something like this?

The game I wish to design is text based.

Re: [Information] Text Inputs for user commands

Posted: Thu Jun 27, 2013 11:35 pm
by MassDivide
Bump?

Re: [Information] Text Inputs for user commands

Posted: Thu Jun 27, 2013 11:39 pm
by NightKawata
God, that's a necropost alright.
JesseH has a type of app that looks similar to a console, but I have no clue if that's open source.

Plus, this is too simple to even need third-party help, at least, in my view.
This should help you get started.

Re: [Information] Text Inputs for user commands

Posted: Fri Jun 28, 2013 1:25 am
by Ensayia
I would suggest you look at the GUI libraries available on the LOVE wiki and check out how they handle text input. From there you can build a more custom tailored solution.

Re: [Information] Text Inputs for user commands

Posted: Fri Jun 28, 2013 4:05 am
by raidho36
I use this to read my config files, but with minor changes it could read any kind of input.

Code: Select all

	if love.filesystem.exists ( "settings.cfg" ) then 
		for line in love.filesystem.lines ( "settings.cfg" ) do
			-- this is sub-optimal, but simple
			local a = { }
			-- explode string ignoring comments
			for w in string.gmatch ( line, "%S+" ) do
				if string.sub ( w, 1, 1 ) == "#" then break end 
				table.insert ( a, w ) 
			end 
			if a[1] == "display" then
				settings.display_width = a[2]
				settings.display_height = a[3]
				settings.display_fullscreen = a[4]
			elseif a[1] == "openfile" then
				settings.openfile = a[2] 
			end
			-- etc.
		end
	end

Re: [Information] Text Inputs for user commands

Posted: Fri Jun 28, 2013 12:16 pm
by T-Bone
If the game truly is text based, why do you use Löve? Wouldn't it be better to just use plain lua and run it in a terminal or console?