OK, I now think I have a working system for using the conversation system. Below a link to a video of testing the system. Also in the video testing using a video as a cut-scene.
While looking at at the scripting_con.s file I added comments (picking them from other documents) in the script to easier follow what the script was doing. This is the script with the comments, if by chance they could be of use for some one else, as well.
I noticed that the 3:de order will move on to the next order at the same time as the text of the reply is printed to the screen. Which means that the text will not be seen.
By changing the line "SoundConversation(0);" to "SoundConversation(5);" the text will be seen while it is printed out and disappear at the time it is fully printed out.
Code: Select all
{
CHARPROSEC [20]
Spawn[() //1
{
RestoreBackground(true);
Speak("OpeningsText", "");
SpeakShowTime(3000);
SoundConversation(CHARPROSEC); // 20
NewConversation("ShowSpeakAndOneSoundReply", true);//2
/*
RestoreBackground(bool Flag);
Defines whether the screen is cleared between a speak and a reply command or not.
If Flag is true only the speak window is visible, if Flag is false both speak and
the reply window are visible.
[OpeningsText]
The text you just saw "walking" was realized using the High level pawn command ShowText.
Please wait. This window will auto-complete in a few seconds by using the SpeakShowTime
command.
SpeakShowTime(3000) shows Speak-text for 3 seconds. The script than moves on to
ShowSpeakAndOneSoundReply
SoundConversation(CHARPROSEC); // 20
SoundConversation(int CharactersPerSecond);
SoundConversation(int CharactersPerSecond, bool ShowHud);
CharactersPerSecond is the time in milliseconds that defines the speed by which the speak
and reply text is displayed. 0 is used to immediately display the full text. If ShowHud is
present and true, display the HUD during the conversation.
*/
}]
ShowSpeakAndOneSoundReply[() //2
{
Speak("OnlyOneSoundReplyText", "");
SoundReply(1, "MenuText1", "");
SoundConversation(CHARPROSEC);
NewConversation("ShowOnlyASoundReply", true);//3
/*
[OnlyOneSoundReplyText]
Now we demonstrate the SoundReply command. First a speak-reply-session with only one
reply is shown. Notice that there will be no reply number to select. Use the space bar to
continue.
[MenuText1]
MenuOption 1
Speak is shown until spacebar is pressed. Reply-option is the shown in the speak window.
Press space bar to move on.
*/
}]
ShowOnlyASoundReply[ () //3
{
SoundReply(1, "OnlyAReply", "");
//SoundConversation(0);
SoundConversation(5);
NewConversation("ShowSoundReply", true);//4
/*
[OnlyAReply]
This text is shown using only a SoundReply command, not a speak command
The script moves on to new conversation as soon as the reply-text is shown.
No spacebar to be pushed.
Original script had "SoundConversation(0);" and the text just flashed by so fast it is not seen.
*/
}]
ShowSoundReply[()//4
{
Speak("SoundReplyText", "");
SoundReply(1, "MenuText1", "");
SoundReply(2, "MenuText2", "");
SoundReply(3, "MenuText3", "");
SoundConversation(CHARPROSEC);
NewConversation("MenuWithSingleFont", true);//5
/*
[SoundReplyText]
Now let's take a closer look at the SoundReply command. At the top, you can see the speak
window. The reply window is at the bottom. Select a reply option by pressing 1, 2 or 3.
When the selected reply is displayed press the space bar to continue.
[MenuText1]
MenuOption 1
[MenuText2]
MenuOption 2
[MenuText3]
MenuOption 3
*/
}]
MenuWithSingleFont[ ()//5
{
Speak("SingleFontText", "");
MenuReply(1, "MenuText1", "", 11, 11);
MenuReply(2, "MenuText2", "");
MenuReply(3, "MenuText3", "");
SoundConversation(CHARPROSEC);
NewConversation("MenuWithDifferentFonts", true);//6
/*
[SingleFontText]
Here the difference with a MenuReply command. In this example the
font color of the selected and the not-selected menu options are
choosen identical. Select a reply option by mouse (or number). Next
press the space bar to continue.
[MenuText1]
MenuOption 1
[MenuText2]
MenuOption 2
[MenuText3]
MenuOption 3
MenuReply(int Reply#, string ReplyMessage, string ReplySound,
int MenuFont, int ReplyFont);
MenuFont is the number of the font used to write the menu text on top
of the MenuBackground for this MenuOption.
ReplyFont is the number of the font used to write the menu text on top
of the ReplyMenuBarBitmap and MenuGIF-Picture as soon as the mouse is
over this MenuOption.
*/
}]
MenuWithDifferentFonts[ ()//6
{
Speak("DifferentFontsText","");
// SoundCustomReplyBackground("", 100, 300, 100, 300, 500, 500);
MenuReply(1,"MenuText1", "", 11, 10);
MenuReply(2,"MenuText2", "");
MenuReply(3,"MenuText3", "");
SoundConversation(CHARPROSEC);
NewConversation("MenuWithBitmap", true);//7
/*
[DifferentFontsText]
Now a MenuReply command with different font colors for the selected and
not-selected menu options. Press the space bar to continue.
[MenuText1]
MenuOption 1
[MenuText2]
MenuOption 2
[MenuText3]
MenuOption 3
*/
}]
MenuWithBitmap[()//7
{
SoundCustomReplyBackground("menubackground.bmp", 272, 200, 12, 12);
Speak("MenuWithBitmapText","");
MenuReply(1,"MenuText1", "", 11, 10, "menubar.bmp", "a_menubar.bmp");
MenuReply(2,"MenuText2", "");
MenuReply(3,"MenuText3", "");
SoundConversation(CHARPROSEC);
NewConversation("MenuWithBitmapAndGIF", true);//8
/*
SoundCustomSpeakBackground(string BackgroundBitmap, int ImageX, int ImageY, int SpeakX, int SpeakY);
[MenuWithBitmapText]
We can make our menus a bit more fancy using different colors and special
shapes. Select a reply option by mouse and press the space bar or left
mouse button.
MenuReply(int Reply#, string ReplyMessage, string ReplySound,
int MenuFont, int ReplyFont,
string ReplyMenuBarBitmap, string ReplyMenuBarAlphaBitmap);
ReplyMenuBarBitmap is the name of the image (BMP, JPG, TGA) that will be
drawn on top of the MenuBackground as soon as the mouse is over the this
MenuOption.
ReplyMenuBarAlphaBitmap is thename of the alpha map that will be used in
for the ReplyMenuBarBitmap. The alpha map is optional and can be defined
as an empty string ("") if no alpha is used.
*/
}]
MenuWithBitmapAndGIF[()//8
{
SoundCustomReplyBackground("menubackground.bmp", 272, 200, 32, 12);
Speak("MenuWithBitmapAndGIFText","");
MenuReply(1,"MenuText1", "", 11, 10, "menubar.bmp", "a_menubar.bmp", 1);
MenuReply(2,"MenuText2", "", 11, 10, "menubar.bmp", "a_menubar.bmp", 1);
MenuReply(3,"MenuText3", "", 11, 10, "menubar.bmp", "a_menubar.bmp", 1);
SoundConversation(CHARPROSEC);
NewConversation("MenuWithGIFonly", true);//9
/*
[MenuWithBitmapAndGIFText]
You may also add an animated GIF picture to it. Select a reply option by
mouse and press the space bar or left mouse button.
*/
}]
MenuWithGIFonly[()//9
{
SoundCustomReplyBackground("menubackground.bmp", 272, 200, 32, 12, 200, 100);
Speak("MenuWithGIFOnlyText","");
MenuReply(1,"MenuText1", "", 11, 11, "", "", 1, 8, 8);
MenuReply(2,"MenuText2", "", 11, 11, "", "", 1, 8, 8);
MenuReply(3,"MenuText3", "", 11, 11, "", "", 1, 8, 8);
SoundConversation(CHARPROSEC);
NewConversation("AttachText", true);//10
/*
SoundCustomSpeakBackground(string BackgroundBitmap, int ImageX, int ImageY, int SpeakX, int SpeakY, int SpeakWidth, int SpeakHeight);
[MenuWithGIFOnlyText]
If you prefer to use only GIF's, here is the way to do it. Select a reply
option by mouse and press the space bar or left mouse button.
MenuReply(int Reply#, string ReplyMessage, string ReplySound,
int MenuFont, int ReplyFont,
string ReplyMenuBarBitmap, string ReplyMenuBarAlphaBitmap,
int Gif#, int GifX, int GifY);
Gif# is the number of a pre-defined GIF file to be used for the MenuOption.
This number starts at 1 (not 0). The GIF file will be displayed and animate
while the Mouse is positioned over the area window belonging to this MenuOption.
Each GIF-file needs to be pre-defined in the Pawn.ini file in the [Conversation]
section. The definition of a GIF-file to be used for a MenuOption is optional.
The GIF file is always displayed on top of the MenuBarBitmap.
GifX, GifY define the X- and Y-position of the GIF relative to the top left
corner of the ReplyMenuBarBitmap.
*/
}]
AttachText[ ()//10
{
AttachSpeakToPawn("Nout", -20, -270, 250, 400, 10);
AttachReplyToPawn("Rob", 0, -150, 250, 400, 10);
Speak("WalkTextSpeak", "");
SoundReply(1, "WalkTextReply", "");
SoundConversation(CHARPROSEC);
NewConversation("SpeakOnly", true);//11
/*
AttachSpeakToPawn(string PawnName, int OffsetX, int OffsetY, int TextAreaWidth,
int TextAreaHeight, int Font);
Attaches the speak window and text to the pawn PawnName. If PawnName is "Player"
the speak window is attached to the player. By defining an empty speak background,
you can attach only the speak text message. If the pawn/player walks around, the
text will follow the pawn/player.
AttachReplyToPawn(string PawnName, int OffsetX, int OffsetY, int TextAreaWidth,
int TextAreaHeight, int Font);
Attaches the reply window and text to the pawn PawnName. If PawnName is "Player"
the reply window is attached to the player. By defining an empty reply background,
you can attach only the reply text message. If the pawn/player walks around, the
text will follow the pawn/player.
[WalkTextSpeak]
Yes, we can attach a conversation to a pawn! He, Rob, all OK?
Press space to continue.
[WalkTextReply]
Of course, <Player>, looks great! Press space to continue.
*/
}]
SpeakOnly[ ()//11
{
Speak("ShowTopMenu","");
SoundConversation(CHARPROSEC);
NewConversation("Spawn", false);//end
/*
[ShowTopMenu]
For the ShowPicture-demo, press space and move the mouse to the top of the game
window. Try out all buttons now and at any time later in the demo!
*/
}]
}