Is it possile to issue a player command inside source code?


I would like to display the descrption of the player at particular points in the game, sometimes as hints other times as something serious has happened to them.

I have created a check for examining the player which does this and typing look at me, examine me etc displays the description.

It will be a real pain having to duplicate this code each time I want to display the players description so how can I do this? I cannot find a way of making this code a ‘callable’ block (ike a procedure or function in say C), Is there a way of ‘running’ a player command like examine me from inside the source, or is there another way of doing this?

Thanks in advance.

Yep. Super-easy.

try examining the player;

…by using ‘try’, actions effectively become a callable block. (Rulebooks and activities behave in a similar way, though with different syntax; you don’t need to use an action whenever you want a callable block.)

Many thanks, I wish everything was so simple - and that google would be a bit more helpful.

Although try something works I have some commands that I have changed so they say things depending on a previous action. I would like to still use these as silent commands, but am still getting the ‘say’ bit displayed when I silently try.

For example the player is blindfolded at the start but does not know this. They can find out by touching their eyes (there are clues that something is over them) or take a punt if they have worked it out and just remove blindfold.

The code for removing the blindfold is below;

check taking off the blindfold: if your eyes are not touched begin; say "Realising that the presure on your eyes could be a blindfold you carefully feel them to check."; silently try touching your eyes; try taking off the blindfold; stop the action; end if;

So the player types remove blindfold, gets the text ‘Realising…’ and then the code runs the bit that touches their eyes. I do this as I then run the taking off bit again and fear an infinte loop.

Problem is the code for touching your eyes says the description of the blindfold so the result looks odd

What I’d like to have is ‘Realising that the pressure in your eyes is probably a blindfold you remove it.’ without the stuff about what the blindfold feels like or the fact that you have taken it off (we know we have).

I thought I could set a boolian up called hush and simply test it somehow but this is just not working - I cannot even set the boolean up!

hush  is a boolean that is usually true

errors out as does every combination I have tried. ( hush is a boolean value that varies, hush = true and so on)

I’m not even sure you can then go on to have

instead of saying:
if hush is not true then say [no idea what to put here!];

Any suggestions?

‘Silently’ only maintains silence if an action succeeds. A check rule prevents it from succeeding. (The usual way that ‘silently’ is used is for implicit actions, like opening a door before going in a direction; if opening the door fails, the player needs to be told about that.)

Inform doesn’t call it a ‘boolean’; it calls it a ‘truth state’. You’d want to set it up as a value that varies:

hush is a truth state that varies. hush is true.

(‘Usually’ isn’t appropriate here, because ‘usually’ is really only for kinds: when we’re talking about one specific value, Inform needs to be given a specific answer.)

Rather than running the taking-off action again, you should use ‘continue the action’. However, you’re not really using a check rule in the way that they’re intended, here. Check rules are meant to see whether there’s any good reason to stop the action; before rules are more suited to the take-another-action-first kind of thing that you want to do.
I’d probably do it something like this:

Before taking off the blindfold: if your eyes are not touched begin; say "Realising that the pressure on your eyes could be a blindfold, you carefully feel them to check."; now your eyes are touched; end if;

Not trying to be a douche here, but you seem to have spell-checked your forum posts but not the game text? I only mention this because your game sounds interesting and it would be a shame to spoil the immersion with typos.