Scroll Thief — 43 of 138

Daniel M. Stelzer

Release 2

Book T - Testing Action Success

Include (-

Global saved_action_success = 0;

-) after "Definitions.i6t".

Include (-

[ RecordTryAction req by ac n s stora smeta tbits saved_command text_of_command;

if (stora) return STORED_ACTION_TY_New(ac, n, s, by, req, stora);

tbits = req & (16+32);

req = req & 1;

@push actor; @push act_requester; @push inp1; @push inp2;

@push parsed_number; smeta = meta;

actor = by; if (req) act_requester = player; else act_requester = 0;

by = FindAction(ac);

if (by) {

if (ActionData-->(by+AD_NOUN_KOV) == OBJECT_TY) inp1 = n;

else { inp1 = 1; parsed_number = n; }

if (ActionData-->(by+AD_SECOND_KOV) == OBJECT_TY) inp2 = s;

else { inp2 = 1; parsed_number = s; }

if (((ActionData-->(by+AD_NOUN_KOV) == UNDERSTANDING_TY) ||

(ActionData-->(by+AD_SECOND_KOV) == UNDERSTANDING_TY)) && (tbits)) {

saved_command = BlkValueCreate(TEXT_TY);

BlkValueCast(saved_command, SNIPPET_TY, players_command);

text_of_command = BlkValueCreate(TEXT_TY);

BlkValueCopy(text_of_command, parsed_number);

SetPlayersCommand(text_of_command);

if (tbits == 16) {

n = players_command; inp1 = 1; parsed_number = players_command;

} else {

s = players_command; inp2 = 1; parsed_number = players_command;

}

BlkValueFree(text_of_command);

@push consult_from; @push consult_words;

consult_from = 1; consult_words = parsed_number - 100;

}

}

saved_action_success = BeginAction(ac, n, s, 0, true);

if (saved_command) {

@pull consult_words; @pull consult_from;

SetPlayersCommand(saved_command);

BlkValueFree(saved_command);

}

meta = smeta; @pull parsed_number;

@pull inp2; @pull inp1; @pull act_requester; @pull actor;

TrackActions(true, smeta);

];

-) after "Actions.i6t".

To record the outcome of (doing something - action):

(- Record{doing something}; -).

To record the outcome of (doing something - action) silently:

(- @push keep_silent; keep_silent=1; @push say__p; @push say__pc;

ClearParagraphing(); Record{doing something}; DivideParagraphPoint();

@pull say__pc; @pull say__p; AdjustParagraphPoint(); @pull keep_silent; -).

To decide whether the action succeeded:

(- saved_action_success == 1 -).

To decide whether the action failed:

(- saved_action_success == 0 -).