Menus

Yeah guys, more problems!

Basically, in my game I want a few computer terminals. I’ve already coded my memory stick that can be plugged into the computers, and now I want a menu based way to transfer files.

I guessed I would need and that there would be an extension for this. I went into the ‘Installed Extensions’ bit of the Inform documentation, and I found one called ‘Menus’. Great, I thought, just what I need. It said it wasn’t suitable for in-game menus (i.e. conversation response choosing), but I didn’t really mind having to clear the screen to show it. However, the problem came in the implementation of the extension.

The only thing you can do with the menu selections is either open a different menu, display some text, or toggle a rule. Now this is fine for a settings menu or info menu, but not really when I want to toggle to toggle the transfer of a file to a memory stick (i.e. a ‘now file_1 is in the memory stick’ kind of thing).

Is there a way to implement this extension somehow, do I have to code my own extension, or this a different, more suitable extension available for this kind of thing? I can’t find anything on the Inform 7 website at the mo, but perhaps other people know of other, secret ways to find extensions that only the initiated can find.

Any help would be much appreciated, as seeing most of my game is based around this concept.

I’m not sure from your description but it sounds like you first tried the Menus extension (by Emily Short I think). While it seems you’re OK with it I would suggest that’s not really suitable for in-game commands and effects, it’s more of a help/hint menu I believe. You might try Mark Tilford’s Simple Chat (inform7.com/extensions/Mark%20Ti … index.html) which is a menu-based conversation system, but could be probably be adapted easily enough for your application.

I never tried to use the extension George mentioned, so he could very well be right that it would be much easier than using the “Menus” extension.

How exactly to accomplish what you want depends on what you had in mind as being involved with “transferring” a file (does a copy remain on the original computer, etc).

If decide to use “Menus” after all, I was looking at it and the extension is a bit fussier than I remembered. I spent less time (it was only a few minutes) writing the example below than I would have if I had tried to write out an explanation, and I think if you play around with this example for a few minutes it will be pretty obvious how everything works. Most of the code below is just to support the quick way I set up the computer/memory-sticks, since I didn’t recall exactly what you had decided on that. Of course you’d need to adapt everything to your own goals, but this should give a guide of sorts:

[code]The testarea is a room. The description of the testarea is “Open the computer, insert the memory-stick into the computer, and then read the computer; after you exit the ‘computer’ menu, examine the memory stick to verify that the file_1 has been transferred (if you elected to copy it).”.

Include Menus by Emily Short.

A computer is a kind of thing.
A memory-stick is a kind of container. A memory-stick can be switched on or switched off. A memory-stick is usually switched off. The carrying capacity of a memory-stick is usually 0.

Instead of searching a memory-stick:
try examining the noun.

Check inserting something into a memory-stick:
say “You’d probably only damage [the noun] if you tried that.” instead.

A computer called a laptop is in the testarea. The laptop can be open or closed. The laptop can be openable. The laptop is closed and openable. Understand “computer” or “screen” as the laptop. The description of the laptop is “It’s Agent Wilson’s laptop computer. It’s currently [if closed]closed and turned off[otherwise]open and turned on[end if]. (The computer may be used by READing it.)”.

After opening the laptop:
say “You open the laptop computer and the screen lights up as it powers on.”.

After closing the laptop:
say “You close the laptop computer, turning it off.”.

Instead of switching on the laptop:
try opening the noun.

Instead of switching off the laptop:
try closing the noun.

A memory-stick called a blue memory stick is in the testarea. The description of the blue memory stick is “A small, portable flash drive. According to the tiny display on the side, [if the blue memory stick contains anything]it currently holds [a list of things in the item described][otherwise]it is currently empty[end if].”.

Rule for printing room description details: stop.
Rule for printing room description details of something: omit contents in listing.
The examine described devices rule is not listed in any rulebook.

Check switching on a memory-stick:
say “[The noun] will power up automatically when inserted into any compatible computer.” instead.

Check switching off a memory-stick:
say “[The noun] doesn’t have an internal power source; it’s on when inserted into a computer, and off at all other times.” instead.

Instead of inserting a memory-stick into a computer:
now the noun is incorporated by the second noun;
now the noun is switched on;
say “You plug [the noun] into [the second noun].”.

Instead of taking a memory-stick:
if the noun is incorporated by a computer:
say “You remove [the noun] from [the holder of the noun].”;
now the noun is switched off;
move the noun to the player;
otherwise:
continue the action.

Understand the command “read” as something new.

Reading is an action applying to one visible thing. Understand “read [something]” as reading.

Check reading something (this is the prevent useless reading rule):
say “[The noun] doesn’t have anything of interest written on it.” instead.

Procedural rule for reading the laptop: ignore the prevent useless reading rule.

Check reading the laptop:
if the noun is closed:
say “You’ll need to turn on the computer before you can use it.” instead.

Carry out reading the laptop:
change the current menu to the Table of Computer-Stuff01;
change the current menu title to “Directory of C: My Computer”;
carry out the displaying activity;
clear the screen.

A computer-file is a kind of thing.

Instead of doing anything to a computer-file:
say “And how do you propose to do that?”.

There is a computer-file called file_1.

Table of Computer-Stuff01
title subtable description toggle
“meganfox-bikini.jpg 147 kb” Table of Computer-Stuff02 – --
“temp.tmp 5.7 mb” Table of Computer-Stuff03 –
“topsecret.txt 936 kb” Table of Computer-Stuff04 – --

Table of Computer-Stuff02
title subtable description toggle
“View File” Table of Computer-Stuff02A – --
“Copy File to Memory Stick” Table of Computer-Stuff02B – --
“Delete File” – -- file02-erase rule

Table of Computer-Stuff02A
title subtable description toggle
“View Image File” – “[paragraph break]Your current version of Inform Picture Viewer is out of date. Please visit the Inform Corporation website to update your software.” –

Table of Computer-Stuff02B
title subtable description toggle
“[if the laptop incorporates a memory-stick]Copy File[otherwise]No memory stick detected[end if]” – “[paragraph break]Error copying file” –

File-02check is a number that varies. File-02check is usually 0.

This is the file02-erase rule:
if file-02check is 0:
choose row with title of “meganfox-bikini.jpg 147 kb” in the Table of Computer-Stuff01;
blank out the whole row;
sort the Table of Computer-Stuff01 in title order;
change file-02check to 1;
otherwise:
do nothing.

Table of Computer-Stuff03
title subtable description toggle
“View File” Table of Computer-Stuff03A – --
“Copy File to Memory Stick” Table of Computer-Stuff03B – --
“Delete File” – -- file03-erase rule

Table of Computer-Stuff03A
title subtable description toggle
“View Unknown File Type” – “[paragraph break]!@#$%^&()_+|}{:?><,./;’=-@#$%^&()+|}{:?><,./;=-@#$%^&*()+|}{:?><,./;’=-@#$%^&()_+|}{:?><,./;=-@#$%^&()_+|}{:?><,./;’=-” –

Table of Computer-Stuff03B
title subtable description toggle
“[if the laptop incorporates a memory-stick]Copy File[otherwise]No memory stick detected[end if]” – “[paragraph break]Error copying file” –

File-03check is a number that varies. File-03check is usually 0.

This is the file03-erase rule:
if file-03check is 0:
choose row with title of “temp.tmp 5.7 mb” in the Table of Computer-Stuff01;
blank out the whole row;
sort the Table of Computer-Stuff01 in title order;
change file-03check to 1;
otherwise:
do nothing.

Table of Computer-Stuff04
title subtable description toggle
“View File” Table of Computer-Stuff04A – --
“Copy File to Memory Stick” Table of Computer-Stuff04B – --
“Delete File” – -- file04-erase rule

Table of Computer-Stuff04A
title subtable description toggle
“View Text File” – “[paragraph break]Turkey trots to water. The pearl is in the river. Johnny has one red shoe. The moon is full tonight. Jeanine likes to tango. Patty likes green bicycles. The world wonders.” –

Table of Computer-Stuff04B
title subtable description toggle
“[if the laptop incorporates a memory-stick]Copy File[otherwise]No memory stick detected[end if]” – -- file04-copy rule

File-04check is a number that varies. File-04check is usually 0.

This is the file04-erase rule:
if file-04check is 0:
choose row with title of “topsecret.txt 936 kb” in the Table of Computer-Stuff01;
blank out the whole row;
change file-04check to 1;
sort the Table of Computer-Stuff01 in title order;
otherwise:
do nothing.

This is the file04-copy rule:
if file_1 is off-stage and the blue memory stick is incorporated by the laptop:
move file_1 to the blue memory stick;
otherwise:
do nothing.[/code]
Due to the way the forum works, if you copy/paste the above into Inform the Table Descriptions will be a real mess; just remember to remove any spaces and instead insert a ‘tab’ after each entry of each table line.

Cheers, guys. I think I’ll use Endosphere’s example, though thanks for the link to the other extension, George.

@Endosphere:

Thanks for the example! It was very funny, and showed me the best way to implement the transferring stuff using the ‘toggle’ function.

Thanks again,

Pe-ads

After using Menus and writing about a quarter of the needed code for it, I gave it a test run. IMHO, it’s a bit weird. It takes over the status line, and it comes out differently on different interpreters. So instead, I’ll try using Simple Chat, as it can be adapted to my needs fairly easily.