Hey guys, I’m working on an easy way to detect if the player carries most of a set of items using variables attached to them only. The sets remain the same, but the items themselves change. What I really want to do is set up some standard definitions such as:
Definition: A person is pretty squiffy if most of the change objects carried by the player are squiffy.
This actually compiled the first time, but when I tested it with a 100% squiffy set the check read ‘false’ every time. Does anyone have any ideas?
You might need to do this in a slightly roundabout way.
Definition: a person (called the subject) is pretty squiffy if the number of squiffy change objects carried by the subject is greater than the number of unsquiffy change objects carried by the subject.
Or, less concise but more readable
Definition: a person (called the subject) is pretty squiffy:
let X be the number of squiffy change objects carried by the subject;
let Y be the number of unsquiffy change objects carried by the subject;
if X is greater than Y, yes;
no.
Thanks, but I’m having problems with it. I tried it on a set that were all squiffy and I couldn’t get the game to trigger the events that are supposed to happen when most of them are. I got the game to write [the number of squiffy objects that are carried by the player] but it came out as 0.
Each of my objects can hold one of about ten different variables, if that helps.
What’s your code that makes the objects squiffy? Sometimes there can be subtle errors there, like if you set squiffy to be a value that a property of the thing can have then the objects won’t be considered squiffy even if intuitively it seems like they should. (That particular thing is probably not what’s happening here, but it looks like the problem is that the objects aren’t coming out squiffy–the “most of” construction should be fine.)
change object is a kind of thing. ChangeType is a kind of value. The ChangeType are squiffy…etc…
I’m kinda puzzled because I know that’s working since I can detect the ChangeType of a given object. I just can’t seem to work out what ratio the types are, which is what I really need them for.
Well, it seems to me that “squiffy” isn’t an adjective applying to a ChangeType but a value–so the thing that comes out true wouldn’t be “if the foo is squiffy” but “if the ChangeType of the foo is squiffy.”
I think (but I don’t have Inform up so I’m not sure) you can overload the word “squiffy” and turn it into an adjective of objects like this:
Definition: a thing (called the item) is squiffy if the ChangeType of the item is squiffy.
Then you can talk about “squiffy things” and test “if the foo is squiffy” and like that.
Thanks for your help, but looks like that doesn’t work. The definition you give seems to be conflicting with the list of values applied to the items, so I can only get it to compile if I do this:
Definition: a thing (called the item) is squiffyType if the ChangeType of the item is squiffy.
Can you think of a way round this as changing everything at this stage will mean a lot of work?
Sorry… if it’s a namespace clash (you can’t use the same word for the adjective and the property) then I think you’ll have to go through and change “squiffy” to “squiffytype” where it applies. The IDE (at least for Macs) does let you do this relatively easily–if you do a “replace” you can stay in the window and choose “Find Next” when it’s an instance you don’t want to change and “Replace” when it’s one you do want to change.
"Scenes from the Class Struggle" by Roger Carbol
Worth is a kind of value. The worths are trashy, hipster, mainstream, trendy and elegant. Everything has a worth.
Definition: A person is uppercrust if most of the things carried by him are elegant.
[Note: This will NOT work:
Definition: A person is elegant if most of the things carried by him are elegant.
]
Carry out examining the player (this is the classy self-examining rule):
if the noun provides the property description and the description of the noun is not "":
say "[description of the noun][if the noun is uppercrust] Your possessions give you an air of respectability.[otherwise][line break][end if]";
now examine text printed is true;
stop the action.
There is room.
The champagne is here. The champagne is elegant.
The merlot is here. The merlot is trendy.
The nice beer is here. The nice beer is mainstream.
The cheap beer is here. The cheap beer is hipster.
The rotgut is here. The rotgut is trashy.
The expensive purse is here. The expensive purse is elegant.
The leather satchel is here. The leather satchel is trendy.
The briefcase is here. The briefcase is mainstream.
The courier bag is here. The courier bag is hipster.
The burlap sack is here. The burlap sack is trashy.
test me with "x me / take champagne / x me / take rotgut / x me / take purse / x me"
Here’s an alternate implementation that might be closer to your preferred idioms:
"Scenes from the Class Struggle, Take Two" by Roger Carbol
Worth is a kind of value. The worths are trashy, hipster, mainstream, trendy, elegant and inelegant. Everything has a worth.
Every turn:
if most of the things carried by the player are elegant:
now the player is elegant;
otherwise:
now the player is inelegant.
Carry out examining the player (this is the classy self-examining rule):
if the noun provides the property description and the description of the noun is not "":
say "[description of the noun][if the noun is elegant] Your possessions give you an air of respectability.[otherwise][line break][end if]";
now examine text printed is true;
stop the action.
There is room.
The champagne is here. The champagne is elegant.
The merlot is here. The merlot is trendy.
The nice beer is here. The nice beer is mainstream.
The cheap beer is here. The cheap beer is hipster.
The rotgut is here. The rotgut is trashy.
The expensive purse is here. The expensive purse is elegant.
The leather satchel is here. The leather satchel is trendy.
The briefcase is here. The briefcase is mainstream.
The courier bag is here. The courier bag is hipster.
The burlap sack is here. The burlap sack is trashy.
test me with "x me / take champagne / x me / take rotgut / x me / take purse / x me"
I just can’t get any ‘mostly’ command to work, if I check for someone being ‘mostly squiffy’ using definitions, or check ‘if most of the things carried by the player are elegant:’ it always gives me the ‘otherwise’ result right at the bottom.