Dialogue positioning

Started by JHawks, Wed 30/05/2007 00:53:38

Previous topic - Next topic

JHawks

Hi there, new here.

I assume this should be a simple technical issue as it's just about repositioning the dialogue that appears in the game.

After my friends and I placed in dialogue and tested the game. The dialogue appears but it appears on top of the main character's head (Even when he is talking to another person).

I have created a message window for the game that appears at the bottom of the screen. I want to have that message window appear whenever any conversational dialogue appears and I also want the dialogue text to appear in the window.

My friends and I have searched the net and the tutorials, but they all just talk about how to get the text into the game and nothing about how to reposition it.

So can anyone please help us with this problem?

Any help will be greatly appreciated.

Regards
JHawks

Ghost

#1
Each and every dialog line you pass via a character.say command will be displayed over the speaking character's head, as is custom in adventure games. It makes it easy to say who speaks, for once.

If I get you right, you want to display text a character says somewhere else on the screen- in that case you could create a GUI (I wouldn't use a message window) and then add a label to it. Instead of using character.say you can then pass text by setting the label's text to it:

NameOfLabel.Text="Any text here";

This will work fine, but if you're going to use multiple choice dialogues, you'll need some pretty advanced scripting to pass the text in there to your GUI...

You could also try to select a Sierra-style speech in the General Settings and pass a blank view as a portrait... that would be easier, but is probably not what you have in mind.

DigitalDesignAUT


were getting closer to our beta release and were still having problems with the positioning of the dialogue text.

at present the dialogue is appearing above the characters head as i presume is normal. however we've created a message window at the bottom of the screen and this is where we want the text to appear. will post a screenie. any help is appreciated


JHawks

Oh I see. so you're saying that the whole "Text above the character's head" is like the default of the AGS system?

Hmm, I guess then it would be way easier to just leave it as it is? Because I wanted the dialogue to appear in windows like other Adventure/Role Playing Games like Final Fantasy.

But if that is hard work in terms of AGS, I guess we could live without it. We managed to make the Message Window appear with the text, but there were several problems.

1) The message window appears above the characters head, so we couldn't reposition it
2) The text didn't appear "in" the window, but instead on the top of the "image"
3) It only showed the image of the window where the text appears, so we couldn't resize it

But thank you for the reply, at least now we know what the problem is. But if anyone else have an answer to this or a way to solve it then by all means ^^

Candle

Code: ags
SayAt
(Formerly known as DisplaySpeechAt, which is now obsolete)

SayAt(int x, int y, int width, string message)

Similar to Say, except that the text is displayed with its top left corner at (X,Y), in an area WIDTH wide.
You can use this function to write the character's speech text anywhere you like, and AGS will still play the character's talking animation and so on if appropriate.

NOTE: This function does not support QFG4-style speech.

Example: 

character[EGO].SayAt(220, 20, 100, "My name is ego");

will display the message in the top right corner of the screen, whilst playing the character's talking animation.
See Also: Character.Say, Character.SayBackground



Ghost

I think it'd be best to stick to the default. First, AGS is meant to be an Adventure Game Maker. Final Fantasy is, at the core, a role playing game, and a japanese one too, so you'd end up with enforcing a standard that doesn't really apply to a) genre and b) any county instead of japanese ones. But it's up to you of course; Candle's workaround is a good thing but will still disable you to leave a lot of internal workings to the engine, especially if you start to use the (commonly used) dialogues with multiple choice answers.

Pumaman

There is not currently the facility to change where Say() prints its text. The current workaround is to use SayAt, as Candle suggests. Easier would be to create your own custom Say-type function that would put the text in the correct place.

DigitalDesignAUT

thanx a bunch candle and pumaman. will give this a try. if it doens't work i will post again.
till then cya

DigitalDesignAUT

ok still having problems... what style should i be using, lukas arts etc??? Imnew to the whole scripting side of this. should have posted in the basics section. apologies. in confused at the whole #sectionstart and what to put after it. should i be editing this in global or a special section... anything basic would help.. cherz.

Ashen

#9
Since strazer moved DDA's topic from Tech Questions, and the two are very similar: Topics merged.

DDAUT:
If you're using SayAt, you can use any speechstyle aprt from QFG4-style, as it says in the manual. 'Sierra style w/ Background' is probably best, as it'll let you use your message window - however, it might mess up the look slightly (e.g. changing width with different line lengths).
If you're making your own custom speech function, it doesn't matter what speech style you choose - you won't actually be using it anyway.
I know what you're thinking ... Don't think that.

Ghost

@DDAUT : You should go for the style you'd like to use- LucaArts will display text over the speaker's head, pretty much as if your game was an animated comic book with speech bubbles. Sierra style will use a view to display as an overlay, so you can easily add a portrait and have the text that's spoken next to it. You can have this overlay on your game screen or on a blank screen. It's a matter of your own taste.

The "sectionstart/end" lines are just markers that embrace a certain bit of code. For example, the game_start section contains everything you wish to happen before the game actually starts, like setting fonts, initialising variables and so on. Each project you start will have a couple of code blocks pre-made for you, and you just add to it or leave them empty. Other code blocks must be added by yourself, like "unhandled_event", a special code block that can process code if an action is performed but has no result.

If you're new to scripting, prowl the forum and please READ THE MANUAL. Many things are explained in there; there's even a tutorial. You can also get tutorials on-line, or download the demo game that has a lot of commonly used techniques with helpful comments. Scripting isn't as complicated as it's cracked up to be, but I admit that any newcomer will have to ask some questions.
Anyway, if you just need a breakdown of what "section" does what, and how to put code in there, start with the manual. A lot will be clear then. Anything else, just ask. Or PM (me)  ;)

DigitalDesignAUT

#11
ok its all good in saying use say.at but ive no idea where to type that. i mean theres about 60 different places. should i be in the gui script editor or character or dialogue or global. thats whats confusing me the most.


when i type  "character[ego]l" and press the "." button on keyboard i get a list of paramaters to add. what i don't understand is that there say.at parameters are blocked from usage. just has a big red "x" next to it. see image Note how the Room option is disabled???
his doesn't just happen in the global but in most other script editors. I'm using the most updated version of ags.




QuoteNameOfLabel.Text="Any text here";
having some difficulty with this option.
wont work.

I'm sorry if i seem angry. i know javascript and asp (server side script) backwards but this seems to be breaking me and ive only got 3 weeks until ive got to hand in the gold version for our steamshift game... plus i hadn't really thought about the scripting side to it until the my first post here. good old students leaving everyting to the last moment.
p.s. turns out JHawks is in my class and was trying to figure the same thing out as me, so was good that the two topics were merged.

EDIT:
what do you know. 2 minutes after posting my last post i managed to get it. went to character interaction menu and created a script attribute where i used the character[ego] say at option. however there are a few new issues i have. how do i change the z order of the text so that it comes above the gui , the gui's z order is currently set to (0).

I'm using the
Quotecharacter[EGO].SayAt(20,250,100,"hello"); 
option but ive no idea how i could replace the "hello" to a pre-made dialog from the dialog section. hope that came out right.

how would i go about creating a custom function that puts the Say.At in the correct place every time as pumaman suggested?

Khris

1. Where a piece of codes goes really depends on just one thing: WHEN do you want the code to be called?

Example: The character is looking at something and gives a description. Say it's a hotspot. Go to the room, select Hotspots in the Room editor -> Areas pane, click the Interaction button and add a RunScript action to "Look at hotspot". Click the Edit script button and enter the command in the script window.
(The command will end up in a new function in the room script.)

Another example: Talking to an NPC. Go to the Characters pane, select the (NP)character, click the Interaction button and add a RunScript action to "Talk to character". Click the Edit script button and enter the command in the script window.
(The command will end up in a new function in the global script.)

2. It's supposed to be "character[EGO]", or better yet, "cEgo".
2a. There's no red x next to SayAt, just look at the pic you've posted...
2b. The red x indicates that the property is read-only. "Room" holds the current room of the character, and since it isn't meant to be changed directly but by using "Character.ChangeRoom", this makes perfect sense.

3. Changing a label's text has to be done inside a function. Note that the auto-complete window will show a list of known instances as soon as you've typed the first three letters.
Also note that it can be misleading that the manual uses the "lbl" prefix in its examples.
You don't need that when referring to the label's scriptname. Just use the exact same name you've written in the scriptname field in the GUI editor.

4. Unfortunately, spoken text will always be display behind GUIs.
As a workaround, you could RawDrawImage(Transparent) the text window onto the background. Choose "Script -> on_event" from the menu, then add code so the function looks like this:
Code: ags
#sectionstart on_event  // DO NOT EDIT OR REMOVE THIS LINE
function on_event(EventType event, int data) {
    if (event==eEventEnterRoomBeforeFadein && player.Room!=number of menu screen) {
      RawDrawImageTransparent(0, y, sprite slot of message win bg);
      RawDrawImage(0, y, sprite slot of message win border);
    }
}
#sectionend on_event  // DO NOT EDIT OR REMOVE THIS LINE

This will put the window on every room's bg upon entering, so you might wanna intercept menu screens and the like.

Another workaround was to use labels as suggested.
You'd have to use a custom function, so I'll show how this is done using the SayAt example:
Code: ags
// in the global script
function MySayAt(Character*c, String s) {
  c.SayAt(20, 250, 100, s);
}

// in the script header
import function MySayAt(Character*c, String s);


5. It's not possible to make AGS's built-in dialog system use the SayAt command.

DigitalDesignAUT

just realised a huge flaw in this. ive no way of determining what room im in. i want to say different things in each room. im thinking i need an if statement but ive no idea how to do it.

Khris

It's right there in 2b or my first code snippet.
Character.Room returns the room the character is in, so the current room is stored in player.Room.

Did you read my post at all? ::)

DigitalDesignAUT

ahh so it is, must have overlooked it. will test it now

many thanx KhrisMUC ;D

SMF spam blocked by CleanTalk