Community

SCI Programming => SCI Syntax Help => Topic started by: Doan Sephim on January 21, 2021, 09:42:20 PM

Title: SCI0 - Death Icon always set to loop indefinitely
Post by: Doan Sephim on January 21, 2021, 09:42:20 PM
I'd like to have some more flexibility with the death handler icon, if possible. It seems to be set to always cycle forward indefinitely.

Is there a way for me to just run the Cels ONCE, like you can do with setCycle: End.

The Method is here, but it's not clear to me how to allow a choice between cycling once or infinite:
Code: [Select]
(instance deadIcon of DCIcon
(properties)

(method (init)
(super init:)
(if (== gRoomNumberExit 540)
(= cycler (End new:))
(cycler init: self)
)
)
)
Title: Re: SCI0 - Death Icon always set to loop indefinitely
Post by: lskovlun on January 23, 2021, 02:27:48 PM
Code: [Select]
(instance deadIcon of DCIcon
(properties)

(method (init)
(super init:)
(if (== gRoomNumberExit 540)
(= cycler (End new:))
(cycler init: self)
)
)
)
That if-statement there is a holdover from LSL3 and might cause trouble down the road if you ever have a room 540.
If you only need this once or twice, then that structure might be appropriate; it is simple and the code is already there. Another thing you could do is add a new global variable, or a new property to dyingScript. Then change the check above to look there instead.

Title: Re: SCI0 - Death Icon always set to loop indefinitely
Post by: Doan Sephim on February 05, 2021, 08:55:01 AM

Thanks. Now I understand what the room number 540 was all about. Instead of the room number, I did like you said and just created a global variable that when true would trigger the code properly.

Code: [Select]
(instance deadIcon of DCIcon
(properties)

(method (init)
(super init:)
(if (== gDeathIconEnd 1)
(= cycler (End new:))
(cycler init: self)
)
)
)