Yaffaif Debug Mode
Yaffaif has a debug mode that makes a number of changes to the game. It is intended for debugging, obviously, but at this early stage can be used to experiment. It is not practical to list all the things you can do in debug mode, as there are many thousands of things you can change.
What debug mode does
Debug mode makes four changes to the way the game works:
The game starts in a test room instead of your house. These test rooms have a varying collection of test items and characters in them. There is a one-way portal to the real game start.
A debug button appears in the menu of the user interface. When pressed this launches a graphical explorer of the game model. You can also change settings via this interface.
The command text input recognises any text beginning with '/' or '~' as console commands. These have their own parser and syntax described below.
Debug log information is written to the terminal where Yaffaif was invoked. This gives detailed information about the operation of the code. If the game was launched from a file browser this is not visible.
How to configure debug mode
There are two ways to start the game in debug mode:
From the command line
The simplest way to launch in debug mode is to use the
scripts startDebug.bat (Windows)
or startDebug.sh from a shell prompt (OSX, Linux, Unix).
Both of these pass the argument --debug
to the game forcing it into debug mode.
From a property file
When Yaffaif starts it looks for a property file in the user's home directory. If the file is present it reads it in. The location of the file is mentioned when running the game from a terminal.
On Linux and Mac OSX the file is called .gamefx2.props in your home directory and because of the initial '.' won't normally appear in directory listings. On Windows the file is called gamefx2.props without the initial '.'. Windows is less consistent about where a user's home directory is. On recent versions it is often where you'll also find "Downloads", "My Music", and "My Pictures". If you are not sure where the file should be put then launch the game from the start.bat file, or run the game from a terminal as described in the install troubleshooting guide.
Note: The file must have the extension .props
,
not .props.txt
. Make
sure you can see the file name extension in your file
browser. On recent windows versions click on "View" and
check the box for "File name extensions".
To enable debug create this file with a text editor and add the single line:
debug.enable=true
It will take effect next time the game is started.
To turn debug off, delete the file or just change the
true
to false
.
Debug Button
The debug button is in the menu area between the new game
and load buttons. Pressing it pops up a new window over
the top of the game window, just move it to one side.
On the left hand side is a triangle next to the word
Game
. Clicking on the triangle shows the members
of the Game node. Similarly, expand the
Area:testArea
and
Location:testArea.kitchen
.
Expanding the location will show all the things in
that location.
Click on
Item:testArea.kitchen.torch
.
The right hand side now show the various attributes of the
torch:
Some of the attributes of the torch are read-only like
Id
and Class
. Others, like Desc
can be altered.
As an experiment, enter "a cheap plastic model with a dead battery"
in the Desc
field and press return, then un-check the
LightSource
box. In the game, try looking at the torch,
it's description should have changed. It also won't help much in
the dark.
Try expanding
IntelPerson:val1.home.main.player
; the player character.
This will
show your inventory. Clicking on
IntelPerson:val1.home.main.player
will show your details in the right hand pane.
At this point the window will need to be expanded.
Characters have many nested objects shown by the rectangles.
There are all sorts of things you could alter here. If you make changes they won't automatically change the tabs in the Stats area, you'll need to perform an action, such as looking at yourself first.
Console commands
All console commands are entered in the command text box and start with / or ~. The next character determines the operation:
Character | Operation |
---|---|
? | query |
= | assign |
> | goto |
+ | creation |
d | dictionary |
g | garbage/free memory |
h | fault history |
i | object ids |
t | tokens |
v | verbs |
w | watch toggle |
The query and assign operations need parameters that identify an object in the game, and then a getter/setter for that object.
-
$0
refers to the current player -
/
refers to the GameSpace, which is the root of all items and areas -
A name in square brackets
(such as
[val1.village.hospital.kerry]
) refers to an item/person by its id. Ids are typically formed from the initial area names "val1", "village", the location "hospital", and the object id "kerry" separated by '.'s.
Some detail of the structure of the game can be had by using the debug button. You can also open open the GameF.jar file in an archive utility (rather than running the game) and looking at the game.xml file, and those it includes in the area directory.
A complete understanding of the various getters and setters really needs access to the Javadoc which is available with the Patreon "Experimenter" tier and above.
Get Values
Use the query ? operator to display values.
Getters can be chained by separating names with .
's.
How long is your hair?
/?$0.body.head.hair.lengthMm
+ $0.body.head.hair.lengthMm=30
How heavy are your boobs (total) in grams?
/?$0.body.bust.mass
+ $0.body.bust.mass=1515
How heavy are Kerry's boobs?
/?[val1.village.hospital.kerry].body.bust.mass
+ [val1.village.hospital.kerry].body.bust.mass=7579
Set Values
Use the assignment = operator to set values.
The part after the last .
is the variable to set.
The new value is supplied as a parameter in brackets.
The console performs auto type conversion as best it can to
strings, integers, booleans, and enums.
Note: Upper bounds to most numeric variables is
Integer.MAX
(2147483647)
Other objects can be referred to as parameters using the
/
, $
, or []
syntax.
Multiple parameters can be separated by ,
.
Internally these are converted to calls to getters and setters so
body.bust.mass(2000)
becomes
getBody().getBust().setMass(2000)
.
If the setter does not exist then an attempt is made to find a method
without the "set" prefix. So it is possible to call many other methods
this way.
You can get into a lot of strange (potentially game-breaking) situations using the assignment operator!
Transform your eyes into feline ones:
/=$0.body.head.eyes.species(cat)
+ $0.body.head.eyes.species(cat) returned true
Start lactating:
/=$0.body.bust.lactating(true)
+ $0.body.bust.lactating(true) returned true
Glow-in-the-dark player who never needs torches:
/=$0.lightSource(true)
+ $0.lightSource(true) returned true
A pair of immobilising monster cocks (only use on a male/herm)
/=$0.body.genitals.male.erectLength(4000) + $0.body.genitals.male.erectLength(4000) returned true /=$0.body.genitals.male.erectWidth(1100) + $0.body.genitals.male.erectWidth(1100) returned true /=$0.body.genitals.male.number(2) + $0.body.genitals.male.number(2) returned true
Changing the player character to one of the NPCs: NOTE: Here be dragons; may break quests.
/=/player([val1.village.hospital.kerry])
+ /player([val1.village.hospital.kerry]) returned true
Or
/=/player([val1.village.pub.arthur])
/=/player([val1.mine.entCham.rochaine])
And back (best put the NPC where you found them first):
/=/player([val1.home.main.player])
Moving
Use the goto > operator to teleport. This bypasses all the checks normally performed with movement (combat, mobility, exits).
/>val1.mine.entrance
You leave the main room.
-- Mine entrance --
You are standing in the entrance to the old mine workings. Ferns and
small plants grow on the damp rough hewn walls where daylight penetrates.
Within a short distance the vegetation gives way to dark stone. The tunnel
stretches on into the hillside. There is a doorway, SouthEast, to the valley
head. There is a tunnel to the NorthWest.
Creation
Use the add + operator to create items from factories The created item will be on the floor in the player's location.
A bacon butty:
/+food,baconButty
+ created Food:console1
The id of the new item is reported after the class name and the colon, so you can modify it using assign:
Give it a new id (change "console1" as needed):
/=[console1].id(mybutty)
+ [console1].id(mybutty) returned true
And a silly number of calories:
/=[mybutty].kcals(1000000)
+ [mybutty].kcals(1000000) returned true
A healing potion:
/+potion,healingPotion
+ created HealingPotion:console2
Make it maximum potency (change "console2" as needed):
/=[console2].potency(1000)
A new weapon:
/+weapon,broadSword
Make some male clothes:
/+clothing,underpants /+clothing,trousers /+clothing,stringVest /+clothing,flatCap /+clothing,boots /+clothing,shirt
Clothing created this way will always fit you when you first wear it. Once you do it auto-fits to your current size.
Dictionary
Dumps the complete list of "words" the game parser recognises. Some words are actually short phrases, such as "ash blonde". The dictionary includes variants of words such as plurals of nouns, tenses of verbs, some of which are auto-generated. There may be occasional spelling errors in the list which the command is used to identify.
Garbage/Free Memory
Runs the garbage collector and then reports how much Java memory the game is using and has free. This won't tally with the memory use reported by your operating system.
Fault History
Lists any faults and exceptions that have been recorded while playing the game. This is primarily intended for developer use.
Object IDs
Lists all the object IDs present in the game and what kind of thing they are.
Tokens
Lists the parser tokens for the words in the dictionary. Some words have multiple token matches, for example "orange" can be an adjective or a noun, and "pick" can be a verb or a noun.
Verbs
Dumps the complete list of verbs the game parser recognises. The dictionary includes variants of verbs such as tenses, some of which are auto-generated. There may be occasional spelling errors in the list which the command is used to identify.
Watch toggle
Take a fully qualified class name as a parameter and toggles the debugging of instances of that class. Debug information is written to stdout as usual and will only be visible if run from a shell/command prompt.
/w gamef.util.ReflectUtilEval
+ Debug turned on for gamef.ReflectUtilEval