This chapter deals with getting our text resources organized so we can begin scripting. You may not have ever used a text resource before, but you should have, and guess what, you are going to now.
Looking over the list of tutorials, I see that not much has ever been said about text resources. One of the few things that
I did find was where Brian's tutorial said that we wouldn't ever actually use them much except maybe if we wanted to translate our games into other languages. He was definitely a little short sighted
on that aspect, Text Resources are VERY important primarily because they can help to preserve your heap space memory. I don't know if you've ever gotten one while playing a Sierra game, but if you
begin to make a game of any size at all, it won't take long before you begin encountering it in your own game. The best plan, is to manage your resources from the beginning. Anyway, we will be making
use of the text resources, not only for heap concerns, but because they will actually ease some of our scripting.
Using SCI Companion, begin by selecting the "New Texts" Icon in the Explorer Toolbar.
After clicking on it, the Text Editor will pop open.
Clicking on the <Click to add new text> will highlight it allowing you to enter whatever text statements that you would like. These are the same statements that you would be using Print or Display for normally in your rooms scripts. Instead you are just putting them here. After you have typed in your statement, press enter on your keyboard before going to any other SCI Companion screen, it won't remember what you typed if you don't hit return. Now, with a few lines typed in, click on the save icon and select a resource number to save it as.
In order to use the text resource that you created, you will still use Print or Display just as you normally would, except now instead of using quotation marks and entering the text, you will just reference the resource number and the line number. You did notice that all of the lines you entered were numbered right. So now, your Print statements will look something like this
OK, that sums up your quick little tutorial on how to make a text resource, now it's time to put it into action.
We are going to be using two text resources for our inventory room. The first one, number it 500, is going to hold all of our inventory item's descriptions. The ones that Chapter 18 of the Volume I tutorial had us placing in the main script and I said not to. Now just like with our cursors, the row numbers of our texts need to correspond with the number that the item was defined as. So Item Cash, defined as 1, uses cursor 1, and also text resource 500 line 1. Are you starting to see a pattern forming here. We are going to use line 0 for a response of clicking on an item with itself, just because we don't have any other use for it, no point in wasting it.
Open up a new text resource and let's begin.
That is all we need out of this text for our tutorial, save this as number 500. As a side note, notice line 1, the reference to inventory item 1, the cash description's text includes a variable. That variable is going to get changed into our totalcash we added to the mainscript later on by our Print statement. I just wanted you to notice that it was possible to do that using text resources.
Now, it's time to create the other text resource we need in our inventory room, may as well number it 501 just to keep the two close. This resource is going to include all of our text which isn't a description of an item, for instance our help messages, maybe a funny line or two about trying to combine two incombinable items, or even to let them know that items were combined successfully. Technically all of this stuff could have gone into resource 500 but that would throw off our high tech numbering system which quite honestly means that we would have to do a lot more work later when we attempt to script in other items. So I put this stuff in 501 to save myself trouble later, and I'm expecting you to also.
All right, that is that, we now have our two text resources for our point and click inventory room. Remember 500 holds descriptions for when an item is Looked at, and 501 is basically for everything else that you might want to Print to the screen while the user is in the inventory room.
That sums up our creation of our Inventory's Text resources!
< Previous: Chapter 2 - Ordering the Cursors Next: Chapter 4 - Inventory Views >