Community

SCI Programming => SCI Syntax Help => Topic started by: scott_furphies on September 19, 2020, 06:27:45 PM

Title: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: scott_furphies on September 19, 2020, 06:27:45 PM
Hi all,
this is my first post here, many times I've been about to ask for help I've had another last look and been able to figure it out for myself. Sci programming is wonderfully intuitive like that!

There's a few things on my Sci-wish-list I haven't been able to tackle, and I was hoping I could get a few nudges in the right direction!

1 - In certain rooms up and down arrow will result in diagonal movement. Codename: Iceman has this in one or two of the beach rooms at the beginning. it's subtle, but saves a lot of up-left-up-left movement to get through a narrow 45 degree angle path.

2 - Change colour of the title bar from grey to red. I've seen a lot of complicated stuff in fan games for customizing windows, I actually like the look of the windows as they are (Reminds me of Space Quest III) but the grey clashes with the look of the game I'm creating.

3 - This is probably a hard one, which I've basically given up on. Is there a way to ask questions to the parser? It would be cool if it switches to 'conversation mode' when you 'talk to' a character, and now you can say 'where is the lighthouse' instead of 'ask about lighthouse', which is more clunky and I think less intuitive for the player.

Thanks for any help I can get!

Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: cosmicr on September 19, 2020, 10:11:04 PM
Hi There, I have been studying Codename Iceman's code to work out a few tricks here and there.

1. It looks like it has a custom looper class called "Grooper" - this sets the appropriate view for the direction facing. In Main.sc there's a method that calls setloop on Ego that sets the loop to that class. In Feature.sc there's a method for setDirection in the Act class that will work out the angles and set the actor's motion to that direction. There's probably a little more to it, but you could get a general idea from examining the code.

2. As far as I know you can't change the title bar colour in SCI0. DrawStatus is a Kernel Function.

3. I would just change my Said parameters. Like you said, change it from "ask about" to "where is".  If you wanted to have two different modes of conversation, just keep a flag variable that switches between the two.

Good luck with your game!
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: scott_furphies on September 19, 2020, 11:31:58 PM
Thanks, Cosmic, I'll take a look at these - I'm definitely into the idea of more than the standard 4 walking loops! What I was actually thinking was having the up key result in a diagonal direction in certain rooms.

As for changing the 'Said parameters', do you mean when I'm writing out the actual if-said statements, or is there there a script which deals with the sentence syntax I need to look at?

Thanks again!
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: cosmicr on September 20, 2020, 04:42:55 AM
In the setDirection method of Act in Iceman the angle of walking is determined by the "vanishingX" and "vanishingY" values set. In beachHuts1.sc these are set to 0,-50 (ie toward the top-left of screen). This is how it forces the angular walking. It's quite sophisticated. Let me know if you have any luck with reverse-engineering it.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: scott_furphies on September 20, 2020, 05:16:40 AM
Cool, I'll have a look - still not sure how to read the script files of genuine Sierra games, is there another piece of software I'm missing?
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: Kawa on September 20, 2020, 06:41:58 AM
2. As far as I know you can't change the title bar colour in SCI0. DrawStatus is a Kernel Function.
But the status bar is white. Title bars would be the things on top of windows, and those are gray in SCI0.

Even though DrawStatus would only take color arguments in the VGA terps, and the window drawer would switch to black (can't guarantee #8 is dark gray any more), both of these things can be custom-drawn.

Cool, I'll have a look - still not sure how to read the script files of genuine Sierra games, is there another piece of software I'm missing?
A plain text editor?
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: cosmicr on September 20, 2020, 06:48:32 AM
But the status bar is white. Title bars would be the things on top of windows, and those are gray in SCI0.

Oops I had a brain fart there. Yeah you can change dialog window title colours. Brian's tutorial has a section on how to do it. In SCI0 you can't change the status bar.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: troflip on September 20, 2020, 04:23:24 PM
1 - In certain rooms up and down arrow will result in diagonal movement. Codename: Iceman has this in one or two of the beach rooms at the beginning. it's subtle, but saves a lot of up-left-up-left movement to get through a narrow 45 degree angle path.

In the Rm properties, assign values to vanishingX and vanishingY. They indicate where the vanishing point (https://en.wikipedia.org/wiki/Vanishing_point) of the room is. Pressing up will make the player walk towards the vanishing point, pressing down will make them walk away from it. (Assuming it's all hooked up properly in the SCI0 template - not sure it is because it was based off LSL3, which maybe didn't use this feature.)

Typical values might be
Code: [Select]
vanishingX 160 ; right in the middle
vanishingY -200 ; 200 pixels above the top of the screen

You could probably make the player walk at close to 45 degrees if you placed it way off to the side, like I dunno, (-1000, 1160) or something.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: Kawa on September 20, 2020, 05:16:21 PM
And of course a vanishingX 160 Y -30000, which is the default, is so ridiculously far away that walking up or down gives an effectively straight vertical line.

Fun fact: the SCI0 template has a default vanishingY of 35536, but this is just -30000 with too many (ignored) bits.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: cosmicr on September 20, 2020, 08:59:44 PM
Cool, I'll have a look - still not sure how to read the script files of genuine Sierra games, is there another piece of software I'm missing?

You can decompile them using SCI Companion from the script menu. The product is mostly readable code (some procedures and variables etc are unnamed).
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: scott_furphies on September 20, 2020, 09:06:01 PM
Awesome, so much good advice here! That vanishing point thing is surprisingly simple and cool - I had no idea the concept of a vanishing point would be used in those games!
Thanks, everyone for your help!
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: EricOakford on September 20, 2020, 09:30:45 PM
2. As far as I know you can't change the title bar colour in SCI0. DrawStatus is a Kernel Function.
But the status bar is white. Title bars would be the things on top of windows, and those are gray in SCI0.

Even though DrawStatus would only take color arguments in the VGA terps, and the window drawer would switch to black (can't guarantee #8 is dark gray any more), both of these things can be custom-drawn.

Cool, I'll have a look - still not sure how to read the script files of genuine Sierra games, is there another piece of software I'm missing?
A plain text editor?

I can verify that the ability for DrawStatus to take color arguments was added in 11/30/1990, per the Run-Time System Changes document. I tested this in my SCI01 template (which uses Seasoned Professional EGA's interpreter), and it works.

Now I know why the title bar color was changed from grey to black.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: MusicallyInspired on September 21, 2020, 09:14:46 AM
I once added an EGA SCI1.0 ego sprite to a SCI0 game and its diagonal loops were automatically used.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: Kawa on September 21, 2020, 09:47:56 AM
If an Actor is set in motion, the Motion class will first set the actor's heading, then either call the actor's looper (which may be a Grooper), or use the DirLoop kernel call, giving either of them the actor's heading.

DirLoop's logic, as seen in SCI11:
Code: [Select]
nLoops = GetNumLoops(ResLoad(RES_VIEW, IndexedProp(actor, actView)));

//Set the loop for the actor based on how many loops it has.
if (angle > 315 || angle < 45)
loop = (nLoops >= 4)? 3 : -1;
else if (angle > 135 && angle < 225)
loop = (nLoops >= 4)? 2 : -1;
else if ((angle < 180))
loop = 0;
else
loop = 1;

//If the loop is not 'same' (-1), set it.
if (loop != -1)
IndexedProp(actor, actLoop) = loop;

Testing this in The Dating Pool by removing the grooper from ego, my diagonals go unused. It is in fact the grooper that specifically adds diagonal support. And not all SCI0 had a grooper! Iceman, KQ1, and QFG2 are the only ones in whose decompiles I can find the line "class Grooper" -- the rest are all SCI10 or later. There could of course be other SCI0 games that supported diagonals but didn't gradually switch from one loop to the other.

I once added an EGA SCI1.0 ego sprite to a SCI0 game and its diagonal views were automatically used.
Was it one of those three? If not, which was it?
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: cosmicr on September 21, 2020, 05:25:48 PM
I think colonel's bequest might also - edit: it doesn't.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: MusicallyInspired on September 21, 2020, 09:26:19 PM
It definitely worked in KQ1SCI for sure. I don't remember. Worth experimenting again.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: gumby on September 23, 2020, 09:08:17 PM
As for changing the 'Said parameters', do you mean when I'm writing out the actual if-said statements, or is there there a script which deals with the sentence syntax I need to look at?

Yes, it involves writing new/additional 'if' statements with the Said() function. There are a lot of examples/posts here to assist with crafting them.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: MusicallyInspired on September 23, 2020, 09:31:59 PM
Just an update on my experiment, I tried using the ego view from SQ4EGA in KQ1SCI and SQ3. The diagonal loops were used in KQ1 but not SQ3. Just for confirmation.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: cosmicr on September 24, 2020, 12:01:41 AM
I tried using the ego view from SQ4EGA

Just out of interest how would one get a hold of SQ4 EGA? (I mean the EGA version, not the VGA one with EGA drivers).  It must be super rare? Googling for it only brings up GOG versions or information, not where to get a copy. I reckon I've bought SQ4 about 3 or 4 times over the years, but never knew about an EGA version until now.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: MusicallyInspired on September 24, 2020, 01:50:28 AM
It's...around. There are EGA versions for the following games:

-KQ5
-SQ1SCI
-SQ4
-LSL1SCI
-LSL5
-PQ3
-Mixed Up Fairy Tales
-Longbow
-Hoyle3
-DrBrain1
-Rise of the Dragon
-Willy Beamish
-Heart of China
-Jones in the Fast Lane

One was suspected to exist for Eco Quest 1 as well, but that quickly got an SCI1.1 floppy AND CD release after its SCI1.0 floppy release and so the confirmed included mailaway card for 16-colour disks in the box probably just got you the disks for the SCI1.1 version with the EGA640 dither driver.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: OmerMor on September 24, 2020, 03:04:09 AM
Just out of interest how would one get a hold of SQ4 EGA?

You can find all my EGA variants here (https://drive.google.com/drive/folders/0B5j-_ZMS8_UoUzAyVEg0NnZKUVE?usp=sharing).
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: cosmicr on September 24, 2020, 03:09:47 AM
Oh great thanks!
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: Kawa on September 24, 2020, 06:45:12 AM
It definitely worked in KQ1SCI for sure. I don't remember. Worth experimenting again.
I did list KQ1 has having a Grooper earlier, and its ego does use it. Graham just happens to have only four loops, so that makes it as drop-in as you remember.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: MusicallyInspired on September 24, 2020, 08:22:56 AM
Yep, you were right. Never doubted it.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: scott_furphies on September 25, 2020, 10:57:42 PM
I'm having fun rigging up my 'talking mode' thing.

Basically the user experience is, you type 'hello bob!', ego moves to a specific area and you get the message "Hi, bob!" over ego's head. Bob replies, and now the input bar (which previously says "Action:") says "Say:", the mouse cursor changes to a speech bubble, and you can no longer move the ego, just enter typed commands, phrased as questions. (eg: "Where is the shop?" "How are you feeling?" "How do I get the dog into the hanging basket?" etc)

This is all going pretty well, although I'm realising why Sierra generally didn't have a lot of dialogue in their SCI.0 games, these room scripts get big pretty fast! Probably I'll end up turning these conversations into modules so that the conversations can be totally different at later times in the game.

There's also a bunch of global variables so the game knows if you've seen, said, or learned something to open up more dialogue options, kind of like a dialogue tree.

basically it's all broken into 'where, how, when, what' sections, with some 'anyword/noun' ones for statements ("the dog is hungry"). This is all going fine, but the only one I have trouble with is "is" statements, eg "Is it hot in here", "Is Joey stupid" etc. The parser does not like sentences which start with "is" for some reason, no matter how much I meddle with the vocab resource. Any ideas why this could be?

Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: Kawa on September 26, 2020, 06:22:21 AM
The parser does not like sentences which start with "is" for some reason, no matter how much I meddle with the vocab resource. Any ideas why this could be?
Quick guess, the grammar resource doesn't have a case where "is" is the first word in a sentence.
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: gumby on September 26, 2020, 09:15:41 AM
'Is' seems to work okay for me right out-of-the-box. I tested a simple Said in a copy of the template game:

Code: [Select]
     (if (Said 'is/sierra') (Print {Yes, it is!}))

...and in-game 'is it sierra?' does cause that message to fire.  Could be how you constructed the Said logic, can you post it here?
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: Kawa on September 26, 2020, 10:13:34 AM
Is Sierra what? A shadow of its former self?
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: scott_furphies on September 26, 2020, 06:16:00 PM
I've been meddling with the vocab a bit...I'll try a few things.
Okay, if I have "is" set as an indicative verb, is seems to work for both "is sierra" and "who is sierra", i'm now noticing a problem with nouns:

"is shoe" works fine, but
"who is office" doesn't. I'm noticing a similar inconsistency with nouns I have entered for some reason

specifically what I want is to be able to ask:
"who is george"
but also
"is george a robot" and for some reason I can't get this to work!
"is sierra a shoe" doesn't seem to work either. Hmm, this task is causing me to detach from the English language in a weird way. I like it!
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: gumby on September 26, 2020, 09:28:23 PM
Here's what I got working for 'is sierra a shoe?'
Code: [Select]
    (if (Said 'is/shoe/sierra') (Print {Sure, a shoe}))

These examples might make things a little easier: http://sciwiki.sierrahelp.com//index.php?title=Said()_Strings_-_Comprehensive_Examples (http://sciwiki.sierrahelp.com//index.php?title=Said()_Strings_-_Comprehensive_Examples)
Title: Re: Sci.0 wish-list: diagonal movement, title-bar colour, and parser questions
Post by: scott_furphies on September 26, 2020, 09:43:06 PM
Hi Gumby, that article is a super useful reference. I've realised the solution is simple,
   (if(Said('is<who>'))
            (if(Said('*/ken'))
                                          Print(10 305 #title a #at q w)
))
easily for "who is ken". Thanks for your patience! I'm pretty new to this!

One more thing Gumby, nice work on SciAudio! Took me a while to get it to work, but it adds so much to the game! Very cool.