<function name="alias_function"><![CDATA[
msg ("What is your name? (6 character limit)")
get input {
player.alias = result
if (LengthOf (player.alias > 6)) {
alias_function // repeats the function, as the inputted name is too long: invalid character length for the name
}
}
]]></function>
// during game play, all the person would have to type is: aliasx
<command name="alias_command">
<pattern>aliasx</pattern>
<script>
alias_function
</script>
</command>
<function name="alias_function"><![CDATA[
msg ("What is your name? (6 character limit)")
get input {
player.alias = result
if (LengthOf (player.alias > 6)) {
alias_function // repeats the function, as the inputted name is too long: invalid character length for the name
}
}
]]></function>
The Pixie wrote:To add synonyms to a verb, select it in the left pane. On the right, it will say "Pattern: command pattern" with a text box underneath. List all the alternatives there (one will be there already), separated by semi-colons.
// conceptually, ie: a non-sensical Verb or Command: drink hamburger
if (HasString (this, "object_type_string")) {
if (this.object_type_string = "beverage") {
player.energy = player.energy + 50
}
}
// defaultexpression: No you can't drink that item.
<command name="dress_command">
<pattern>dress</pattern>
<script>
msg ("You dress up your child in some cute clothes for the family picture.")
</script>
</command>
OurJud wrote:Although I have another problem now. After the player has dressed, I want a different response if the player (for whatever reason) was to type 'wear clothes' again.
A 'first time/otherwise' script doesn't work, nor does a 'if player is carrying' script, because 'wear' isn't the same as 'take'.
<object name="orc">
<attr name="dead_boolean" type="boolean">false</attr>
</object>
<function name="fight_function">
if (orc.dead_boolean = true) {
msg ("The orc is already dead, silly.")
} else if (orc.dead_boolean = false) {
orc.dead_boolean = true
msg ("You attack the orc, killing it.")
}
</function>
<object name="child">
<attr name="dressed_boolean" type="boolean">false</attr>
</object>
<function name="dress_function">
if (child.dressed_boolean = true) {
msg ("The child is already dressed, silly.")
} else if (child.dressed_boolean = false) {
chld.dressed_boolean = true
msg ("You dress up your child in really cute clothes for the family picture.")
}
</function>
Silver wrote:"OurJud"
Although I have another problem now. After the player has dressed, I want a different response if the player (for whatever reason) was to type 'wear clothes' again.
A 'first time/otherwise' script doesn't work, nor does a 'if player is carrying' script, because 'wear' isn't the same as 'take'.
This is where you set and check for flags. So in the script 'wear clothes' you do this:
If object player has flag clothesworn then print "you are already wearing clothes"
Else print message "you slowly dress and feel much more comfortable now"
Set flag to object player clothesworn
OurJud wrote:Fair enough, Silver. As I said elsewhere I do like to try and do things differently. However, I accept there are certain rules, it's just a learning curve I suppose.
As for the other issue, I can't imagine why a player would type 'wear clothes' immediately after typing it in the first place, I just thought it would be cool if I could give a different response if they did.
I don't know if I'm alone in this, but I have a tendency to test the logic of TA games when I'm playing them. I like to type unusual things or try to 'take' an object twice, in the hope of getting a logical response. If I do, then I know the creator has gone to some trouble when building his world.
If I get the response, "You already have the key' on trying to take it a second time, I'm impressed. (although for 'take' I think this response is default anyway), but equally, trying to wear clothes twice (if only for people who like to test a game's logic) should get the response, "You're already wearing the clothes."
OurJud wrote:"Silver"
[quote="OurJud"]Although I have another problem now. After the player has dressed, I want a different response if the player (for whatever reason) was to type 'wear clothes' again.
A 'first time/otherwise' script doesn't work, nor does a 'if player is carrying' script, because 'wear' isn't the same as 'take'.
This is where you set and check for flags. So in the script 'wear clothes' you do this:
If object player has flag clothesworn then print "you are already wearing clothes"
Else print message "you slowly dress and feel much more comfortable now"
Set flag to object player clothesworn
Silver wrote:I'm assuming that you can now do scripts? Below the IF script options are other ones, one of which is the option to set a flag to any object and give it any name you like.
Silver wrote:The flag is part of the script. You select 'run script' instead of 'print message'. I'd do you an example but I've never come across anyone with so many questions in such a short space of time yet unable to grasp the answers.
OurJud wrote:Right, I'm going to tell you what I'm doing, in as much detail as possible:
1. I have an object that I have called clothes, parent is 'bedroom'
2. I select this object (clothes) in the left pane
3. I click the verbs tab and select 'wear' from the list (this gives me the option to change 'print message' to 'run a script')
4. I click 'Add new script' and select 'add flag to object'
5. I call this flag 'clotheson'
6. I click 'Add new script' and select 'if'
7. I set the if to : If object has flag (clothes) flagname (clotheson)
8. 'Add new script'
9. 'Print message'
10. "You are already wearing the clothes"
11. Else
12. 'Print message'
13. "You climb into the clothes."
When I run the game, the input "wear clothes' gets the response, "You're already wearing the clothes.
Silver wrote:
4. I click 'Add new script' and select 'add flag to object'
No. Because the first thing you do isn't to set the flag. You have to look for the flag first. Otherwise how do you check if the clothes are already worn?
So step 1. is If object player has flag clothesworn then print "you're already wearing them"
but the flag isn't set so the game will ignore that and move to else. So under else select print message and type "you put the clothes on".
under that you set the flag, because you have now put the clothes on. set flag clothesworn to player object.
Your thinking is right, but you have to reverse the logic.
OurJud wrote:ONE of the mistakes I was making was choosing 'clothes' from the dropdown box instead of 'player'.