by Bainespal » Fri Aug 26, 2011 4:25 am
Arrays are one programming construct that I never understood very well in either Hugo or Inform. Right now, I'm trying to make two scenery objects with blank noun and adjective properties, and then to assign dictionary words at a point in the game so that the player will be able to refer to these objects at the right time but not before. I can't simply move the objects to the location when I need them, because they both span two or more rooms, using the found_in property. So, I leave them alone but don't mention them or give them any keywords until I'm ready to set them up.
I saved the lists of keywords that I want to end up as nouns/adjectives for the objects into four arrays -- one for each object's noun and adjective properties. I tried making the noun and adjective properties routines that would return the arrays if the right condition was met or would return false otherwise. Then I tried leaving the noun and adjective properties completely empty (nothing but a new line after the word "noun" in the code) and assigning their values to the arrays in a different routine somewhere.
Looking to the
Hugo Book, I saw where it says that "entire arrays passed as arguments" are illegal. Then, I tried setting each keyword one at a time in the routine that makes the changes to the game state when the two scenery objects become available to the player. I left blank "slots" in the noun/adjective property definitions, like this:
Then I tried setting them with something like this:
Code: Select all
object.noun[0] = "sky": object.noun[1] = "sun": object.noun[2] = "clouds"
That still didn't work. It doesn't even give any different results at all then my previous attempts did.
Thank you, and sorry for being so long-winded. I'm being a little ambiguous about the content of my project because I'm holding out for a slim hope of entering it in the IF Comp if I get done in time.
Arrays are one programming construct that I never understood very well in either Hugo or Inform. Right now, I'm trying to make two scenery objects with blank noun and adjective properties, and then to assign dictionary words at a point in the game so that the player will be able to refer to these objects at the right time but not before. I can't simply move the objects to the location when I need them, because they both span two or more rooms, using the found_in property. So, I leave them alone but don't mention them or give them any keywords until I'm ready to set them up.
I saved the lists of keywords that I want to end up as nouns/adjectives for the objects into four arrays -- one for each object's noun and adjective properties. I tried making the noun and adjective properties routines that would return the arrays if the right condition was met or would return false otherwise. Then I tried leaving the noun and adjective properties completely empty (nothing but a new line after the word "noun" in the code) and assigning their values to the arrays in a different routine somewhere.
Looking to the [i]Hugo Book[/i], I saw where it says that "entire arrays passed as arguments" are illegal. Then, I tried setting each keyword one at a time in the routine that makes the changes to the game state when the two scenery objects become available to the player. I left blank "slots" in the noun/adjective property definitions, like this:
[code]noun 0, 0, 0, 0[/code]
Then I tried setting them with something like this:
[code]object.noun[0] = "sky": object.noun[1] = "sun": object.noun[2] = "clouds"[/code]
That still didn't work. It doesn't even give any different results at all then my previous attempts did.
Thank you, and sorry for being so long-winded. I'm being a little ambiguous about the content of my project because I'm holding out for a slim hope of entering it in the IF Comp if I get done in time.