Hi! I’ve had the idea to program an EAMON-like (text-based RPG) for a while now, and have settled upon I7 as my tool to do this.
I’ve had some experience with I7, and decided to pick it back up for this project, but already I’ve run into problems (of course.)
It seems I’ve defined some new actions correctly, (that is, I don’t get any errors with those (yet) when I (attempt) to run my code), but new qualities of objects seem to be my bane. Or rather, knowing the code to recognize and output them.
My question to you learned minds of I7 is, quite simply, “Why doesn’t this work when it looks to me like it should work?” (A rather unique question most assuredly never asked before, I might add!)
What I’ve done in the code is given the player a weapon, which has a list of attacks possible with it and is wearable.
For testing purposes, every turn (if the player has it worn), I’d like to print the name of the weapon and that list of attacks.
The way I’ve got it set up doesn’t seem to be doing much of anything except throwing errors.
My code is here:
The arena is a room.
A skeleton is in the room.
[waking up the monsters and reticulating splines]
A weapon is a kind of thing. A weapon has a list of text called an attacktypelist. A weapon is wearable.
[Here is defined a weapon and how it interacts with the player. The player can only attack with it in the fashions defined in its "attacktypelist"]
A longsword is a kind of weapon. The attacktypelist of the longsword is {"hack","slash","stab"}.
A rapier is a kind of weapon. The attacktypelist of the rapier is {"slash","stab"}.
After wearing a weapon, say "You hold the [the weapon which is worn by the player] in your hand."
[this is mainly for testing purposes, to see if the player's weapon can be said.]
every turn:
say "The weapon is: [the weapon which is worn by the player]. The attacks available are [list of texts in the attacktypelist of the weapon which is worn by the player]."
[this is also for testing, to see if the attacktypelist of the player's weapon can be said.]
The player carries a longsword.
The player carries a rapier.
[giving the items to the player]
Hacking it in the is an action applying to two things. [e.g., "hack the skeleton in the arm"]
Stabbing it in the is an action applying to two things.
Slashing it in the is an action applying to two things.
Understand "hack [something] in the [something]" as hacking it in the.
Understand "stab [something] in the [something]" as stabbing it in the.
Understand "slash [something] in the [something]" as slashing it in the.
[Before hacking it in the, unless hack is in the attacktypelist of the current weapon, say "You can't attack that way with a [the current weapon]."; otherwise, say "You hack [the noun]."
Before slashing it in the, unless slash is in the attacktypelist of the current weapon, say "You can't attack that way with a [the current weapon]."; otherwise, say "You slash [the noun] in the [the second noun]."
Before stabbing it in the, unless hack is in the attacktypelist of the current weapon, say "You can't attack that way with a [the current weapon]."; otherwise, say "You stab [the noun] in the [the second noun]."]
[the above commented-out code is a whole 'nother beast, somehow.][/code]
And the errors given to me are here:
[code]This is the report produced by Inform 7 (build 6G60) on its most recent run through:
Problem. You wrote 'say "The weapon is: [the weapon which i [...] apon which is worn by the player]."' , and in particular 'the weapon which is worn by the player': but this asked to say something which describes items too vaguely, and so does not (or not in an elementary enough way) tell me exactly which thing or room should have its name printed.
I was trying to match one of these phrases:
1. say ""The weapon is: " - text"
2. say "[the weapon which is worn by the player - object]"
3. say "weapon which is worn by the player - text"
4. say "[weapon which is worn by the player - number]"
5. say "[weapon which is worn by the player - unicode character]"
6. say "[weapon which is worn by the player - sayable value]"
7. say "". The attacks available are " - text"
8. say "[list of texts in the attacktypelist of the weapon which is worn by the player - description of objects]"
9. say "list of texts in the attacktypelist of the weapon which is worn by the player - text"
10. say "[list of texts in the attacktypelist of the weapon which is worn by the player - number]"
11. say "[list of texts in the attacktypelist of the weapon which is worn by the player - unicode character]"
12. say "[list of texts in the attacktypelist of the weapon which is worn by the player - sayable value]"
13. say ""." - text"
This was what I found out:
weapon which is worn by the player = a description of weapons
texts in the attacktypelist of the weapon which is worn by the player = a description of texts
list of texts in the attacktypelist of the weapon which is worn by the player = an instruction to work out a value, which results in a value
--------------------------------------------------------------------------------
Problem. You wrote 'say "You hold the [the weapon which is worn by the player] in your hand."' , and in particular 'the weapon which is worn by the player': again, this asked to say something which describes items too vaguely.
I was trying to match one of these phrases:
1. say ""You hold the " - text"
2. say "[the weapon which is worn by the player - object]"
3. say "weapon which is worn by the player - text"
4. say "[weapon which is worn by the player - number]"
5. say "[weapon which is worn by the player - unicode character]"
6. say "[weapon which is worn by the player - sayable value]"
7. say "" in your hand." - text"
This was what I found out:
weapon which is worn by the player = a description of weapons
So, from the code and the errors given, what could be my problem? I appreciate any and all of you who look into this or give me a sharp smacking of “RTFM”!