View Full Version : This really should be easy but...
Drunken Durfin
02-13-2011, 06:41 PM
...I can't seem to get it.
Ask dead guy if they want a chrism.
Wait for 10 seconds, if they say "chrism please" then use chrism.
If they say "no chrism" or 10 seconds elapses, raise without chrism.
I've tried several different angles to get this to work with no avail. If someone has something that does this, or something similar, please help a dwarf out.
Thanks.
Glavenfyre
02-13-2011, 07:09 PM
depending on how much error checking you want it could be as simple as:
result = dothistimeout "whisper #{target} do you want a chrism?", 10, /chrism please|no chrism/i
if result =~ /chrism please/i
chrism_raise()
else
no_chrism_raise()
end
changing the dothistimeout to: result = dothistimeout "whisper #{target} do you want a chrism?", 10, /#{target}.*?(?:chrism please|no chrism)/i
may make sure that your target is the one who responded... But I'd have to check to be sure.
I'd give them a little bit longer than 10 seconds and just change the answer to yes or no (or yes please. or no please.) with periods on the end.
ShatteredCasis
02-13-2011, 07:20 PM
I gave you a copy of braindamage.lic, just look at the cleric section in it. I prefer not to give them an option to say no. Either they answer or they don't. Waiting for a "no/yes" could mean an indefinate wait if they are afk.
Bobmuhthol
02-13-2011, 07:23 PM
It's kind of a check within a check. He's not trying to wait for an answer, but he is (as stated, he might change his mind) looking to cut out the waiting period if the person explicitly declines.
Drunken Durfin
02-14-2011, 11:43 AM
depending on how much error checking you want it could be as simple as:
result = dothistimeout "whisper #{target} do you want a chrism?", 10, /chrism please|no chrism/i
if result =~ /chrism please/i
chrism_raise()
else
no_chrism_raise()
end
changing the dothistimeout to: result = dothistimeout "whisper #{target} do you want a chrism?", 10, /#{target}.*?(?:chrism please|no chrism)/i
may make sure that your target is the one who responded... But I'd have to check to be sure.
For some reason I had it in my head that dothistimeout would not work for this type of thing...I'll give this a shot. Thanks.
Glavenfyre
02-14-2011, 12:57 PM
For some reason I had it in my head that dothistimeout would not work for this type of thing...I'll give this a shot. Thanks.
I had a tendency to think of dothistimeout as something that I used to process direct responses from the game. Once i got past that I understood it's true potency...
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.