Template Game Bug Fixes

From SCI Wiki
Jump to: navigation, search

Setting Inventory views to any cel, loop, or view

While trying to set the inventory items instance found in the main script, you will find that no matter how you set the loop or cel, only loop 0 and cel 0 is shown.

To fix this bug, simply change a couple of the default variable values found in the Iitem of InvI class found about halfway down the main script. In the showself method, the default inventory icon variables manually set the cel and loop to 0, just like it's doing. If you would like to be able to set these variables via the instance of the item located at the bottom of the main script, we simply need to change the zeros to loop and cel respectively.

In main.sc

Code:
/******************************************************************************/
(class Iitem of InvI
    (properties
        said 0
        description 0
        owner 0
        view 0
        loop 0
        cel 0
        script 0
    )
    (method (showSelf)
        Print(
            description
            #title objectName
            #icon view loop cel // Changed from: #icon view 0 0
        )
    )
)
/******************************************************************************/

A small typo in the doit method of timer class

This is actually a small snippet from Lars' post on how to use timers. Just in case your looking for a bug free template and you happened to overlook that post I'd thought that I'd copy it to here as well.


There's the setReal method. Like set, it performs all calculations on its own, but it uses the seconds counter, and it does not adjust for game speed. Thus, it is ideal for game events that depend on how much "real time" passes. However, it does not work out of the box due to a typo in the template game. To fix it, find the doit method of the timer class (in Timer.sc), and the line that says:

Code:
(if (not seconds)
    CueClient()
)

Fix the first line so it reads:

Code:
(if (not --seconds)

and you're all set.