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.
[Information] Text Inputs for user commands
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 2
- Joined: Tue Mar 12, 2013 8:24 am
-
- Prole
- Posts: 2
- Joined: Tue Mar 12, 2013 8:24 am
- 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
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.
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
Re: [Information] Text Inputs for user commands
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
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
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?
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 10 guests