Home | SCI Documentation | SCI Tutorials | SCI Tools | SCI Wiki | Community

Chapter 3 - Prepare the Text for the Inventory Room

This chapter deals with getting the 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.

About Text Resources

Text EditLooking 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 you wanted to translate your game 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 your scripting.

Editing Text Resources

New Using SCI Companion, begin by selecting the "New Texts" Icon in the Explorer Toolbar.
After clicking on it, the Text Editor will pop open.

New Text

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

Code:
Print(5 25) // would print text resource 5's line 25

OK, that sums up your quick little tutorial on how to make a text resource, now it's time to put it into action.

Text Resources for the Inventory

We are going to be using two text resources for the inventory room. The first one, number it 500, is going to hold all of the 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 the cursors, the row numbers of the 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.

  1. Using something on itself, rarely accomplishes anything and this is not one of those rare times.
  2. This is your current pile of cash, you are carrying %d bucks.
  3. This is a superduper balloon.
  4. This is a string. It's sole purpose in life is to get tied to something.
  5. Is that a balloon on a string? By golly I'm pretty sure that it is.

That is all we need out of this text for this tutorial, save it 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 the totalcash we added to the mainscript later on by the 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 the inventory room, may as well number it 501 just to keep the two close. This resource is going to include all of the text which isn't a description of an item, for instance the 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 the 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.

  1. Open up another new text resource and enter this stuff.
  2. You need to have an item selected first.
  3. Are you Sure You'd like to discard this item?
  4. If you would like to examine an item, select the eye icon and then select the inventory item.
  5. In order to use an item, you must first select the hand icon and then select the inventory item. The cursor will then change to that item.
  6. To use an item on another inventory item, once one item has been selected with the hand, simply click on the item you would like to use it in combination with.
  7. If you would like to discard an item, you must first select it with the hand, and when the cursor changes to the item, simply click on the trash can.
  8. When you have finished simply click on the check mark to return to the game.
  9. Adding your cash to your pile of cash leaves you with
  10. ... the same pile of cash.
  11. Trust me, You don't want to toss that aside so quickly!
  12. Your brilliant use for that in this way clearly illustrates that you are in a league of your own. So much so, that I am not even going to allow it, try something else.
  13. This is a Trash Can. If you select an inventory item you may drop it by clicking it here.
  14. Once an item has been dropped it can not be retrieved. No dumpster diving allowed.
  15. You may exit this room by clicking on this area with either the hand or an item
  16. You quickly tie the string onto the balloon
  17. If people saw you talking to that, they would lock you up!

All right, that is that, we now have the two text resources for the 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 the creation of the Inventory's Text resources!

< Previous: Chapter 2 - Ordering the Cursors Next: Chapter 4 - Inventory Views >
 

by helping to defray some of the costs of hosting this site. If it has been of help to you, please consider contributing to help keep it online.
Thank you.
pixe
Top

© 2013 to present The Sierra Help Pages. All rights reserved. All Sierra games, artwork and music © Sierra.