Version 1 of Editable Stored Actions by Ron Newcomb begins here. "This extension expands section 12.20 of Writing with Inform. The individual parts of a stored action -- actor, noun, second noun, action-name -- can now be directly changed. Also adds four new parts: request, text, participle, and preposition." Volume 1 - extension Editable Stored Actions Chapter 1 - actor part To change/now the/an/a/-- actor part of (act - a stored action) to/is (pop - a person that varies): (- (STORED_ACTION_TY_SetPart({-pointer-to:act}, 3, {pop})); -). To (pop - a person) is/to the/an/a/-- new/now/-- the/an/a/-- actor part/-- for/of (act - a stored action): (- (STORED_ACTION_TY_SetPart({-pointer-to:act}, 3, {pop})); -). Chapter 2 - action-name part To change/now the/an/a/-- action-name part of (act - a stored action) to/is (anp - an action-name): (- (STORED_ACTION_TY_SetPart({-pointer-to:act}, 0, {anp})); -). Chapter 3 - noun part To change/now the/an/a/-- noun part of (act - a stored action) to/is (obj - an object that varies): (- (STORED_ACTION_TY_SetPart({-pointer-to:act}, 1, {obj})); -). To (obj - an object) is/to the/an/a/-- new/now/-- the/an/a/-- noun part/-- for/of (act - a stored action): (- (STORED_ACTION_TY_SetPart({-pointer-to:act}, 1, {obj})); -). Chapter 4 - second noun part To change/now the/an/a/-- second noun part of (act - a stored action) to/is (obj - an object that varies): (- (STORED_ACTION_TY_SetPart({-pointer-to:act}, 2, {obj})); -). To (obj - an object) is/to the/an/a/-- new/now/-- the/an/a/-- second noun part/-- for/of (act - a stored action): (- (STORED_ACTION_TY_SetPart({-pointer-to:act}, 2, {obj})); -). Include (- [ STORED_ACTION_TY_SetPart stora ind val at ado n1 n2; at = FindAction(BlkValueRead(stora, 0)); if (ind == 1 or 2) { ! ignore setting Noun or Second Noun if the action doesn't call for nouns (i.e., Jump, Sleep..) if (ind == 1) ado = AD_NOUN_KOV; else ado = AD_SECOND_KOV; if ((at) && (ActionData-->(at+ado) ~= OBJECT_TY)) return; } if (ind == 0) { ! remember which noun types the previous action needed n1 = ActionData-->(at+AD_NOUN_KOV); n2 = ActionData-->(at+AD_SECOND_KOV); } BlkValueWrite(stora, ind, val); ! effect the change if (ind == 0) { ! after changing the action-name, blank out Noun & Second Noun if necessary at = FindAction(BlkValueRead(stora, 0)); if (at == 0) return; if (((ActionData-->(at+AD_REQUIREMENTS) & NEED_NOUN_ABIT) == 0) || (n1 ~= ActionData-->(at+AD_NOUN_KOV))) BlkValueWrite(stora, 1, 0); if (((ActionData-->(at+AD_REQUIREMENTS) & NEED_SECOND_ABIT) == 0) || (n2 ~= ActionData-->(at+AD_SECOND_KOV))) BlkValueWrite(stora, 2, 0); } ]; -). Chapter 5 - request part To decide if request part of (act - stored action): (- (STORED_ACTION_TY_Part({-pointer-to:act}, 4)) -). To change/now the/an/a/-- request part of (act - a stored action) to/is (b - a truth state): (- (STORED_ACTION_TY_SetPart({-pointer-to:act}, 4, {b})); -). Chapter 6 - topic part To decide what indexed text is text part of (act - stored action): (- (STORED_ACTION_TY_Part({-pointer-to:act}, 5)) -). [ [ broken ] To change/now the/an/a/-- text part of (act - a stored action) to/is (itxt - indexed text): (- (STORED_ACTION_TY_SetPart({-pointer-to:act}, 5, INDEXED_TEXT_TY_Create({itxt}))); -). ] Chapter 7 - participle part To decide what text is participle part/-- for/of (act - a stored action): (- ParticipleForAction({act}); -). Include (- [ ParticipleForAction stora ac; ac = FindAction(BlkValueRead(stora, 0)); if (ac == 0) return NULL; return ActionData-->(ac+AD_NAME_BASE); ]; -). Chapter 8 - preposition part To decide what text is preposition part/-- for/of (act - a stored action): (- PrepositionForAction({act}); -). Include (- [ PrepositionForAction stora ac; ac = FindAction(BlkValueRead(stora, 0)); if (ac == 0) return NULL; return ActionData-->(ac+AD_NAME_BASE+2); ]; -). Editable Stored Actions ends here. ---- DOCUMENTATION ---- This extension allows us to directly change the parts of a stored action. The standing orders are a stored action that varies. The soldier on point is a person that varies. Guarding it from is an action applying to one room and one direction. change the action-name part of the standing orders to the guarding it from action; change the actor part of the standing orders to the soldier on point; change the noun part of the standing orders to the battlefield; change the second noun part of the standing orders to north; This extension also exposes a few new parts of a stored action. Request can be changed as the previous four, but the other three parts are currently read-only. request part of S text part of S preposition part of S participle part of S The request part is an either/or property that differentiates between "Bob jumping" and "asking Bob to try jumping". (The latter rule, if executed, would first consult the persuasion rules. It is not referring to either of the asking actions in the Standard Rules "asking it for" or "asking it about".) The text part is only of interest to actions which apply to a topic. The text part stores the player's entire command, not just the topic part. If the action-name part of a stored action is changed, this obviously invalidates the text part. The preposition part returns the preposition used when the stored action is printed while storing a verb that applies to two things. For example, the "telling it about" action has "about" as its preposition. Similarly, the participle part would be "telling". The extension currently has a limitation regarding using constant values. The following will produce a compiler error: change the actor part of the standing orders to Charlie; Instead, a workaround is offered: Charlie is now the actor part of the standing orders; This limitation affects actor, noun, and second noun. We apologize for the inconvenience. Example: *** Editable Stored Actions - Allowing our player a CHANGE command similar to our own *: "Editable Stored Actions" Include Editable Stored Actions by Ron Newcomb. Section 1 - Basic setup The best idea yet is a stored action that varies. Place is a room. Bob and Joe are men in place. A rock is in place. Persuasion: rule succeeds. When play begins: now the best idea yet is the action of Bob giving the rock to Bob. Instead of looking: say "You see an action here: [bold type][the best idea yet][roman type]." Test me with "change the second noun to joe/do it/change the request to true/do it/change the second noun to me/l/change the action to jumping/jump/do it/eh/l/change the request to false/do it/l/x joe/do it/tell joe about stuff/do it/ask joe for rock/l/change the noun to rock/x noun/x second noun/do it/change second noun to rock/do it/x preposition/x participle/eh". Section 2 - The verbs DO IT, EXAMINE, and CHANGE Understand "do it" as executing. Executing is an action applying to nothing. Carry out executing: try the best idea yet. Understand "examine [text]" or "x [text]" as inspecting. Inspecting is an action applying to one topic. Carry out inspecting "prep/preposition": say "The preposition is [bold type][preposition part of the best idea yet][roman type]." Carry out inspecting "participle/name/action-name/action": say "The participle is [bold type][participle part of the best idea yet][roman type]." Carry out inspecting "topic/topical/text/textual": say "The topical part is [bold type][text part of the best idea yet][roman type]." Carry out inspecting "actor": say "The actor part is [bold type][actor part of the best idea yet][roman type]." Carry out inspecting "noun": say "The noun part is [bold type][noun part of the best idea yet][roman type]." Carry out inspecting "second noun": say "The second noun part is [bold type][second noun part of the best idea yet][roman type]." Carry out inspecting "request": say "The request part is [bold type][if request part of the best idea yet]true[else]false[end if][roman type]." Understand "change [text] to [any thing]" as changing it to. Changing it to is an action applying to one topic and one visible thing. Check changing "actor" to: if the second noun is not a person, say "Actors must be people." instead. Carry out changing "actor" to: change the actor part of the best idea yet to the second noun. Carry out changing "noun" to: change the noun part of the best idea yet to the second noun. Carry out changing "second noun" to: change the second noun part of the best idea yet to the second noun. Carry out changing "request" to truth: change the request part of the best idea yet to true. Carry out changing "request" to falsehood: change the request part of the best idea yet to false. Report changing it to: say "The best idea yet has been changed to [bold type][The best idea yet][roman type]." Section 3 - CHANGE an action-name Understand "change action/name/action-name [text]" as a mistake ("To change the stored action's action-name, try to do that action. For example, JUMP will change the action-name part to the jumping action. (Sorry, parser difficulty.)"). Instead of doing something except executing, inspecting, or looking when the current action is not changing to: change the action-name part of the best idea yet to the action-name part of the current action; say "The action-name part (only!) has been changed, yielding [bold type][the best idea yet][roman type]." Section 4 - Niceties, workarounds, and debugging The block giving rule is not listed in any rulebook. Instead of someone jumping: say "[Actor] leaps high into the air." Truth and falsehood are things. Understand "true/yes" as truth. Understand "false/no" as falsehood. After reading a command when the player's command includes "the": cut the matched text. [Every turn: change the action-name part of the best idea yet to the taking action; Bob is now the actor part of the best idea yet.] Understand "eh" as a mistake ("actor: [actor part of the best idea yet][line break]action-name: [action-name part of the best idea yet][line break]noun: [noun part of the best idea yet][line break]second noun: [second noun part of the best idea yet][line break]request? [if request part of the best idea yet]yes[else]no[end if][line break]topic: [the text part of the best idea yet][line break]participle: [participle part of the best idea yet][line break]preposition: [preposition part of the best idea yet]").