I hope this will help you. You cannot use Shift on it own, but that should not be a problem. Use can use any other key or a Ctrl-key sequence. I would steer away from Fn buttons and be careful of some Ctrl sequences. I had eq. a reboot when I used F6.
Here is a somewhat verbose explanation in a tutor format:
INTERCEPTING KEYBOARD AND MOUSE EVENTS
For this demonstration, Ego will change into Brian if the player presses B (capital) and back to Ego when E (capital) is pressed.
Add Brian as a view as described in the Tutorial Chapter 19 (Resource->Add Sample->View->Brian and save it as view number 1.
In the instance of RoomScript add the following code:
(instance RoomScript of Script
(properties)
(method (handleEvent pEvent)
(var str) //Local variable
(super:handleEvent(pEvent))
.
.
(switch( (send pEvent:type) )
(case evKEYBOARD
(if(== (send pEvent:message) KEY_B ) //Check if B was pressed
(send gEgo:view(1)) //switch to Brian
(send pEvent:claimed(TRUE))
)//if B
(if(== (send pEvent:message) KEY_E ) //Check if B was pressed
(send gEgo:view(0)) //switch to Ego
(send pEvent:claimed(TRUE))
)//if
)//evKEYBOARD
//For fun intercept the Mouse event as well
(case evMOUSEBUTTON
(Print("You pressed a Mouse Button!"))
)//evMOUSEBUTTON
)//switch
)//method
)//instance
The code: send pEvent:claimed(TRUE)): specified whether the event object can be used; in this case the :Said: command will ignore the event when the player presses either a B or E.
Compile and test. Ego will be transformed into Brian if you press a B and back to Ego if you press an E. If it does not work, the values may not be declared in the Keys.sh file. Open the file (..\SciStudio\include\Keys.sh) to view the defined values. You may want to expand the list with the lower case values (a=$61,..z=7a). If you want to trap other values, you can view the value of the key code by adding the following code just below the :case evKEYBOARD: statement:
=str ""
(Format(str "str=%x" (send pEvent:message)))
(Print(str))
Test by pressing Ctrl-k. The value should be $0b. You can add the value in the Keys.sh file or using it directly in the statement (if(== (send pEvent:message) $0b) ext