[Information] Text Inputs for user commands

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
MassDivide
Prole
Posts: 2
Joined: Tue Mar 12, 2013 8:24 am

[Information] Text Inputs for user commands

Post 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.
MassDivide
Prole
Posts: 2
Joined: Tue Mar 12, 2013 8:24 am

Re: [Information] Text Inputs for user commands

Post by MassDivide »

Bump?
User avatar
NightKawata
Party member
Posts: 294
Joined: Tue Jan 01, 2013 9:18 pm
Location: Cyberspace, Room 6502
Contact:

Re: [Information] Text Inputs for user commands

Post 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.
"I view Python for game usage about the same as going fishing with a stick of dynamite. It will do the job but it's big, noisy, you'll probably get soaking wet and you've still got to get the damn fish out of the water." -taylor
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

Re: [Information] Text Inputs for user commands

Post 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.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: [Information] Text Inputs for user commands

Post 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
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: [Information] Text Inputs for user commands

Post 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?
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests