Function for making dialogues easier!

Talk about making games.

Function for making dialogues easier!

Postby lcl » Wed Sep 01, 2010 6:57 am

Hi! :D

Here's something I am going to use in my next game.
A function for text! :D

So there is two functions to use for making dialogues easier. :D
First one is called message, it works like normal sprintf,
but you don't have to put any other thing in it, but the message, like this:

message("Hello world!");

And second one defines the actor who prints the text.
Just go to some text actor that you want to print all messages and then
place this to it's draw actor code:

use();

Place this to global code:
Code: Select all
char line[200];

void message(char * write)
{
    strcpy(line, write);
}

void use()
{
    sprintf(text, "%s", line);
}
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Function for making dialogues easier!

Postby DST » Wed Sep 01, 2010 3:38 pm

If you want some spoken dialogues, try this...

The main script is in dialogue>draw actor, dialogue>key down, global code "starts" and nextarrow>draw actor.

You can see the code is actually very simple, and results in a traditional rpg word speak. The trick is using memcpy to copy part of the string to another string, and just increasing the size of the part you are copying. Give it a try, you'll be amazed at how easy it is!

speak.zip
GED
(207.2 KiB) Downloaded 75 times
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Function for making dialogues easier!

Postby lcl » Wed Sep 01, 2010 4:07 pm

Wow, this seems much more clear than pyrometals dialogue engine... :lol:
Though, I can't understand the code still.. :|
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Function for making dialogues easier!

Postby DST » Wed Sep 01, 2010 6:37 pm

Which part of it don't you understand?
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Function for making dialogues easier!

Postby pyrometal » Wed Sep 01, 2010 8:46 pm

lcl wrote:Wow, this seems much more clear than pyrometals dialogue engine... :lol:
Though, I can't understand the code still.. :|


lol, hey now... My code isn't that untrackable :P
SPRITE WARRIOR:
Free, open-source & crossplatform pixel art editor (currently under construction).
User avatar
pyrometal
 
Posts: 706
Joined: Wed Nov 28, 2007 4:07 am
Location: Kingston, ON, Canada
Score: 86 Give a positive score

Re: Function for making dialogues easier!

Postby Bee-Ant » Thu Sep 02, 2010 4:12 am

Here's my version...
I think this is way simpler than DST's...
Attachments
TypeWriteText(fixed).zip
(191.72 KiB) Downloaded 65 times
TypeWriteText.zip
(191.51 KiB) Downloaded 48 times
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Function for making dialogues easier!

Postby lcl » Thu Sep 02, 2010 10:37 am

@ DST:
I didn't understand how it works...
I am still learner with script... :)

@ Pyrometal:
lol, It's quite same answer as for DST, I don't
know scripting well enough to understand how those codes work.. :D

@ Bee-Ant:
Wow, this one's good also! :D
But I think all of these work nearly the same way
and it's something I can't understand... :(

That's my real problem, I see codes like this but can't figure out why they work as they do.
But thanks anyway! I'll keep looking on them and I maybe find out something of how they work... :wink:
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Function for making dialogues easier!

Postby Bee-Ant » Fri Sep 03, 2010 12:45 am

@lcl: the requirement to understand :
- function
- string
- array
- loop

@kren: logic is part of programming. It's a common sense. As long as you keep learning, time would tell :D

@DST: do you want to start a fight again?
This is a good topic to learn.
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Function for making dialogues easier!

Postby DST » Fri Sep 03, 2010 12:51 am

No, i shouldn't start a fight here. This IS a good topic to learn.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Function for making dialogues easier!

Postby lcl » Fri Sep 03, 2010 1:36 pm

Bee-Ant wrote:@lcl: the requirement to understand :
- function
- string
- array
- loop


In that list is some things that I don't unerstand very well. Loops.
I can't understand using of them. :(
But thanks anyway guys, I think I still can learn something of those codes if I
just keep trying. :D I am learner of scripting and that's why I don't understand
everyting. :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest