Navi - a message library (6/11 demo)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Navi - a message library (6/11 demo)

Post by substitute541 »

litearc wrote:@substitute541: Okay, I think I fixed the problem. Can you try the updated version and see if it works? download/file.php?id=8073
Okay it works now. Thanks!
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Navi - a message library (6/11 demo)

Post by substitute541 »

I got a suggestion for the library.

I know about the formatters and stuff, (|c{red}, |:, |, etc.) but I'm thinking of a special formatter (not really a formatter, but just a special sequence of characters) that can call a function every time the letter near the formatter is shown (this might be only applicable for messages that you can't skip.) Something like:

Code: Select all

message = _navi:new("I shall |^shake this planet", {someoptions}, shakeTheEarth)
In that case, |^ is the formatter that calls the function, "shakeTheEarth".
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
litearc
Citizen
Posts: 57
Joined: Thu May 17, 2012 12:40 am

Re: Navi - a message library (6/11 demo)

Post by litearc »

That's a great idea, but I think there's something a bit more flexible. Instead of passing a function to call, the message would have an internal flag(s) that gets set when it reaches the i.e. "|^", and it's up to the user to do something based on that flag. This may be more helpful if the function to call accepts arguments or if you want to execute multiple statements, etc... Anyway, I'll implement it later. I'm currently busy trying to learn Qt and don't want to get sidetracked. Thanks!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Navi - a message library (6/11 demo)

Post by Robin »

I wouldn't bother with overcomplicating things. substitute541's suggestion is powerful enough. For example, arguments:

Code: Select all

message = _navi:new("I shall |^shake this planet", {someoptions}, function() shakeTheEarth("with", arguments) end)
As for multiple statements... well, a function can always have more than one statement, so you're golden there. Using a system based on flags would probably over-complicate a simple and powerful feature.
Help us help you: attach a .love.
User avatar
Daniel Eakins
Citizen
Posts: 99
Joined: Thu Jul 18, 2013 9:14 pm
Location: France

Re: Navi - a message library (6/11 demo)

Post by Daniel Eakins »

Helvecta wrote:I've been working on the exact same thing but never noticed this library.
Maybe because it's not on the wiki :(

In any case, this is a fantastic module.
User avatar
Cluke009
Prole
Posts: 15
Joined: Tue Aug 20, 2013 7:13 pm

Re: Navi - a message library (6/11 demo)

Post by Cluke009 »

Just in case anything ever happens to the forum link I have copied over this great library to my github account https://github.com/cluke009/Navi.

There a few modifications I have made at this point but you can just go back to the initial commit for the original version.
Chiflada
Prole
Posts: 2
Joined: Thu Sep 18, 2014 5:53 pm

Re: Navi - a message library (6/11 demo)

Post by Chiflada »

I'm glad I found this library for my RPG project but I have a problem using it.

When I start my program the screen appears to be darker for a short moment, when my test message appears it is normal again and when it is finished and I hit the enter button the screen gets darker again... :?
I wonder whether I left out some resetting/reinitialization stuff although I did everything like in the manual.

The code has the following structure:

Code: Select all

function love.load()
	-- load game stuff

	-- load message library
	_navi = require 'arc'

	-- create test message	
	msg1 = _navi:new('Hello world!')

end

function love.update(dt)
	-- messaging
	arc.check_keys(dt)

	-- update game stuff
end

function love.keypressed(key)
	-- messaging
	arc.set_key(key)

	-- process key for game stuff
end

function love.draw()
	-- draw game map and character

	-- messaging
	msg1:play(100,100)
	arc.clear_key()
end
Did I miss something?
User avatar
DmL
Prole
Posts: 18
Joined: Fri Nov 21, 2014 9:09 am

Re: Navi - a message library (6/11 demo)

Post by DmL »

I didn't look at your code sample, but what you are describing sounds like you need to explicitly set your color before drawing after navi/arc has been called.
User avatar
Doctory
Party member
Posts: 441
Joined: Fri Dec 27, 2013 4:53 pm

Re: Navi - a message library (6/11 demo)

Post by Doctory »

this is awesome!
Chiflada
Prole
Posts: 2
Joined: Thu Sep 18, 2014 5:53 pm

Re: Navi - a message library (6/11 demo)

Post by Chiflada »

DmL wrote:I didn't look at your code sample, but what you are describing sounds like you need to explicitly set your color before drawing after navi/arc has been called.
Hmm, I'm not sure, I still have the feeling that I just missed doing some navi-specific stuff...

I uploaded the real code to github, maybe someone can try it out: https://github.com/JanaFlauschata/luarpg

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 39 guests