[Adventuron] Printing the contents of a variable

Displaying the value of a variable seems to be buggy if it is not framed by a string.

start_at = village
locations {
   village  : location "You are in the village. Type SCORE to see your score." ;
}
integers {
   score : integer "0" ;
}
on_command {
   : match "score _"  {
      : print {(score)}
   }
}

Works with: print {(""+score+"")}

Known issue. “Expression form” does not auto cast from integer to string. I will fix.

Regular tokenized string form does howeever.

: print “{score}”;

Thank you.
A small side question, how do I display the noun typed by the player? I’m trying to find equivalences between the instructions of the Scott Adams games (SAGA) and Adventuron.

: print {(original_noun1())}; for the first noun and : print {(original_noun2())}; for the second, i.e. after a proposition. These will be lower case, though. You can modify the case if you need to.

Thank you, I thought it was possible, but it doesn’t appear in the documentation. It must have been mentioned in one of the game jam forums.
There is a “SAGA” instruction that I have trouble reproducing with Adventuron:

75 BYx<-x
Put the Par #1 object in the same place as the Par #2 object. If the Par #2 object is being carried, this will pick up the Par #1 object too, regardless of the carry limit. If this changes the objects in the current room, the room will be displayed again.

I can get the parent of object 2 in a variable, but I don’t know how to use it?

: set_string var = "my_string_variable"  {( parent_of "object2" )}
: create "object1"  target ="my_string_variable";  (does not work)

Certain attributes in certain commands can be provided in their longform.

To access the longform of a command, strip the command of all of their attributes, then create { and } characters.

e.g.

: create {
   // TODO :: Press Control + Space on blank lines here to access attributes
}

On blank lines you will be presented with attributes of the command.

The code completion does not present it - but some attributes can have their attributes provided by expression rather than by explicit value.

Dynamic attibutes can be provided in the following form

key -> ( some_expression )

e.g.

In the simple case (key + fixed value), you could write

// Sets the target to be the entity with id, teleport_pad 
target = teleport_pad

Or you could do the following (expression form between the ( ) ).

   // Sets the target entity to be the parent (location or entity) of entity with id of "teleport_pad"
   target -> (
            parent_of "teleport_pad"
         )

This is not very well documented at the moment, but it is available in a lot of places, and if you follow this method, the editor will tell you which attributes allow dynamic expressions.

To put this in context, here is a complete example of how to solve your problem:

start_at = lakeside

locations {
   lakeside       : location "You are by the side of a lake.";
   forest         : location "You are in a forest." ;
   treetop        : location "You are in a treetop." ;
   outside_castle : location "You are outside the castle." ;
   castle         : location "You are inside the castle." ;
}

connections {
   from, direction, to = [
      lakeside,       north, outside_castle, 
      outside_castle, north, castle, 
      lakeside,       east,  forest, 
      forest,         up,    treetop, 
   ]
}

objects {
   lamp         : object  "a lamp" at = "inventory" ;
   teleport_pad : object "a teleport pad" at = "forest" ;
}

on_command {
   : match "test _"  {
      : print "The lamp will be sent to the parent location of the teleport pad." ;
      : create {
         entity = lamp
         target -> (
            parent_of "teleport_pad"
         )
      }
   }
}
1 Like

That’s an understatement. I just searched the user guide and the cookbook and the string ‘->’ does not appear in either of them. I never cease to be amazed at the secret features hidden away in Adventuron.

Thank you both. Not everything is documented, but with what is already documented, there is plenty to do, and have fun with.