Dev Log #11.1

This dev log contains code, information, and other notes for “Passage #1” of the code I am showing off. I will be using “Abraham”, who is the first barkeep you meet.

First thing first, I needed to set a passage for his inventory. This is basically like a “Oh, this is what he is selling”. Of course, there is another passage that leads into the one displayed below, but that is not relevant to this dev log.

NOTE: THIS HAS NOT BEEN FORMATTED. FOR EXAMPLE, IT STILL REQUIRES TEXT COLOUR IN OTHER SPOTS.

This will be fixed later in my troubleshooting

Fig 11.11. Passage for Barkeep’s Inventory

The first “box” of code is just the menu system. It’s not too important to you (the reader) at the moment. So we’ll skip it. However, what is important is the code beneath it.

Fig 11.12. The important part for the Barkeep’s Inventory

Here, you can see a combination of things. I’ll explain them one by one:

  • (Text-colour: #d66100) – the command to set text a certain colour, in this case, is “#d66100”, a brown orange as you can tell by the underline under it.
  • (Transition: “fadeup”) – a command to allow the text it’s attached to, to “fade up”
    • This is mainly for aesthetic purposes
  • (live: #s) – a command that gives a text “time”. It tells Twine that you want a certain text to show up after [INSERT NUMBER] seconds.
  • (stop:) – a command to stop the timer (stopping the live command) and also stopping the transition command
    • If this wasn’t here, the “fade up” transition would keep happening, and the text wouldn’t stop jittering in place
  • [[TEXT]] is just Twine’s way of making a new passage for said item
  • “=><=” is a center text command I heavily use

Now, after that is done, it’ll look something like this.

Fig 11.13. What the code produces

After, you can click on any of the items to purchase. To demonstrate the inventory system, I will be buying the “Moonshine”.

When you try to purchase something in the game, it’ll always bring you to a specific “transition state”. It is invisible to you as the player (it’s not visual cues), but to the code- it is definitely there.

Once you click “Moonshine” the game will read this code that is from a separate passage.

Fig 11.14. Moonshine’s transition state

Here, the game is basically seeing if you have enough money. Since the moonshine was 5 WPS (WPS is the currency in the game), it’ll check if you have it.

If you have 5 WPS, or greater, it’ll bring you to the BUYING menu. if not, it’ll bring you to the NOT BUYING menu.

Fig 11.15. Moonshine’s BUYING MENU

Here, the code is telling the game to both remove 5WPS from your inventory, but also added the item “Moonshine” into an array, which is basically just your inventory.

Fig 11.16. Moonshine NOT BUYING MENU

For a visual sense, they look like this in-game:

Fig 11.17 BUYING Moonshine Screen
Fig 11.18 NOT BUYING Moonshine Screen

The inventory can be accessible from the “Menu” button, which you can see in Fig 11.13.

After, It’ll show up in your inventory as so:

Fig 11.19. Your inventory

You can click on the word “Moonshine” for a description if you’d like. However- not all items have an additional description.

Fig 11.20. Moonshine description

It’s a lot more complicated as I’ve printed it out to be- but this mechanism is pretty important to how the game will operate- since NPC’s will give you items and as a player- I think it’s super cool you can actually see what they gave you/ what you are carrying.


Posted

in

by

If you’ve lost your way in the IFStravaganza, you can always go back to the beginning.

Comments

Leave a Reply