Welcome, Guest. Please login or register.
May 21, 2019, 11:53:11 PM
Home  >  Tutorials  >  Chapter 3: Prepare the Text for our Inventory Room
Chapter 3: Prepare the Text for our Inventory Room

This chapter deals with getting our text resources organised 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

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 definately 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.

Editing Text Resources

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 statments 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

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 Our Inventory

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, jus 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 super duper 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 our tutorial, save this as number 500. As a sidenote, 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 funy line or two about trying to combine two uncombinable 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 alot 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.

Open up another new text resource and enter this stuff.

  1. You need to have an item selected first.
  2. Are you Sure You'd like to discard this item?
  3. If you would like to examine an item, select the eye icon and then select the inventory item.
  4. In order to use an item, you must first select the hand icon and then select the inventory item. The cursor wil then change to that item.
  5. 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.
  6. 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.
  7. When you have finished simply click on the check mark to return to the game.
  8. Adding your cash to your pile of cash leaves you with
  9. ... the same pile of cash.
  10. Trust me, You don't want to toss that aside so quickly!
  11. 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.
  12. This is a Trash Can. If you select an inventory item you may drop it by clicking it here.
  13. Once an item has been dropped it can not be retrieved. No dumpster diving allowed.
  14. You may exit this room by clicking on this area with either the hand or an item
  15. You quickly tie the string onto the balloon
  16. If people saw you talking to that, they would lock you up!

Alright, 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 basicly 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!
<< Prev Back to Tutorials Next >>

The SCI Programming Community
Copyright © 2007 - 2019, All Rights Reserved.