15
« on: May 30, 2024, 06:25:42 AM »
Hi guys,
I'm trying to get an actor to wander around from room to room. Sort of like what they did with the BikiniLadies in Codename: Iceman.
I've found in the Iceman source code this code but don't really understand what its doing all the time.
Water.sc
(method (init)
(Load rsVIEW 217)
(Load rsVIEW 216)
(Load rsVIEW 215)
(Load rsVIEW 214)
(Load rsVIEW 702)
(Load rsVIEW 202)
(Load rsVIEW 902)
(super init: &rest)
(gEgo viewer: EgoWaterViewer)
(closeUpView init:)
(if (not script)
(self setScript: beachWalkerScript)
)
(if (IsObject (script register:))
((script register:) init: setMotion: beachWalkerPath)
)
(if (not (gGame script:))
(gGame setScript: musicScript)
)
)
(method (notify param1 param2 &tmp temp0)
(switch param1
(0
(= temp0 0)
(while (< temp0 (- argc 2))
((Clone param2)
x: [param2 (++ temp0)]
y: [param2 (++ temp0)]
loop: [param2 (++ temp0)]
init:
)
)
)
(1
(beachWalkerScript register:)
(return)
)
)
)
So here its loading the views for the BikiniLadies and checking to see if the beachWalkerScript is registered and registering it. I don't know what the method is doing really? I can only seem to get the method compiling if I include it after the (method (handleEvent pEvent) section in my RoomScript.
(instance closeUpView of View
(properties
y 85
x 265
view 993
loop 4
)
(method (init)
(super init:)
(self hide: setPri: 15)
)
(method (show param1)
(self view: param1 setLoop: 4)
(super show:)
)
)
(instance aBikini3Lady of Act
(properties
view 993
)
(method (init)
(super init:)
(self
setAvoider: Avoid 1
ignoreHorizon:
setCycle: Walk
observeControl: 2048
)
)
(method (handleEvent event)
(cond
((super handleEvent: event))
((IsOffScreen self))
((Said 'look[<at][/woman,brunette,native[<native,brunette]]')
(closeUpView show: view)
(Animate (gCast elements:) 0)
(Print { Whew, what a hot lookin' native girl!})
(closeUpView hide:)
(event claimed: 1)
)
)
)
)
(instance aBikini4Lady of Act
(properties
view 994
)
(method (init)
(super init:)
(self
setAvoider: Avoid 1
ignoreHorizon:
setCycle: Walk
observeControl: 2048
)
)
(method (handleEvent event)
(cond
((super handleEvent: event))
((IsOffScreen self))
((Said 'look[<at][/blond,woman[<blond]]')
(closeUpView show: view)
(Animate (gCast elements:) 0)
(Print {This blonde is definitely a babe.})
(closeUpView hide:)
(event claimed: 1)
)
((Said 'whistle')
(Print {She ignores your ancient ploy.})
)
((Said 'ask<out/woman')
(Print {She is out.})
)
;;; ((Said '[/bitch,cunt,boob,blond,woman[<blond]]>')
;;; (cond
;;; ((Said 'ask//date')
;;; (localproc_0)
;;; )
((Said 'ask//time')
(Print {Time has no meaning in Tahiti.})
)
;;; ((Said 'chase')
;;; (Print 301 18) ; "You can do that."
;;; )
((Said 'talk')
(Print {She's trying to ignore you.})
)
;;; ((Said 'kiss,suck,fuck,touch')
;;; (if (> (gEgo distanceTo: self) 50)
;;; (Print 301 20) ; "You'll have to get closer than this."
;;; else
;;; (QueScript self 353)
;;; )
)
)
)
(instance beachWalkerPath of RegionPath
(properties
value 29
endType 0
theRegion 028
)
(method (at param1)
(return [local1 param1])
)
(method (nextRoom)
(if
(and
(== (self at: (+ 2 value)) 3)
;(== gRoom newRoomNumber: 28) ; volleyRm
(gRoom newRoom: notify: 0)
)
(repeat
(-= value 2)
(breakif (== (self at: (+ 1 value)) 32767))
)
)
(super nextRoom: &rest)
)
)
(instance beachWalkerScript of Script
(properties)
(method (changeState newState &tmp temp0)
(switch (= state newState)
(0
(= temp0
(switch (Random 2 3)
(2 aBikini3Lady)
(3 aBikini4Lady)
)
)
(beachWalkerPath value: -1)
(if (IsObject register)
(register dispose:)
)
(if (== temp0 register)
(self init:)
else
((= register temp0) init: setMotion: beachWalkerPath self)
)
)
(1
(self init:)
)
)
)
)
So the CloseUp is how it shows the portrait of the bikinilady when looking at her.
The BikiniLadies instances seem more or less clear but I can't see how to get them appearing on screen. Everything compiles fine on my script.
Ive added the RegionPath script #809 also to my script folder. I'm not sure if the SC template has a build in one?
The Beachwalker script is more or less clear.
Here is my final roomscript including the Iceman code:
;;; Sierra Script 1.0 - (do not remove this comment)
;**
;** Logics for room 027 - Beach 1
;**
;** Leisure Suit Larry 4 - Never say Nontoonyt (AKA The Missing Floppies)
;** Copyright 2024
;** by Robbo
;**
;** Last Update: March, 27th, 2024
;**
(script# 28)
(include sci.sh)
(include game.sh)
(use Controls)
(use Cycle)
(use Door)
(use Extra)
(use Feature)
(use FileIO)
(use Follow)
(use Game)
(use Gauge)
(use InitRooms)
(use Inv)
(use Rev)
(use Jump)
(use Main)
(use MenuBar)
(use Obj)
(use RegionPath)
(use DPath)
(use Avoid)
(public
rm028 0
)
(local
local0
[local1 113] = [32767 7 273 117 104 132 48 235 32767 5 72 104 135 104 325 184 32767 4 76 95 128 103 325 178 32767 3 -5 90 325 100 32767 2 -5 100 180 160 325 185 32767 12 -5 170 175 156 325 128 32767 13 -5 128 325 106 32767 24 -5 116 184 111 155 72 -5 130 32767 13 325 106 -5 128 32767 12 325 128 175 156 -5 170 32767 2 325 150 -5 100 32767 3 325 100 -5 90 32767 4 325 178 128 103 76 95 32767 5 325 184 135 104 72 104 32767 7 48 235 104 132 273 117 -32768]
)
(procedure (IsOffScreen theObj)
(return
(not (and (< 0 (theObj x:) 320) (< 0 (- (theObj y:) (theObj z:)) 200)))
)
)
(instance rm028 of Rm
(properties
picture 028
north 0
east 0
south 0
west 029
)
(method (init)
(closeUpView init:)
(if (not script)
(self setScript: beachWalkerScript)
)
(if (IsObject (script register:))
((script register:) init: setMotion: beachWalkerPath)
)
(super init:)
(gAddToPics ;This adds views to the background in a much nicer way :)
add: aUmbrella
add: aUmbrella2
add: aFatGuy
add: aLegs
add: aPalm
doit:
)
(self setScript: RoomScript)
(switch gPreviousRoomNumber
)
(cond
((== gPreviousRoomNumber 026) (gEgo posn: 250 63 loop: 0)
)
((== gPreviousRoomNumber 027) (gEgo posn: 239 67 loop: 0)
)
((== gPreviousRoomNumber 029) (gEgo posn: 9 77 loop: 0)
)
(else
(gEgo posn: 150 100 loop: 1)
)
)
(SetUpEgo)
(gEgo init:)
(if (> gMachineSpeed pc8088)
(aWave init:)
(aWave2 init:)
(aBikini3Lady init:)
(aBikini4Lady init:)
)
)
)
(instance RoomScript of Script
(properties)
(method (doit)
(super doit:)
; code executed each game cycle
(if (& ctlBLUE (gEgo onControl:))
(gRoom newRoom: 027)
)
)
(method (handleEvent pEvent)
(super handleEvent: pEvent)
; handle Said's, etc...
)
(method (notify param1 param2 &tmp temp0)
(switch param1
(0
(= temp0 0)
(while (< temp0 (- argc 2))
((Clone param2)
x: [param2 (++ temp0)]
y: [param2 (++ temp0)]
loop: [param2 (++ temp0)]
init:
)
)
)
(1
(beachWalkerScript register:)
(return)
)
)
)
(method (changeState newState)
(= state newState)
(switch state
(0 ; Handle state changes
)
)
)
)
(instance aFatGuy of View ;Kenowama
(properties
view 028
loop 1
cel 0
x 77
y 142
priority 11
signal ignAct ;16384
)
)
(instance aUmbrella of View ;Red umbrella with Kenowama under it.
(properties
view 028
loop 0
cel 0
x 55
y 153
priority 10
signal ignAct ;16384
)
)
(instance aUmbrella2 of View ;Blue umbrella with two pairs of legs bottom right
(properties
view 028
loop 2
cel 0
x 293
y 169
priority 12
signal ignAct ;16384
)
)
(instance aLegs of View ;Pair of legs under blue umbrella bottom right
(properties
view 028
loop 3
cel 0
x 275
y 157
priority 12
signal ignAct ;16384
)
)
(instance aPalm of View ;Palm tree right
(properties
view 028
loop 4
cel 0
x 285
y 131
priority 09
signal ignAct ;16384
)
)
(instance aWave of Prop ; left wave at bottom
(properties
view 28
loop 5
x 78
y 189
cycleSpeed 15
)
(method (init)
(super init:)
(self
setPri: 1
setScript:(if (> gMachineSpeed pcAT)aWaveScript) ;this stops wave script if PC is a IBM AT or slower.
stopUpd:
)
)
)
(instance aWave2 of Prop ;right wave at bottom
(properties
view 28
loop 6
x 238
y 189
cycleSpeed 15
)
(method (init)
(super init:)
(self
setPri: 1
setScript:(if (> gMachineSpeed pcAT)aWaveScript) ;this stops wave script if PC is a IBM AT or slower.
stopUpd:
)
)
)
(instance aWaveScript of Script ;Here the two wave views are merged together and played at the same time.
(method (changeState newState)
(switchto (= state newState)
(
(aWave stopUpd:)
(aWave2 stopUpd:)
; Wait for 2 to 6 seconds...
(= seconds (+ 1 (* (Random 0 3) 2)))
)
(
; Setting a cycler automatically restarts updating.
(aWave setCycle: Fwd self)
(aWave2 setCycle: Fwd self)
)
(
(aWave setCycle: Rev self)
(aWave2 setCycle: Rev self)
)
(
; Repeat.
(self changeState: 0)
; A better way might be to (= state -1) (= cycles 1) but nyehh.
)
)
)
)
(instance closeUpView of View
(properties
y 85
x 265
view 993
loop 4
)
(method (init)
(super init:)
(self hide: setPri: 15)
)
(method (show param1)
(self view: param1 setLoop: 4)
(super show:)
)
)
(instance aBikini3Lady of Act
(properties
view 993
)
(method (init)
(super init:)
(self
setAvoider: Avoid 1
ignoreHorizon:
setCycle: Walk
observeControl: 2048
)
)
(method (handleEvent event)
(cond
((super handleEvent: event))
((IsOffScreen self))
((Said 'look[<at][/woman,brunette,native[<native,brunette]]')
(closeUpView show: view)
(Animate (gCast elements:) 0)
(Print { Whew, what a hot lookin' native girl!})
(closeUpView hide:)
(event claimed: 1)
)
)
)
)
(instance aBikini4Lady of Act
(properties
view 994
)
(method (init)
(super init:)
(self
setAvoider: Avoid 1
ignoreHorizon:
setCycle: Walk
observeControl: 2048
)
)
(method (handleEvent event)
(cond
((super handleEvent: event))
((IsOffScreen self))
((Said 'look[<at][/blond,woman[<blond]]')
(closeUpView show: view)
(Animate (gCast elements:) 0)
(Print {This blonde is definitely a babe.})
(closeUpView hide:)
(event claimed: 1)
)
((Said 'whistle')
(Print {She ignores your ancient ploy.})
)
((Said 'ask<out/woman')
(Print {She is out.})
)
;;; ((Said '[/bitch,cunt,boob,blond,woman[<blond]]>')
;;; (cond
;;; ((Said 'ask//date')
;;; (localproc_0)
;;; )
((Said 'ask//time')
(Print {Time has no meaning in Tahiti.})
)
;;; ((Said 'chase')
;;; (Print 301 18) ; "You can do that."
;;; )
((Said 'talk')
(Print {She's trying to ignore you.})
)
;;; ((Said 'kiss,suck,fuck,touch')
;;; (if (> (gEgo distanceTo: self) 50)
;;; (Print 301 20) ; "You'll have to get closer than this."
;;; else
;;; (QueScript self 353)
;;; )
)
)
)
(instance beachWalkerPath of RegionPath
(properties
value 29
endType 0
theRegion 028
)
(method (at param1)
(return [local1 param1])
)
(method (nextRoom)
(if
(and
(== (self at: (+ 2 value)) 3)
;(== gRoom newRoomNumber: 28) ; volleyRm
(gRoom newRoom: notify: 0)
)
(repeat
(-= value 2)
(breakif (== (self at: (+ 1 value)) 32767))
)
)
(super nextRoom: &rest)
)
)
(instance beachWalkerScript of Script
(properties)
(method (changeState newState &tmp temp0)
(switch (= state newState)
(0
(= temp0
(switch (Random 2 3)
(2 aBikini3Lady)
(3 aBikini4Lady)
)
)
(beachWalkerPath value: -1)
(if (IsObject register)
(register dispose:)
)
(if (== temp0 register)
(self init:)
else
((= register temp0) init: setMotion: beachWalkerPath self)
)
)
(1
(self init:)
)
)
)
)