Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- This script waits for someone to whisper "Illusion" to you, then helps them Teach or Learn a particular illusion.
- just to be clear, this script is mainly for people who are already mastered and want to help others during downtime without typing everything.
- thanks to everyone who helped me debug, especially Murkshev. And Tillmen, Sam, Pandin, Riall, and Casis for some code pointers.
- ~Moredin
- 2/28/2011 - added option where pupil can ask for a promotion in the illusion skill ranks
- 10/06 - made it harder to 'break' the script by adding regex and timeouts while waiting for correct responses/successful reps. so if one person messes up or logs out, someone else can still start a session.
- 10/09 - takes into account the script-users's guild mastery status; people get 2x credit on reps from them. thanks to Malisai for help debugging
- 10/10 - pauses other scripts (visible ones) that are running, so at the time someone whispers so they don't interfere with tutoring.
- 02/02/2012 - increased timeout time before reteaching to 60 since Gristash sucks at making roses...(used to wait 45 seconds for success)
- Mar 2012 - made opening line more flexible to what it recognizes. can whisper anything with the words "promote", "promotion", "illusion", or any variation of the latter ("illusions", "illusioning", etc)
- - made it count the failures and re-teach those failures at end of lesson.
- Kaldonis takes over as maintainer
- 20 Oct 2016 - trying to make two tutors to stop Doing each other
- 17 Aug 2017 - promotion in all tasks, beta test on checkin requirement
- REPORT ANY BUGS
- =end
- before_dying { $teaching_illusions = nil }
- rank = dothistimeout 'gld', 20, /^You are (?:a member|Guild Master) of the Sorcerer Guild\.$/
- if rank =~ /^You are Guild Master of the Sorcerer Guild\.$/
- guildmaster = true
- echo ""
- echo "You are a Guild Master. People training with you earn 2 reps instead of 1."
- echo ""
- else
- end
- echo ""
- echo "Someone must WHISPER a sentence with 'illusion(s)', 'promote/promotion', or 'nominate' in it to start the sessions."
- echo ""
- loop {
- line = get until line =~ /^([A-Z][a-z]+) whispers, \".*?illusion.*?\"|^([A-Z][a-z]+) whispers, \".*?promote.*?\"|^([A-Z][a-z]+) whispers, \".*?promotion.*?\"|^([A-Z][a-z]+) whispers, \".*?nominate.*?\"/i
- if line =~ /^([A-Z][a-z]+) whispers, \".*?illusion.*?\"/i
- person = $1
- $teaching_illusions = true
- for s in Script.running
- s.pause unless ( s == Script.self or s.to_s == "sigils" or s.to_s == "narost" or s.to_s == "rnum" )
- end
- elsif line =~ /^([A-Z][a-z]+) whispers, \".*?promot.*?\"/i
- person = $1
- skill = $2
- if skill =~ /illus|alch|trink|potion/i
- sleep 0.1
- else
- fput "whisper #{person} I am to promote you in which one: illus, alch, trink, or potion?"
- y = matchtimeout( 25, "#{person} whispers, \"(\\w+)")
- #y =~ /#{person} whispers, \"(\w+)/ # cannot handle: Beyrn whispers, "Promote illus."
- y =~ /#{person} whispers, \"(illus|alch|trink|potion)/i
- skill = $1
- end
- fput "gld promote #{person} in #{skill}"
- # another exception: Beyrn is behind in his dues! You'll have to check him in first.
- line = get until line =~ /^You offer to promote|needs to diversify (his|her) training by learning|^Promote whom/
- if line =~ /training by learning (.*) before/
- prerequisite = $1
- fput "whisper #{person} You need #{prerequisite} before I can promote you in illusions, sorry."
- sleep 1
- elsif line =~ /^You offer to promote/
- promote_result = dothistimeout 'nod approve #{person}', 10, /has mastered the skill!|ranks of this skill!/
- if promote_result =~ /has mastered the skill!/
- mastered = true
- else
- mastered = false
- end
- elsif line =~ /is behind in (his|her) dues/
- fput "whisper #{person} You are behind on your dues! Let's settle that first!"
- fput "gld checkin #{person}"
- fput "whisper occ #{person} This feature is still in beta testing, sorry!"
- sleep 1
- end
- elsif line =~ /^([A-Z][a-z]+) whispers, \".*?nominate.*?\"/i
- person = $1
- fput "gld nominate #{person}"
- fput "whisper #{person} You'll need 1 other Guild Master here and a nomination from him or her also. Congratulations on your achievement!"
- fput "nod"
- end
- sleep 1
- if $teaching_illusions == true
- failcount = 0
- fput "whisper #{person} Are you here to Teach or Learn?"
- y = matchtimeout( 25, "#{person} whispers, \"(\\w+)")
- y =~ /#{person} whispers, \"(\w+)/
- role = $1
- if role =~ /Learn/
- fput "nod #{person}"
- sleep 0.5
- fput "whisper #{person} How many reps?"
- y = matchtimeout( 25, "#{person} whispers, \"(\\d+)")
- y =~ /#{person} whispers, \"(\d+)/
- reps = $1.to_f
- if reps > 42
- fput "whisper #{person} that's too many reps!"
- next
- end
- reps = (reps/2).ceil if guildmaster == true
- unless reps == nil
- fput "whisper #{person} I am to show you which one: rose, vortex, maelstrom, void, shadow, or demon?"
- y = matchtimeout( 25, "#{person} whispers, \"(\\w+)")
- y =~ /#{person} whispers, \"(\w+)/
- skill = $1
- end
- sleep 0.5
- if guildmaster == true
- fput "whisper #{person} I'm going to teach you #{skill} #{reps} times since each of my lessons counts as two." if skill =~ /Rose|Vortex|Maelstrom|Void|Shadow|Demon/
- else
- fput "whisper #{person} OK, I'll teach you #{skill} #{reps} times" if skill =~ /Rose|Vortex|Maelstrom|Void|Shadow|Demon/
- end
- if skill =~ /Rose/
- waitrt?
- reps.to_i.times { fput "illusion teach #{person} rose"; result = matchtimeout( 60, "a perfectly-shaped black essence rose lies across #{person}\'s hand" ); if result == false; failcount = failcount + 1; end }
- if failcount > 0
- fput "whisper #{person} I think you failed a few reps...I'll give you another chance at those now."
- failcount.to_i.times { fput "illusion teach #{person} rose"; matchtimeout( 60, "a perfectly-shaped black essence rose lies across #{person}\'s hand" ) }
- else
- fput "whisper #{person} I've taught you the number of times you required."
- end
- elsif skill =~ /Vortex/
- waitrt?
- reps.to_i.times { fput "illusion teach #{person} vortex"; result = matchtimeout( 60, "#{person} holds out the palm\.*?takes the form of a swirling colorless vortex" ); if result == false; failcount = failcount + 1; end }
- if failcount > 0
- fput "whisper #{person} I think you failed a few reps...I'll give you another chance at those now."
- failcount.to_i.times { fput "illusion teach #{person} vortex"; matchtimeout( 60, "#{person} holds out the palm\.*?takes the form of a swirling colorless vortex" ) }
- else
- fput "whisper #{person} I've taught you the number of times you required."
- end
- elsif skill =~ /Maelstrom/
- waitrt?
- reps.to_i.times { fput "illusion teach #{person} maelstrom"; result = matchtimeout( 60, "#{person} holds\.*?swiftly reaches its full potential, raining tiny hailstones down into" ); if result == false; failcount = failcount + 1; end }
- if failcount > 0
- fput "whisper #{person} I think you failed a few reps...I'll give you another chance at those now."
- failcount.to_i.times { fput "illusion teach #{person} maelstrom"; matchtimeout( 60, "#{person} holds\.*?swiftly reaches its full potential, raining tiny hailstones down into" ) }
- else
- fput "whisper #{person} I've taught you the number of times you required."
- end
- elsif skill =~ /Void/
- waitrt?
- reps.to_i.times { fput "illusion teach #{person} void"; result = matchtimeout( 60, "#{person} holds up\.*?The miniature fissure begins to feed on the air around you" ); if result == false; failcount = failcount + 1; end }
- if failcount > 0
- fput "whisper #{person} I think you failed a few reps...I'll give you another chance at those now."
- failcount.to_i.times { fput "illusion teach #{person} void"; matchtimeout( 60, "#{person} holds up\.*?The miniature fissure begins to feed on the air around you" ) }
- else
- fput "whisper #{person} I've taught you the number of times you required."
- end
- elsif skill =~ /Shadow/
- waitrt?
- reps.to_i.times { fput "illusion teach #{person} shadow"; result = matchtimeout( 60, "#{person} gazes intently at \.*? the other isolated where \.*? used to be" ); if result == false; failcount = failcount + 1; end }
- if failcount > 0
- fput "whisper #{person} I think you failed a few reps...I'll give you another chance at those now."
- failcount.to_i.times { fput "illusion teach #{person} shadow"; matchtimeout( 60, "#{person} gazes intently at \.*? the other isolated where \.*? used to be" ) }
- else
- fput "whisper #{person} I've taught you the number of times you required."
- end
- elsif skill =~ /Demon/
- waitrt?
- reps.to_i.times { fput "illusion teach #{person} demon"; result = matchtimeout( 60, "stands in its place and #{person} withdraws" ); if result == false; failcount = failcount + 1; end }
- if failcount > 0
- fput "whisper #{person} I think you failed a few reps...I'll give you another chance at those now."
- failcount.to_i.times { fput "illusion teach #{person} demon"; matchtimeout( 60, "stands in its place and #{person} withdraws" ) }
- else
- fput "whisper #{person} I've taught you the number of times you required."
- end
- else
- fput "whisper #{person} I didn't catch what illusion you wanted."
- sleep 1
- end
- elsif role =~ /Teach/
- fput "nod #{person}"
- sleep 1
- fput "whisper #{person} How many reps?"
- y = matchtimeout( 25, "#{person} whispers, \"(\\d+)")
- y =~ /#{person} whispers, \"(\d+)/
- reps = $1.to_f
- if reps > 22
- fput "whisper #{person} that's too many reps!"
- next
- end
- reps = (reps/2).ceil if guildmaster == true
- unless reps == nil
- fput "whisper #{person} Are you teaching Rose or Vortex? There's no point in teaching the others."
- y = matchtimeout( 25, "#{person} whispers, \"(\\w+)")
- y =~ /#{person} whispers, \"(\w+)/
- skill = $1
- end
- sleep 1
- if skill =~ /Rose/
- waitrt?
- if guildmaster == true
- fput "whisper #{person} Alright, go ahead. You only need to tell me about making a rose #{reps} times, since I'm a Guildmaster."
- else
- fput "whisper #{person} Tell me about the forming of roses, then."
- end
- reps.to_i.times {
- matchtimeout( 30, "Making sure you are watching" )
- sleep 0.5
- waitrt?
- if !righthand and !lefthand
- fput "illusion rose"
- elsif righthand||lefthand == "rose"
- fput "eat my rose"
- fput "illusion rose"
- end
- }
- elsif skill =~ /Vortex/
- waitrt?
- if guildmaster == true
- fput "whisper #{person} Alright, go ahead. You only need to tell me about making a vortex #{reps} times, since I'm a Guild Master."
- else
- fput "whisper #{person} Tell me about the forming of vortices, then."
- end
- reps.to_i.times {
- matchtimeout( 30, "making sure to allow you to glimpse into its secrets" )
- sleep 0.5
- waitrt?
- if !righthand and !lefthand
- fput "illusion vortex"
- elsif righthand||lefthand == "vortex"
- fput "eat my vortex"
- fput "illusion vortex"
- end
- }
- else
- fput "whisper #{person} I'm not demonstrating anything except a Vortex or a Rose!"
- sleep 1
- end
- else
- fput "whisper #{person} sorry, start over by asking me about illusions or promotions. "
- sleep 1
- end
- end
- sleep 1
- fput "whisper #{person} You can start a new session now if you'd like."
- if mastered == true
- sleep 1
- fput "whisper #{person} Just kidding! But seriously, congratulations!"
- end
- for s in Script.running; s.unpause if s.paused; end
- fput "'::#{person} done" if $teaching_illusions == true
- $teaching_illusions = nil
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement