Page 1 of 1

Function for making dialogues easier!

PostPosted: Wed Sep 01, 2010 6:57 am
by lcl
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);
}

Re: Function for making dialogues easier!

PostPosted: Wed Sep 01, 2010 3:38 pm
by DST
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 74 times

Re: Function for making dialogues easier!

PostPosted: Wed Sep 01, 2010 4:07 pm
by lcl
Wow, this seems much more clear than pyrometals dialogue engine... :lol:
Though, I can't understand the code still.. :|

Re: Function for making dialogues easier!

PostPosted: Wed Sep 01, 2010 6:37 pm
by DST
Which part of it don't you understand?

Re: Function for making dialogues easier!

PostPosted: Wed Sep 01, 2010 8:46 pm
by pyrometal
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

Re: Function for making dialogues easier!

PostPosted: Thu Sep 02, 2010 4:12 am
by Bee-Ant
Here's my version...
I think this is way simpler than DST's...

Re: Function for making dialogues easier!

PostPosted: Thu Sep 02, 2010 10:37 am
by lcl
@ 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:

Re: Function for making dialogues easier!

PostPosted: Fri Sep 03, 2010 12:45 am
by Bee-Ant
@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.

Re: Function for making dialogues easier!

PostPosted: Fri Sep 03, 2010 12:51 am
by DST
No, i shouldn't start a fight here. This IS a good topic to learn.

Re: Function for making dialogues easier!

PostPosted: Fri Sep 03, 2010 1:36 pm
by lcl
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