Community
SCI Programming => SCI Syntax Help => Topic started by: robbo007 on June 30, 2025, 07:27:51 AM
-
Hi guys,
Do the PolyPath and PChase scripts work with SCI0 and the SCICompanion default template? I can't seem to get them compiled correctly. Do I need to include them inside another script?
I've create the PChase Script as rm967 and PolyPath as rm968. Both are defined in my game.sh. PolyPath has a compile error:
[Error]: Expected an expression. (51, 22): "obstacles?"
And PChase gets the following:
[Error]: Unknown class 'PolyPath' . Line: 33, col: 6
[Error]: Unknown variable 'obstacles' . Line: 45, col: 17
[Error]: Undeclared identifier 'obstacles' . Line: 47, col: 28
[Error]: Unknown variable 'obstacles' . Line: 48, col: 17
[Error]: Unknown identifier: 'curRoom' . Line: 48, col: 29
[Error]: Undeclared identifier 'obstacles' . Line: 1, col: 0
[Error]: Unknown property or method: 'obstacles'. Line: 1, col: 0
[Error]: Unknown variable 'client' . Line: 51, col: 29
[Error]: Unknown variable 'caller' . Line: 54, col: 38
[Error]: Unknown type 'PolyPath' Line: 59, col: 10
[Error]: Internal compiler error - unable to find class index of 'PolyPath' Line: 59, col: 10
[Error]: Undeclared identifier 'client' . Line: 59, col: 22
[Error]: Undeclared identifier 'caller' . Line: 59, col: 45
[Error]: Undeclared identifier 'obstacles' . Line: 59, col: 57
[Error]: Unknown type 'PolyPath' Line: 61, col: 10
[Error]: Internal compiler error - unable to find class index of 'PolyPath' Line: 61, col: 10
[Error]: Undeclared identifier 'points' . Line: 69, col: 16
[Error]: Undeclared identifier 'MDisposePtr' . Line: 69, col: 31
[Error]: Undeclared identifier 'points' . Line: 69, col: 43
[Error]: Unknown procedure 'Memory' . Line: 69, col: 30
[Error]: Unknown variable 'points' . Line: 70, col: 14
[Error]: type 'int' cannot be assigned to type 'Unknown-type'. Line: 70, col: 14
[Error]: Unknown variable 'value' . Line: 71, col: 14
[Error]: type 'int' cannot be assigned to type 'Unknown-type'. Line: 71, col: 14
[Error]: Undeclared identifier 'client' . Line: 72, col: 24
[Error]: Unknown identifier: 'client' . Line: 74, col: 30
[Error]: Unknown type 'PolyPath' Line: 79, col: 13
[Error]: Internal compiler error - unable to find class index of 'PolyPath' Line: 79, col: 13
[Error]: Unknown identifier: 'client' . Line: 86, col: 30
[Error]: Unknown type 'PolyPath' Line: 88, col: 13
[Error]: Internal compiler error - unable to find class index of 'PolyPath' Line: 88, col: 13
[Error]: Undeclared identifier 'points' . Line: 90, col: 22
[Error]: Undeclared identifier 'value' . Line: 90, col: 29
[Error]: Unknown procedure 'WordAt' . Line: 90, col: 21
[Error]: Undeclared identifier 'points' . Line: 92, col: 16
[Error]: Undeclared identifier 'MDisposePtr' . Line: 92, col: 31
[Error]: Undeclared identifier 'points' . Line: 92, col: 43
[Error]: Unknown procedure 'Memory' . Line: 92, col: 30
[Error]: Unknown variable 'points' . Line: 93, col: 14
[Error]: type 'int' cannot be assigned to type 'Unknown-type'. Line: 93, col: 14
[Error]: Unknown variable 'value' . Line: 94, col: 14
[Error]: type 'int' cannot be assigned to type 'Unknown-type'. Line: 94, col: 14
[Error]: Undeclared identifier 'client' . Line: 95, col: 24
;;; Sierra Script 1.0 - (do not remove this comment)
;**
;** Logics for room 967 -- PChase
;**
(script# 967)
(include sci.sh)
(include game.sh)
(use Main)
(use Controls)
(use rm968)
(class PChase kindof PolyPath
(properties
who NULL
distance 0
targetX 0
targetY 0
)
(method (init actor whom howClose whoCares theObst &tmp [buffer 20])
(if argc
(cond
((>= argc 5)
(= obstacles theObst)
)
((not (IsObject obstacles))
(= obstacles (curRoom obstacles?))
)
)
(if (>= argc 1) (= client actor)
(if (>= argc 2) (= who whom)
(= targetX (who x?))
(= targetY (who y?))
(if (>= argc 3) (= distance howClose)
(if (>= argc 4) (= caller whoCares)
)
)
)
)
(super init: client targetX targetY caller TRUE obstacles)
else
(super init:)
)
)
(method (doit &tmp theDistance)
(cond
((> (GetDistance targetX targetY (who x?) (who y?)) distance)
;; start again
(if points (Memory MDisposePtr points))
(= points NULL)
(= value 2)
(self init: client who)
)
((<= (= theDistance (client distanceTo: who)) distance)
;; got close enough...
(self moveDone:)
)
(else
(super doit:)
)
)
)
(method (moveDone &tmp theDistance [buffer 20])
(cond
((<= (= theDistance (client distanceTo: who)) distance)
;; really done
(super moveDone:)
)
((== (Memory MemReadWord (self at: value)) $7777)
;; at the end of a path so start over
(if points (Memory MDisposePtr points))
(= points NULL)
(= value 2)
(self init: client who)
)
(else
;; just at a node, so keep going
(self
setTarget:
init:
)
)
)
)
)
and the PolyPath as rm968:
;;; Sierra Script 1.0 - (do not remove this comment)
;**
;** Logics for room 968 -- PolyPath.SC
;; Path around an arbitrary set of obstacles, all of which are
;; defined as Polygons and added to the obstacle list via the
;; Rooms setObstacle method. 07/24/90 J.M.H.
(script# 968)
(include sci.sh)
(include game.sh)
(use Main)
(public
rm968 0
)
(class PolyPath kindof Motion
(properties
value 2 ; current location in path
points 0 ; pointer to path array allocated in the kernel
finalX 0
finalY 0
obstacles 0
)
(method (init actor theX theY whoCares opt obstList &tmp [buffer 30])
(if argc
(= client actor)
(if (> argc 1)
(cond
((>= argc 6)
(= obstacles obstList)
)
((not (IsObject obstacles?))
(= obstacles (curRoom obstacles?))
)
)
(if points (Memory MDisposePtr points))
(= points
(AvoidPath
(actor x?)
(actor y?)
(= finalX theX) (= finalY theY)
(if obstacles?
(obstacles elements?)
)
(if obstacles?
(obstacles size?)
)
(if (>= argc 5)
opt
else
TRUE
)
)
)
(if (> argc 3)
(= caller whoCares)
)
)
(self setTarget:)
)
(super init:)
)
(method (dispose)
(if points (Memory MDisposePtr points))
(= points NULL)
(super dispose:)
)
(method (setTarget &tmp newPoints newX newY theSize [buffer 30])
(if (!= (WordAt points value) $7777)
(= x (WordAt points value))
(= y (WordAt points (++ value)))
(++ value)
(if (and (IsObject altPolyList)
(= theSize (altPolyList size?))
)
(= newPoints
(AvoidPath (client x?)
(client y?)
x y
(altPolyList elements?)
theSize
0
)
)
(= newX (WordAt newPoints 2))
(= newY (WordAt newPoints 3))
(if (or (!= x newX)
(!= y newY)
)
(= x newX)
(= y newY)
(Memory MWriteWord (+ points value 2) $7777)
)
(Memory MDisposePtr newPoints)
)
)
)
(method (moveDone)
(if (== (WordAt points value) $7777)
(super moveDone:)
else
(self
setTarget:,
init:
)
)
)
)
-
No. The kernel function is not there until SCI01 (QfG2), and that's before looking at your syntax error. Eric Oakford had an SCI01 template somewhere, didn't he? Maybe you could use that if you're willing to upgrade.
-
ok thanks for confirming.
I'll rework my code as I'm too far in to change the base template.
Regards,