Placing Inventory Descriptions in a Text Resource

From SCI Wiki
Jump to: navigation, search

By Cloudee1

As your inventory item count grows, the list of instances at the bottom of the main script grows. every addition you make to the main script takes away from every other rooms memory allotment since it itself is used in every room. One way to minimize your impact on the main script and thereby your game overall, is to use text resources to hold all of your inventory items descriptions (and all other text strings but that's personal choice).

In order to do so, you must edit the main script. Remember whenever you edit the main script, you must compile all scripts, both editors have a button just for this. In the main script a hair passed halfway you will find the class Iitem of InvI. the showself method is basically just creating the print tag

  (method (showSelf)
    Print( description
             #title objectName
             #icon view loop cel // you did make this bug update right

In order to change the description from the string we are setting it in each item's instance, we want to display the text resource instead so for that we need two numbers. As you may know when printing from a text resource like say number 54 line 23 you would use Print(54 23). So for us to do the same here, we need to pick a text resource to use which all inventory item descriptions will be placed in and I don't see any reasons not to use 0. So we just change the first line of the print statement to read

Print(0 description

Now that that is done, we need to address the description found in each inventory items instance. By default we used "long text strings" but now that the first thing in the print statement is a number, the second thing better be too or something is going to break. The best part is that now the description in each instance simply needs to equal the line it is found on in text resource 0. So they should all look something like this.

(instance {Test Object} of Iitem
        said 'object'
        description 10
        owner 0
        view 800
        loop 0
        cel 0
        script 0

Besides making editing them easier since you won't have to recompile all the scripts just for adding a comma, your heap space will last out that much longer for not having preloaded all that miscellaneous junk in there in every room to begin with.