Point'n'Click in SCI ega

Shish Hi all!!!
See subject...
Robin made it in AGI, maybe someone
could make it in SCI??? Please, if someone
can then post a demo??? I think that p'n'c
is better than typing.
Lars Skovlund If you're looking for true point&click interfaces, you're probably better off waiting for
SCI Studio VGA. On the other hand, I have implemented a piece of code which enables
the kind of 'right click to look at stuff' functionality late SCI0 games had.
If you want me to post it, let me know.
AGI1122 I would actually like to see this. :)
Brian_Provinciano Great work Lars! I'm sure lots of people would like to see how you implemented that.

As for SCI Studio VGA template, I've only got one script of the class system left to do, and about ten or so little scripts of procedures to recode. The proc scripts are pretty small though, so I will probably finish the last class script in the same time it will take to finish them.

Once then VGA template is done, it won't be too hard to port it's entire, authentic interface to SCI0, as it's 100% coded in the scripts, and 0% part of the interpreter!

The right click to look thing will be great for everyone's SCI0 games. Quest for Glory 2 used it along with the text input, and it didn't interfere. It left the games as golden as the originals, with a nice addition to make looking at objects easier.
Lars Skovlund This is the base code. Put it in its own source file.


(include "sci.sh")

(use "feature")
(use "obj")
(use "main")
(use "user")

(script 900)

(class LookAtView of View
(properties
parseName 0
)
)

(class LookAtProp of Prop
(properties
parseName 0
)
)

(class LookAtAct of Act
(properties
parseName 0
)
)

(instance onMeCode of Code
(properties)
(method (doit view event)
(var theX, theY, result)
= theX (send event:x())
= theY (send event:y())
= result (>= theX (send view:nsLeft()))
= result (& result (< theX (send view:nsRight())))
= result (& result (>= theY (send view:nsTop())))
= result (& result (< theY (send view:nsBottom())))
(return result)
)
)

(class MouseDownHandler of Script
(properties
defaultVerb 0
modifiers 0
)

(method (handleEvent event)
(var view, parsestr[50])

(if ((== (send event:type()) evMOUSEBUTTON) and
(& (send event:modifiers()) modifiers))
= view (send gCast:firstTrue(#perform onMeCode event))

(if (view and (send view:respondsTo(#parseName)))
(Format(@parsestr "%s %s" defaultVerb
(send view:parseName())))
(Parse(@parsestr event))
(send event:type(evSAID) claimed(FALSE))
(User:said(event))
(return TRUE)
)
(return FALSE)
)
(return FALSE)
)
)


To use it, make an instance of MouseDownHandler, and set its properties as you desire. defaultVerb should contain the text that the mouse button is to emulate, e.g. "look". modifiers should be set to 3 for the right button (emRIGHT_BUTTON) or 4 for the middle button (there is no constant for this, unfortunately). Make sure that the handleEvent method of your instance is called in the global handleEvent (the one in the Template instance). Finally, change all your View/Prop/Act instances to LookAtView etc. and set their parseName appropriately. Note that the handler is backwards compatible, so it can cope with views that don't have a parseName selector (i.e. instances of View etc.).

This approach depends on your own code to perform any actions - variations could easily be made that store the descriptions along wth the views. There are pros and cons to each, but this one requires minimal additional work and is compatible with the Said scheme described in Brian's tutorials.

Lars
Omer Mor Brian - This "look" feature was also present in QFG1 ...
Brian_Provinciano I though so, but I wasn't positive, so I only mentioned QFG2 :)

Do you know of any other SCI EGA games with it?
CapTAmerik@ Colonel's Bequest had the right mouse click-feature, although it didn't appear to work on all objects. Guess the programmers were so into the story, that they forget to put descriptions with all their views/objects.

Regards,
CaptAmerik@
Omer Mor These are the SCI0 games that support right-mouse "look":
Codename: Iceman
Conquest of Camelot
Quest for Glory 1
Conlonel's Bequest

I hope I didn't miss anything.