Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to display message at beginning?
NylePudding Offline
Member

Posts: 77
Threads: 23
Joined: Apr 2011
Reputation: 0
#1
How to display message at beginning?

EDIT - Sorry guys, I've worked out how to do it. (Whoop!) I don't need you help. Big Grin

Hello, I'm very new to modding and I want to do something rather basic. So could you possibly help me? Big Grin

Basically I want to show a message 5 seconds after you start playing.

This is what I have so far:

void OnStart()
{
AddTimer("tut01", 5, "TimerTutorial01");

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i,

"tinderbox.ent");
}
}



void TimerTutorial01(string &in asTimer)
{
SetMessage(string& asTextCategory, string& asTextEntry, float afTime);
}

void OnEnter()
{

}

void OnLeave()
{

}


So what exactly do I have to put in the "SetMessage" function? For a simple example I want the message to say: "The Donkeys are going to get you!"

Like I said I am rather new to modding, so please have patience with me.
Shy
(This post was last modified: 04-29-2011, 10:07 AM by NylePudding.)
04-29-2011, 09:54 AM
Find
genmills Offline
Junior Member

Posts: 47
Threads: 7
Joined: Mar 2011
Reputation: 0
#2
RE: How to display message at beginning?

Edit NOOOOOOOO I just typed all this!! Haha, glad you figured it out though. Smile

(04-29-2011, 09:54 AM)NylePudding Wrote: Hello, I'm very new to modding and I want to do something rather basic. So could you possibly help me? Big Grin

Basically I want to show a message 5 seconds after you start playing.

This is what I have so far:

void OnStart()
{
AddTimer("tut01", 5, "TimerTutorial01");

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i,

"tinderbox.ent");
}
}



void TimerTutorial01(string &in asTimer)
{
SetMessage(string& asTextCategory, string& asTextEntry, float afTime);
}

void OnEnter()
{

}

void OnLeave()
{

}


So what exactly do I have to put in the "SetMessage" function? For a simple example I want the message to say: "The Donkeys are going to get you!"

Like I said I am rather new to modding, so please have patience with me.
Shy

Hehe, I was JUST working on this too and I finally got it! Basically, inside the function for the message, you don't write a message. You write the name of the message you want to appear. And those messages are in your extra_english.lang file.

So, go to your custom story's .lang file. You probably have a category and entry name for your description. Like this:

Spoiler below!

<LANGUAGE>

<CATEGORY Name="CustomStoryMain">

<Entry Name="Description">
Here is a cool story!
</Entry>

</CATEGORY>

</LANGUAGE>


Well, you need to add another category in here for your messages. I would just do it like this:

Spoiler below!

<LANGUAGE>

<CATEGORY Name="CustomStoryMain">

<Entry Name="Description">
Here is a cool story!
</Entry>

</CATEGORY>

<CATEGORY Name="Messages">

<Entry Name="Message1">
This is a cool message bro!
</Entry>

</CATEGORY>

</LANGUAGE>


So you see in the category of messages, you can create lots of entries. Ok back to your function. Inside of SetMessage(string& asTextCategory, string& asTextEntry, float afTime) you have to change some stuff.

The first part is the category in your .lang file for messages, and the second part is the name of the entry in that category. The last part is just how long you want the message to display. So using the silly messages I made, my code would read

SetMessage("Messages", "Message1", 5.0f);

And so it would display "This is a cool message bro!" for 5 seconds.

Hope that makes sense! Woot woot! I actually helped someone! Big Grin
(This post was last modified: 04-29-2011, 10:09 AM by genmills.)
04-29-2011, 10:08 AM
Find
NylePudding Offline
Member

Posts: 77
Threads: 23
Joined: Apr 2011
Reputation: 0
#3
RE: How to display message at beginning?

Thank you very much for helping me anyway. I had worked out how to do it but I didn't really know what I had done. You have solved that.

So really you have actually helped someone. Big Grin
04-29-2011, 10:35 AM
Find




Users browsing this thread: 1 Guest(s)