The Daily Click ::. Downloads ::. Tutorial ::. Lua rpg style dialogue engine UPDATE

Lua rpg style dialogue engine UPDATE
Author: Zephni Submitted: 1st December, 2008 Favourites:2
Genre: Tutorial Downloads: 610

Edited By Zephni on 12/1/2008

Edited By Zephni on 12/1/2008

This is my first proper try at lua, and i think i fully understand how it works now.

This is a RPG style msg box that reads its text from an external source (a lua file) that comes with the download.

Now don't just disregard lua.. I think used in the correct way lua can be extreamly powerfull. Esspecialy if you making a level editor, mainly because if you want to create an event in a level editor all you have to do is link it with a lua file and mmf will cause events on the functions called from the lua file.

The Underside by "The Podunkian" is a very flexable game, and all its cutscenes/dialogue/pick-ups and triggers are scripted in lua. Its not hard to learn and i think it makes life easyer for a clicker (yes even easyer). It means not haveing to recomplie your game everytime you want to make a tiny change or add to your story.

Anyway rather than me explaining how it works take a look =

OH! and if you already know lua any help would be great as i only learnt it a couple of days ago. (If iv'e over coded)

Thank guy's! i'd like to know what people think of useing lua, coz' im sure some clickers are against it, or just can't be botherd, just voice your opinions yeah!

Now you can put a face picture with each msg
Now the text writes out char by char (hold return to speed up)
Now by putting a "|" in your string it will pause the text for 1 second.

Review This Download (500 kkb )

Posted by UrbanMonk 1st December, 2008

Its cool, but you didn't have to include that edited font, you could have replaced the "|" with a space in your code.
Comment edited by UrbanMonk on 12/1/2008
Posted by viva/volt 1st December, 2008

You should really have just parsed out the pause character instead of making it a space...

I've made a lua engine which is basically identical to Pod's - here's some advice, it's not very useful until you figure out how to not wrap everything with "if (msgNo==X) then" and "end". This takes a while but the concept is easy enough to grasp.

In my engine this would read as follows:

function Msg ()
s("Hey!|.|.|Welcome to Zephni's tutorial on useing lua.| Hopefully\nyou'll learn some interesting stuff!!");
s("Pssst! I heard that if you have any questions about this or about this new awsum game thats comeing up about me you can ask\nZephni on TDC or contact him at");
s("Hehe...Sorry bout the shameless plug");

You also shouldn't be manually inserting linebreaks in the dialogue... But that isn't so bad really.

Anyway, good tech demo - could use some work before it's actually usable IMO.

Posted by Zephni 1st December, 2008

@UrbanMonk: How do you meen? If it was a space that i used as the pause, it would pause every time i had a space.

@Ben: I tryed so many different things to try and get it working like that, but i couldnt find a way to get it to read the lines one by one. Because it reads the whole function before returning anything why should it return msg1/2/3(ect) in order? If you have a small example of this i'd be really greatfull.

Oh and sorry how'd you meen about the "|"? use string parser?

Cheers Guys!
Comment edited by Zephni on 12/1/2008
Posted by Zephni 1st December, 2008

Hey Ben, sorry for the no0bishness but because to see if the string that is the message has finished it conditions (if stringMSG equals stringFeeder) if you take out the "|" from the stringMSG it won't be the same as the feeder anymore...


Oh! and i had a lil think about it and to do that thing where you dont need if msgNo==X seems like it would require another lua file running to tell it what msg its reading. So when it gets to that message number it just plays the function, but the code is more simple as its not litterd with if and end statements!
Am i right or is there a better way?
Comment edited by Zephni on 12/1/2008
Posted by UrbanMonk 1st December, 2008

I know that first comment sounded confusing
what I meant was this-
Posted by Zephni 1st December, 2008

ok i see what you meen, but i'd like it so the "|" doesnt show up at all.

Cheers for help though!
Posted by Zephni 1st December, 2008

Could some1 please please help me. I'd like to be able to have the functions all in a seperate lua file, and have the scripts in their own file aswell. So less coding when doing scrips (like Bens saying). But how do i get MMF distinguish the two correctly and call functions from the file which it isnt actualy currently reading (the script file)
Posted by UrbanMonk 2nd December, 2008

If you don't want the "|" to show up at all, then redownload it again, I removed it completely, but I liked it better before...
Posted by Zephni 2nd December, 2008

If you use the text blitter you can jst edit out the "|"





Worth A Click