Community

SCI Programming => SCI Syntax Help => Topic started by: MusicallyInspired on August 05, 2017, 06:23:56 PM

Title: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 05, 2017, 06:23:56 PM
I know this is a big question, but I'm trying to basically replicate a Myst-like experience with the following functionality:


Not initializing Ego is easy enough. I also checked out in the documentation on how to create instance objects of background elements out of Polygons, which I'm planning to use for the look left/right/up/etc hotspots on each PICTURE (I was going to use CONTROL colours initially, but this way seems more elegant). My first question is how do I....er....handle pEvents so I can determine what a mouseclick does on certain polygons? I obviously don't want them to display text so verbs are out of the question, I just need some kind of functionality to test for the player input and change rooms/manipulate objects as necessary for each scene. I could have done this easily enough in SCI0 but SCI1.1 seems so much more complex and I can't quite convert the Studio Script code to Sierra Script. Any help is welcome.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 05, 2017, 07:31:02 PM
I don't know about the rest of it but you know Companion can convert from one dialect to the other for you, right?
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 05, 2017, 08:06:26 PM
Yes, I do. My main problem is figuring out how to work with evMOUSBUTTON pEvents and how to make that work in conjunction with checking for Poylgons (if that's the best way to handle it...maybe it's not). SCI1.1's complexity is overwhelming me.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: gumby on August 05, 2017, 08:48:44 PM
For the mouse-click event stuff, this might help: http://sciprogramming.com/tutorial.php?entry=9376
 
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 05, 2017, 09:15:36 PM
Ah that will indeed be very handy thank you! I must have missed this. Or forgot about it. Hopefully I can transcribe the NSEW functionality to multiple polygon shapes on each screen.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: lskovlun on August 05, 2017, 10:24:50 PM
It sounds like getting rid of the verb formalism just to get rid of text and multiple cursors is over-complicating things. SCI32 uses verbs for everything, and there is no text in many of those games (and just one cursor). The short form of AvoidPath (http://scicompanion.com/Documentation/Kernels/AvoidPath.html) might be useful though.
EDIT: fix link
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 06, 2017, 09:48:12 AM
Perhaps I'm not being clear. I don't want to strip the functionality out of the verb scripts per se or actual Print box code, I just don't want multiple icons accessible (or the impression of it) and I just won't display any text ever.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 06, 2017, 11:40:26 AM
Icon selection and the notion of a current icon/verb are all part of the IconBar, so if you remove it and all references to it...

Specifically, the advanceCurIcon method and curIcon property of IconBar, I guess? You can right-click anywhere to cycle because User::handleEvent hands over to IconBar::handleEvent if gIconBar is non-null, but yeah.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 06, 2017, 11:10:10 PM
That's why I was just thinking of simplifying the process and handling evMOUSEBUTTON events manually when hovering over certain polygons. I don't need all those verbs. I just need "when mouse hovers here, change cursor VIEW and do a thing when clicks."
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Doan Sephim on August 08, 2017, 11:10:35 PM
I use a bit of that kind of coding in Betrayed Alliance, particularly the door puzzle, the evil ghost puzzle, and the rotating tower. My code probably isn't optimized, but it could be of use. The source code is included in the download
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: troflip on August 09, 2017, 03:23:37 PM
That's why I was just thinking of simplifying the process and handling evMOUSEBUTTON events manually when hovering over certain polygons. I don't need all those verbs. I just need "when mouse hovers here, change cursor VIEW and do a thing when clicks."

I think all the interaction functionality you need is already there. Features have a setOnMeCheck to which you can provide a polygon:

http://scicompanion.com/Documentation/Classes/Feature.html?highlight=setonmecheck

(or you can provide nsRight/nsLeft, etc..., or control colors, or whatever)

Then just pick a particular verb to leverage, and put your code in the feature's doVerb responding to that verb.
Or make a new method called onClick or something, and change the code that calls doVerb to call that instead.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 09, 2017, 04:47:06 PM
Thanks, guys.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 14, 2017, 09:48:54 PM
Is there a function built into Feature to be able to change the cursor to another certain VIEW ONLY when hovering over a priority/control colour or polygon? I'm looking but it's not obvious to me if it's there. Or will I just have to handle the room's doit method manually for something like that?

EDIT: Another question. I'm successfully moving around from room to room (or should I say step to step and perspective to perspective) with interacting with polygons as verbs. However, I'm trying to figure out how to simply interact with explicitly nothing. That is, when I'm not clicking on any polygons it performs a certain action which doesn't take place if I'm not hovering over a polygon. Or would I be better off using control colours for this instead of polygons?
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 15, 2017, 11:31:44 AM
If nothing more specific (Features et al) respond positively to an event, have the room respond?
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: lskovlun on August 15, 2017, 11:41:05 AM
If nothing more specific (Features et al) respond positively to an event, have the room respond?
Or the DoVerbCode (which provides default responses in the standard verb framework). But a) this would affect all rooms (you could check the current room variable however...) and b) it doesn't work if you don't use features/views/props...
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 15, 2017, 02:37:11 PM
You can have a handleEvent in your room. Add it to gMouseHandler and gKeyHandler on init, remove it again on dispose. The template game's title screen does this so it can respond to clicks, though my copy calls them gOldMH/gOldKH... doesn't make a difference.

Importantly, the title screen room adds itself to the front of the list. If you want things in the room to respond first, you might rather use addToEnd.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 15, 2017, 04:35:33 PM
Like the actual DoVerbCode of Feature itself not an override from an object based on Feature? This could work as I'd have basically the same actions across every room. I'll probably replace polygons with colours in this case because that's easier to check for rather than polygons which are specific to each room, yes? This would also solve my "click on nothing" problem.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 15, 2017, 07:29:12 PM
I was under the impression that polygons and control colors were both room-specific. In fact, wouldn't control colors be more room-specific, in a way?
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 16, 2017, 08:17:05 AM
If I put code in a public method to watch for certain control colours it shouldn't matter, should it?
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 16, 2017, 01:53:18 PM
Having a few colors be common across the whole game? Sure, that shouldn't matter.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 16, 2017, 01:54:38 PM
I mean, there are only 16 colours. I used region scripts which are spread across multiple rooms for handling changing Graham's VIEW as he wades in and out of the water in KQ2SCI.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 16, 2017, 04:10:38 PM
To be fair, AGI made do with worse.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 16, 2017, 04:16:56 PM
I guess what I'm getting at is I don't understand how control colours would be "more room-specific."
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 16, 2017, 07:41:37 PM
You usually have one picture per room, right? And it's the pictures that determine which control colors go where, right?
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: lskovlun on August 16, 2017, 11:22:12 PM
Like the actual DoVerbCode of Feature itself not an override from an object based on Feature? This could work as I'd have basically the same actions across every room. I'll probably replace polygons with colours in this case because that's easier to check for rather than polygons which are specific to each room, yes? This would also solve my "click on nothing" problem.
There should be a global variable - the version of the template game I'm looking at calls it gDoVerbCode - that you can set to point to an instance of Code (so it's a little different from the usual doVerb handling). It gets called if a) you remember to call the superclass in the doVerbs that you do have and b) there is no message associated with the feature's noun/verb/case. Sierra usually set it somewhere in the game initialization, but I bet you could change it around if you wanted to.

Another interesting tidbit that I found is the concept of "actions", notably used in Conquests of the Longbow. If the actions property is set to an instance, then its doVerb method completely overrides that of the feature - so you could have day1Actions, day2Actions, etc. - or in the case of reused actor instances, select which set of responses the user would get.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 17, 2017, 12:46:03 AM
Ohhh neat.

You usually have one picture per room, right? And it's the pictures that determine which control colors go where, right?

Well yeah, but that's for the colour data itself. I'm just talking about referencing it; triggering certain actions based on its existence. I don't need the same exact colours/polygons on every screen. In fact I don't want that.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 17, 2017, 07:49:24 AM
I didn't say you'd have the same colors/polys on every screen.

I meant like, just an example, if you can click somewhere to go in a cardinal direction (considering the north/east/south/west properties on rooms), you'd have the dark blue, green, cyan, and red colors mean "go in that direction". Depending on the visual size and shape of the room, a given direction might need to be closer to the center or whathaveyou, or not be an option at all. Or perhaps there's a default response to clicking on the sky, if and where it's visible, that's the same throughout the game?

It's like having a general "in water" color in a regular game with a visible Ego walking around -- not all rooms have water in them, and those that do don't have the water in the same places.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 17, 2017, 11:00:37 AM
Yeah, that's exactly what I said above with my water-wading Region script in KQ2SCI. I think we're on the same page....I still don't understand why you brought up control colours being room specific though. The colours themselves, yes. I'd just draw them on every picture. But the code can be handled globally.
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: Kawa on August 17, 2017, 12:57:39 PM
The code can be handled both globally and locally. Anything not caught locally bubbles up to global. "Well, I guess I have a bit too many distinct clickable areas here, but there's only one exit so let's just use one of the exit colors as a puzzle button input."

(Which is a silly example as my game has Features that share a single color, but are on opposite sides of the screen.)
Title: Re: Interface overhaul/stripdown (like Myst)
Post by: MusicallyInspired on August 17, 2017, 01:27:29 PM
The code I'm talking about being global wouldn't handle the actual room changing. Just changing the cursor VIEW when hovering over certain colours (for turning around, grabbing something, looking up/down, etc).