Advanced Use of Control Areas: Difference between revisions
sierraw>Andrew Branscom Created page with "=Chapter 8 - Advanced use of control areas= The main set of SCI tutorials shows that the way to check if the ego is on a particular control area is the following: <blockquot..." |
m 6 revisions imported |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Chapter 8 - Advanced use of control areas= | [[Category:SCI Pages]] | ||
= Chapter 8 - Advanced use of control areas = | |||
The main set of SCI tutorials shows that the way to check if the ego is on a particular control area is the following: | The main set of SCI tutorials shows that the way to check if the ego is on a particular control area is the following: | ||
Line 75: | Line 76: | ||
Basically, just remember it is a bit-mask, so the '&' and '|' operators are your friends. | Basically, just remember it is a bit-mask, so the '&' and '|' operators are your friends. | ||
==<br /> References == | |||
< | <references /> | ||
==<br /> Related Links == | |||
* | |||
<div> </div> | |||
<span style="float: left">[[SCI Memory Management|< Previous: Chapter 7 - SCI Memory Management (advanced)]]</span><span style="float: right">[[SCI_Point_and_Click_Tutorial|Next: Cloudee1's SCI Point and Click Tutorial >]]</span> | |||
| | ||
[[Category:Technical Info]] | |||
[[Category:Control Areas]] | [[Category:Control Areas]] | ||
[[Category:Tutorials]] | [[Category:Tutorials]] | ||
[[Category:SCI Tutorials]] |
Latest revision as of 09:03, 16 February 2025
Chapter 8 - Advanced use of control areas
The main set of SCI tutorials shows that the way to check if the ego is on a particular control area is the following:
Code:(instance RoomScript of Script (properties) (method (doit) (if(== (send gEgo:onControl()) ctlGREEN) (send gRoom:newRoom(1)) ) ) )
If the ego is on GREEN, then he is sent to a new room.
That's only part of the story. The value returned by onControl() is actually a bit mask, which can contain any combination of the following values:
These are defined in sci.sh:
Code:(define ctlBLACK $0001) (define ctlNAVY $0002) (define ctlGREEN $0004) (define ctlTEAL $0008) (define ctlMAROON $0010) (define ctlPURPLE $0020) (define ctlBROWN $0040) (define ctlSILVER $0080) (define ctlGREY $0100) (define ctlBLUE $0200) (define ctlLIME $0400) (define ctlCYAN $0800) (define ctlRED $1000) (define ctlFUCHSIA $2000) (define ctlYELLOW $4000) (define ctlWHITE $8000)
This makes sense, because the 'footprint' of the ego (or any Act class) is actually a two-dimensional area, not a single point. Therefore, he may be on several colors at once.
To detect if the ego is completely on one color do the following:
Code:(if (== (send gEgo:onControl()) ctlGREEN) // Ego is completely on green (no part of his footprint hits black, even). )
To detect if some part of the ego's footprint is touching a particular color:
Code:(if (& (send gEgo:onControl()) ctlGREEN) // Part of ego is touching green. )
To detect if the ego is touching one or more of ctlGREEN and ctlCYAN, do the following:
Code:(if (& (send gEgo:onControl()) (| ctlGREEN ctlCYAN)) // Ego is touching green or cyan. )
To detect if the ego is touching both ctlGREEN and ctlCYAN exclusively, do the following:
Code:(if (& (send gEgo:onControl()) (| ctlGREEN ctlCYAN)) // Ego is touching green or cyan. )Basically, just remember it is a bit-mask, so the '&' and '|' operators are your friends.
References
Related Links
< Previous: Chapter 7 - SCI Memory Management (advanced)Next: Cloudee1's SCI Point and Click Tutorial >