Hello!
How is everything? My name is Alberto and this is my first post here :). I am an IF player since long ago, I started in the 80s when I was a kid with my Amstrad CPC and I have played quite a few titles, but mainly in microcomputers. My only contribution as an author to the IF world is an Amstrad game that was released in 2016, Doomsday Lost Echoes. This game was made between one of my best friends, that took care of all the pixel art, drawings, etc., and me working in the code. Lots of other people greatly helped during the development and beta testing period too. At the end of the day, it was quite a nice community project, I would say :).
DDLE was created using PAWS, I am sure that some of you still remember it. The whole game database, when compressed, fits in 61KB, but it would be around 80KB if uncompressed. The source code, including annotations, is just around 330KB. The graphics are loaded from the computer drive in real time, they are moved straight into the video memory region when the player changes rooms. As you can imagine, the whole game is quite simple, particularly because it was made with the intention of being accessible to everybody, even new IF players. To achieve this in a 8-bit computer puzzle difficulty is not very high and we made sure that several different commands can be typed to solve each of them.
These days I am trying to port our little adventure to TADS3. I thought that it would be a great way to get familiar with TADS and, given how simple is the game compared with those released in PC, I did not expect the port to be super challenging. Therefore, I am porting it while reading Learning T3, Getting started in TADS3 and the technical manuals. I thought that it could be a good idea to start the port while I read documentation in order to consolidate my knowledge with a practical project (on top of the examples proposed in the documentation).
Currently, I finished creating all the locations and the inventory items, and I am slowly modelling each of the rooms: the furniture, decoration, containers, etc., and putting the objects in their starting places. I am not planning to implement most of the puzzles until all this is done.
Thing is that while I was doing all this I tried to implement something a bit more advanced and it is not working as intended, probably because I went ahead too fast. Things like this, I thought that I could ask you guys about it and also ask if my general approach of tracking things is remotely right when using TADS3.
The âpuzzleâ I am trying to implement is super simple: the player grabs a battery from a container and puts it in the battery holder of a generator. This switches the generator on, something that activates several electrical systems around. Once the battery is in the holder the puzzle is over and the battery as such disappears. The holder also closes permanently and the generator is ON until the end of the game.
At the beginning I was just checking if the battery was inside the holder (implemented as a container) for things to happen. However, I thought that it could be more practical to create an object that holds a collection of variables to keep track of the status of the world. Therefore, I made something like this (yep, I know, I am not using templates):
//***Game flags***
flag_index: Thing
vocabWords = '(flag) index'
name = 'flag index'
battery_inserted = 0
;
and I implemented the battery holder as below:
power_plant_generator_battery_holder: OpenableContainer, SingleContainer, RestrictedContainer, Fixture, Hidden
vocabWords = '(battery) (generator) holder*holders/receptacle*receptacles/snap*snaps/enclosure*enclosures'
name = 'battery holder'
location = Power_plant
validContents = [nuclear_Battery]
isOpen = true
desc()
{
if(flag_index.battery_inserted == 1)
{
"The battery holder is closed and locked. The battery is inside. ";
cannotOpenMsg = 'I better leave it alone now that the generator is running. ';
}
if(flag_index.battery_inserted == 0)
{
"The battery holder is empty. These generators are plug and play, inserting the right battery on it should power it on. ";
}
}
notifyInsert(nuclear_Battery, newCont)
{
"When I insert the nuclear battery in the holder I hear a click and the compartment closes. ";
makeOpen(nil);
flag_index.battery_inserted = 1;
nuclear_Battery.moveInto(nil);
}
;
The logic is to change the value of âbattery_insertedâ in the âflag_indexâ object from 0 to 1 once the player puts the battery inside the holder, and then just check for the value of this variable to adjust descriptions and behavior of other things, like doors. However, the approach only partially works: the game outputs the right descriptions when the battery is inserted, but the battery as such does not disappear and the holder does not close.
My questions at this point are two:
-
Do you think that I am following a completely flawed approach to track the status of the world? I could also do it checking the properties of different objects or using ârevealâ but PAWS works with flags and I thought it would be easier to use them in this particular case.
-
If the approach is not completely stupid, do you know what is going on?
Thank you so much and sorry for the super naive question and the long post, I still did not finish reading the documentation, so it could be that I am missing something super obvious.
Cheers,
Alberto