Community
SCI Programming => SCI Syntax Help => Topic started by: MusicallyInspired on April 28, 2019, 04:06:33 PM
-
Okaaaaaayyy! So this is a headache. I want a talking dialogue portrait for my Ego but it doesn't look like Template game is set up for it. I'm trying to create its instance in Main.sc. Is that the right way to go about it seeing as it needs to be available from everywhere? Or should I make it its own Script? What I was attempting to do besides just having a general Ego Talker is to have it also appear and animate when the player opens the Quit dialog and saying a line, which I'm sure is a can of worms unto itself because it needs to stay on the screen to press the Yes or No buttons.
-
For the first part of your post, the template game not being set up for an Ego talker, that part's easy. By default, it's set up to only have a Narrator.
Talkers generally each get their own scripts simply so they're only loaded while they're actually talking. In Main, findTalker merely links talker numbers to objects, usually via ScriptID commands except for 99, which is the Narrator:
(switch talkerNumber
(NARRATOR gNarrator)
; Add more cases here for different narrators
; (8 (ScriptID 109 7)) ;cadetsTalker in SQ5's starCon.sc
)99 being the Narrator and 1 being Ego is just tradition, just like how they all get their own scripts. You might notice that the template's narrator is in Main, by the way.
I don't know about having an active Talker in a button-filled Print though...
-
What I was attempting to do besides just having a general Ego Talker is to have it also appear and animate when the player opens the Quit dialog and saying a line, which I'm sure is a can of worms unto itself because it needs to stay on the screen to press the Yes or No buttons.
For this part you need to look at the class DCIcon, or rather at games that use it. It is an animating version of DIcon, which is the ordinary, static thing available in Print. Unless you somehow need a full Talker (Sierra didn't do that).
-
And here, a bit from Pepper, which has this in its about screen (death handlers are usually in asm, but this is not a death handler):
(if
(not
(Print
width: 230
x: 30
addText: 1 0 2 4 0 0 884
addText: 1 0 2 5 0 13 884
addText: 1 0 2 6 0 26 884
addIcon: (artIcon view: temp302 cel: 0 loop: 0 yourself:) 0 0 20 40
init:
)
)
(self dispose:)
(return)
)
and artIcon is defined as:
(instance artIcon of DCIcon
(properties
cycleSpeed 15
)
)
You can have an init method on DCIcons instead if you prefer - it does get called, and several games do that. You can also set their view/loop/cel properties directly.
In that case the addIcon call is simply:
addIcon: artIcon 0 0 20 40
or whatever.
-
Say the game is fully voiced. How best would it be to go about having an animated dialogue portrait speaking in lip sync? Space Quest 4 CD did this now that I think of it. With Restart too.
Actually, I could just check out SQ4's source now that I've thought of it.
-
SQ4's Two Guys:
(instance babbleIcon of DCIcon
(properties)
(method (init)
(super init: &rest)
(if (== gOldMsgType 2)
((= cycler (MouthSync new:))
init: self 0 99 0 global201 1
)
(DoAudio 2 0 99 0 global201 1)
else
((= cycler RandCycle) init: self 20)
)
)
)
-
Ok, couple more questions. I'm putting the talker for quit/restart dialogues on the back burner and I'm just trying to figure out how to Print some text on the screen with Narrator. I'm designing the introduction sequence.
1) How do you use a Talker with recorded speech audio in a Print command rather than as a VERB or whatever from clicking an interaction on something? As in, in an environment where each state is cued and narrator boxes triggered.
2) How do you Print this message box on the screen and still allow animation to continue? In SCI0 this used to be done by invoking "dispose" right? That doesn't seem to work this time.
This is what I've got in my changeState right now.
(Print
font: gFont
addText: 0 0 0 1
posn: 67 16
init:
dispose:
)
-
2) How do you Print this message box on the screen and still allow animation to continue? In SCI0 this used to be done by invoking "dispose" right? That doesn't seem to work this time.
Try the modeless property (set it to true). After doing so, you'll need to dispose the dialog manually, then reset the modeless property. Now, a number of games do this by setting the modeless property of each narrator... but even the standard Print should work in this manner...
-
That worked. I'm trying to figure out how to remove the Print box now though. I don't know how to reset the modeless property. (Print modeless: TRUE) does nothing. Also, the "ticks" property doesn't seem to do anything. I thought it'd keep the Print box up for a number of cycles or something.
-
That worked. I'm trying to figure out how to remove the Print box now though. I don't know how to reset the modeless property. (Print modeless: TRUE) does nothing. Also, the "ticks" property doesn't seem to do anything. I thought it'd keep the Print box up for a number of cycles or something.
The open dialog is stored away in the gDialog variable and you can call its dispose method to get rid of it. I'm not sure why the ticks property doesn't do anything, but you can always handle that in your own script.
EDIT: Oh, and the default value of the modeless property is FALSE, so that's what you reset it to when you're done.
-
Got it to work. However, it won't trigger speech associated with the message being Printed.
I wonder, would gMessager be better suited to use for this? The only problem I have found so far is that there doesn't seem to be a way to set the message window position. It's always in the middle of the screen. And I can't enable modeless to allow animation to continue while the message is displayed/speaking.
EDIT: Also, ticks does work. I had thought that a tick was a cycle. But apparently it's a full second. I had it up to like 20 ticks lol. So I never waited long enough to see it close the window on its own. So that works.
-
If you want speech in a Print, DoAudio right before you show it. Larry 6 does that (https://helmet.kafuka.org/logopending/2019/04/16/observations-on-larry-6s-death-handler/) in its death handler.
-
Right before as in one state before? Or one line before in the same state?
-
One line before, in the same state. Notice in the Larry 6 death handler that it's a procedure, not a changeState method.
-
Ok. That page didn't show the code line where DoAudio was. It just mentioned it in the following paragraph so just wanted to be sure. I also notice in the documentation that you can get the tick length of a speech line with DoAudio as well, so that'll be great for setting the tick length of the Print window too.
However, I did a quick test this morning before I went in to work and it didn't seem to trigger the sound. I'll have to do more tests later.
Also, can "ticked Print windows" cue the state? Seems like every time and everywhere I try to add "self" it just crashes the game.
-
Ok, bit more testing. I got the audio line to play, but my code for determining the tick-length seems flawed. Or DoAudio's audWPLAY function doesn't work how I expected. I passed audWPLAY's result into a local variable which I throw into the Print statements "ticks" value. But throwing a DebugPrint on that value reads the length as 414, which seems way too long as the Print statement's "ticks" value expects the length in seconds. It doesn't seem right for a cycle value either when I pass that value into the state's cycle length the window disappears too soon before the text is done. What exactly is this value that is being returned? Docs says it's ticks. You'd think "ticks" would mean the same thing as Print's "ticks" but it clearly doesn't...or I'm screwing up somehow.
-
But throwing a DebugPrint on that value reads the length as 414, which seems way too long as the Print statement's "ticks" value expects the length in seconds. It doesn't seem right for a cycle value either
Narrator::startText sets ticks to 240 or the length of the string times twice textSpeed, whichever's larger, which Brian K. Hughes comments is "at least 4 seconds". startAudio sets it to whatever DoAudio returned. In either case, another 60 units are added.
Ticks are a 60th of a second.
Edit:
The term jiffy was used on the Commodore 64 and the Vic 20 to stand for 1/60th of a second (although Wikipedia claims it was either 59.94 Hz or 50 Hz). Tick has been used for the same purpose (basic unit of time) on other computers.
From https://english.stackexchange.com/questions/51860/is-there-a-word-for-a-60th-of-a-second (https://english.stackexchange.com/questions/51860/is-there-a-word-for-a-60th-of-a-second)
-
That's what I figured. So in other words a cycle, yes? But in either case it's the incorrect length for what Print "ticks" is looking for, strangely.
Dividing the result of "DoAudio audWPLAY" (which is said in the docs to return "the length of the sample in ticks") by "50" (not 60, for 1/60th of a second) seems to produce the perfect length needed for each line so far.
-
That's what I figured. So in other words a cycle, yes? But in either case it's the incorrect length for what Print "ticks" is looking for, strangely.
The ticks value is copied into a Dialog property called simply time and from there into a seconds property. So I think this is a simple mistake. It is more common to use the talkers/narrators for this kind of thing anyway.
-
But I haven't been able to figure out how to arbitrarily set Narrator text box positions/dimensions or allow animation to continue while the message box times out on its own in the background, ignoring user input. If I can do that that would make this all much simpler.
EDIT: So the "width:" method doesn't seem to do anything to Print. Is there something else I'm supposed to set for it to observe that? Just setting width to something just doesn't work.
-
Ok, a different question then. Is there any way to include an icon/view inside a gMessager window? There are 3 lines of dialog that I want to display icons inside, but I can't do it in with the previous method because the Print window ends up being too wide (the view isn't that big, I think it's just the text forcing the width) and so part of it gets overlapped by the dialog portrait.
I suppose I could just draw the view on the screen outside of the message window but if I can get it inside that'd be awesome. But seeing as it displays its content from the Message resource, I'm guessing no.
-
As it happens, Talker::viewInPrint is a thing that should place the talking animated head inside the window.
I myself couldn't get it to work when I tried but I was a dumb noob back then who ended up hacking together those speech bubbles so what do I know?
-
Interesting prospect. Not sure if it'll help me here, but at least we could have KQ5 Floppy style dialog boxes if we wanted.
I ended up just drawing the Views outside of the text box which works fine.