Actions that apply to people, and indexed text

Greetings all,

I have a couple of questions (Inform 7). I am trying to add spellcasting to my game, and I am having a heck of a time with it. This is what I started off with:

Understand "cast [text] on [person]" as targetted casting.  Targetted casting is an action applying to one topic and one thing.

This runs the carry out text only when I cast on a person, but when I am doing the effects, the “noun” is always set to “nothing”.

Second question: I am messing around with indexed text for the first time. The spells are composed of a couple of subphrases that determines what happens when the spell goes off. Is there any more elegant way of selecting subphrases (that must match a specific keyword) than

Let L be the indexed text; if L matches the regular expression "^noko": replace character number 1 in L with ""; replace character number 1 in L with ""; replace character number 1 in L with ""; replace character number 1 in L with "";

just selecting the first subphrase and stripping it off character by character?

Thanks in advance.

I don’t have help to offer, but have you checked out the Spellcasting extension on the I7 website?

When you have an action of the form “applying to one topic and one thing”, what you end up with in your carry out rules is “the topic understood” and “the second noun”, rather than “the noun” and “the second noun”. So, if the player said “cast chumble spuzz on Bobby”, “chumble spuzz” would be the topic understood and Bobby would be the second noun.

Regarding subphrases, as long as the subphrases are divded from each other by word boundaries, you can just say “word number n in the topic understood”, where n is the word number you wish to examine.

You can say

replace the regular expression "^noko" in L with "";

I’m a noob, so this may be completely wrong, but with the (rudimentary) magic I used I made each spell a separate verb and had something along the lines of:
Understand “cast spell” as xyzzying.
Obviously with a subject it adds complexity, but I found creating new verbs for each spell much simpler (or at least within my limited skillset).

“The Second noun” did the trick for me, thank you.

I’d recommend making spells into kinds of value or things rather than topics. You’ll have more parsing power at your disposal, especially if you use things.