| /* | |
| ============================================================================== | |
| = ANSWERME.T = | |
| = = | |
| = Author: Scott Steinfath = | |
| = = | |
| = Purpose: Code to allow answers to questions asked by the game itself. = | |
| = It also disallows the specialized response after 1 turn, which = | |
| = in this case it displays a default message. = | |
| = = | |
| = Creation Date: January 25th, 1994 = | |
| = = | |
| = Modification History: = | |
| = = | |
| = None = | |
| = = | |
| = NOTE: If you have any questions or comments regarding this "feature", = | |
| = drop me E-MAIL on High Energy BBS, or America Online; screen name = | |
| = "ELFVAPOUR". = | |
| ============================================================================== | |
| */ | |
| /* | |
| ============================================================================ | |
| = Example code for your "doMethod" processing = | |
| ============================================================================ | |
| */ | |
| doAttack( actor ) = | |
| { | |
| if ( self = dragon ) /* Player is trying to attack a dragon */ | |
| { | |
| "What are you, crazy?"; /* Pose the question to the player */ | |
| /* | |
| 1. Set "global.questionAsked" to tell parser we asked a question. | |
| 2. Set "global.questionTurn" to the current turn. | |
| 3. Set "global.Qyes" to the desired "yes" response for the player. | |
| 4. Set "global.Qno" to the desired "no" response for the player. | |
| 5. Set "global.Qmaybe to the desired "maybe" response for the player. | |
| */ | |
| global.questionAsked := true; | |
| global.questionTurn := global.turnsofar; | |
| global.Qyes := 'That\'s what I thought!"; | |
| global.Qno := 'Well, you *ARE* crazy for trying to attack a dragon!"; | |
| global.Qmaybe := 'I can tell your a very decisive person."; | |
| } | |
| else | |
| "You can't attack that!"; /* Give default response for anything */ | |
| } /* else */ | |
| /* | |
| ============================================================================ | |
| = Insert these items into the "global: object" definition in your "std.t" = | |
| ============================================================================ | |
| */ | |
| global: object | |
| questionAsked = nil // Determines whether a question was asked | |
| QuestionTurn = 0 // Turn in which question was asked | |
| Qyes = nil // "yes" response | |
| Qno = nil // "no" response | |
| Qmaybe = nil // "maybe" response | |
| ; | |
| /* | |
| ============================================================================ | |
| = Insert this code into your "yes" verb in "adv.t" = | |
| ============================================================================ | |
| */ | |
| yesverb: sysverb | |
| verb = 'yes' | |
| action( actor ) = | |
| { | |
| /* | |
| Get number of turns since question was asked, if the question was asked | |
| on the last turn, display the "yes" response set by the method. Otherwise | |
| just display the default "You sound rather positive." message. | |
| */ | |
| local result := global.turnsofar - global.questionTurn; | |
| if ( global.questionAsked = true and result = 1 ) | |
| say( global.Qyes ); | |
| else | |
| "You sound rather positive."; | |
| global.questionAsked := nil; // Reset the "question asked" flag | |
| } | |
| ; | |
| /* | |
| ============================================================================ | |
| = Insert this code into your "no" verb in "adv.t" = | |
| ============================================================================ | |
| */ | |
| noverb: sysverb | |
| verb = 'no' | |
| action( actor ) = | |
| { | |
| /* | |
| Get number of turns since question was asked, if the question was asked | |
| on the last turn, display the "no" response set by the method. Otherwise | |
| just display the default "You sound rather negative." message. | |
| */ | |
| local result := global.turnsofar - global.questionTurn; | |
| if ( global.questionAsked = true and result = 1 ) | |
| say( global.Qno ); | |
| else | |
| "You sound rather negative."; | |
| global.questionAsked := nil; // Reset the "question asked" flag | |
| } | |
| ; | |
| /* | |
| ============================================================================ | |
| = Insert this code into your "maybe" verb in "adv.t" = | |
| ============================================================================ | |
| */ | |
| maybeverb: sysverb | |
| verb = 'maybe' | |
| action( actor ) = | |
| { | |
| /* | |
| Get number of turns since question was asked, if the question was asked | |
| on the last turn, display the "maybe" response set by the method. | |
| Otherwise just display the default "You sound rather indecisive." | |
| message. | |
| */ | |
| local result := global.turnsofar - global.questionTurn; | |
| if ( global.questionAsked = true and result = 1 ) | |
| say( global.Qmaybe ); | |
| else | |
| "You sound rather indecisive."; | |
| global.questionAsked := nil; // Reset the "question asked" flag | |
| } | |
| ; | |
Xet Storage Details
- Size:
- 5.85 kB
- Xet hash:
- 9216261979b04b7687474700c68eec5215e87e6985296277351b6825abc7a9ca
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.