Results 1 to 10 of 10

Thread: DownstreamHook "Song Status"

  1. #1

    Default DownstreamHook "Song Status"

    I'm trying to capture a couple of things out of the return for the bard command "song status"
    Code:
    You are currently singing:  Fortitude Song
                                Song of Luck
                                Song of Valor
                                Song of Mirrors
                                Song of Sonic Disruption
    
    The effects of your magical medley have faintly begun to wane.  It will be a couple of minutes before your medley renews.  Your current renewal cost is 51 mana.
    I'd like to be able to capture "Song of Sonic Disruption" and the value for whatever the renewal cost is at the end. I've tried several variations, but all I can ever seem to get it to hit on is the first line "You are currently...", nothing else.

    I gave up on that route and went to the Stop List return to try and grab it there, but met with the same result. Using this code:
    Code:
    		if server_string =~ /STOP SINGING 1030 - Song of Sonic Disruption/
    			echo "SD Hit fired: #{server_string}"
    			canRenew = true
    			nil
    		elsif server_string =~ /You can currently stop doing the following|STOP/
    			echo "You Can and/or STOP fired: #{server_string}"
    			DownstreamHook.remove('check_SonicDisruptionActive')
    			nil
    		else
    			echo "Else fired: #{server_string}"
    			server_string
    		end
    Still, the only thing I can get it to hit on is the first line, "You can currently stop...":

    Code:
    You can currently stop doing the following:
    
    STOP SINGING ALL SPELLSONGS
    STOP SINGING 1003 - Fortitude Song
    STOP SINGING 1006 - Song of Luck
    STOP SINGING 1010 - Song of Valor
    STOP SINGING 1019 - Song of Mirrors
    STOP SINGING 1030 - Song of Sonic Disruption
    STOP 401 - Elemental Defense I
    STOP 406 - Elemental Defense II
    STOP 414 - Elemental Defense III
    STOP 425 - Elemental Targeting
    STOP 430 - Elemental Barrier
    STOP {Target}
    So, I'm guessing these things are related.

    Thanks.
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

  2. #2

    Default

    Output with tags echo'ing


    >Song status
    Code:
    You are currently singing:  Fortitude Song
                                Song of Luck
                                Song of Valor
                                Song of Mirrors
                                Song of Sonic Disruption
    
    Your song magic remains strong.  It will be several minutes before your medley renews.  Your current renewal cost is 51 mana.
    >
    [exec1: <output class="mono"/>]
    [exec1: You are currently singing:  Fortitude Song]
    [exec1:                             Song of Luck]
    [exec1:                             Song of Valor]
    [exec1:                             Song of Mirrors]
    [exec1:                             Song of Sonic Disruption]
    [exec1: <output class=""/>]
    [exec1: ]
    [exec1: Your song magic remains strong.  It will be several minutes before your medley renews.  Your current renewal cost is 51 mana.]
    [exec1: <prompt time="1481824983">&gt;</prompt>]
    >Stop list
    Code:
    You can currently stop doing the following:
    
    STOP SINGING ALL SPELLSONGS
    STOP SINGING 1003 - Fortitude Song
    STOP SINGING 1006 - Song of Luck
    STOP SINGING 1010 - Song of Valor
    STOP SINGING 1019 - Song of Mirrors
    STOP SINGING 1030 - Song of Sonic Disruption
    STOP {Target}
    [exec1: You can currently stop doing the following:]
    [exec1: ]
    >
    [exec1: <output class="mono"/>]
    [exec1: <a exist="-10987075" coord="2524,1746" noun="singing">STOP SINGING ALL SPELLSONGS</a>]
    [exec1: <a exist="-10987075" coord="2524,1746" noun="singing 1003">STOP SINGING 1003 - Fortitude Song</a>]
    [exec1: <a exist="-10987075" coord="2524,1746" noun="singing 1006">STOP SINGING 1006 - Song of Luck</a>]
    [exec1: <a exist="-10987075" coord="2524,1746" noun="singing 1010">STOP SINGING 1010 - Song of Valor</a>]
    [exec1: <a exist="-10987075" coord="2524,1746" noun="singing 1019">STOP SINGING 1019 - Song of Mirrors</a>]
    [exec1: <a exist="-10987075" coord="2524,1746" noun="singing 1030">STOP SINGING 1030 - Song of Sonic Disruption</a>]
    [exec1: <a exist="-10987075" coord="2524,1746" noun="Ifor">STOP {Target}</a>]
    [exec1: <output class=""/>]
    [exec1: <prompt time="1481825076">&gt;</prompt>]
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

  3. Default

    Code:
    def check_disruption
    	squelching = false
    	hook_name = 'squelch-song-status'
    	hook_proc = proc { |s|
    		if squelching
    			if s =~ /<output/
    				s
    			elsif s =~ /<prompt/
    				DownstreamHook.remove(hook_name)
    				s
    			else
    				nil
    			end
    		elsif s =~ /^You are currently singing/
    			squelching = true
    			nil
    		else
    			s
    		end
    	}
    	DownstreamHook.add(hook_name, hook_proc)
    	status_tags
    	clear
    	silence_me unless undo_silence = silence_me
    	put 'song status'
    	silence_me if undo_silence
    
    	active = false
    	cost = nil
    	while line = get
    		if line =~ /You are currently singing/
    			if line =~ /Song of Sonic Disruption/
    				active = true
    			end
    			while line = get
    				if line =~ /<prompt/
    					break
    				elsif line =~ /Song of Sonic Disruption/
    					active = true
    				elsif line =~ /current renewal cost is (\d+) mana/
    					cost = $1.to_i
    				end
    			end
    			break
    		end
    	end
    	return h = { :active => active, :cost => cost }
    end
    
    foo = check_disruption
    if foo[:active]
    	# something
    end
    if foo[:cost] > 9000
    	# something else
    end
    Last edited by Tillmen; 12-15-2016 at 01:25 PM.
    Get Lich - Vote for Gemstone (topmudsites.com)

  4. #4

    Default

    Works like a champ. Thank you very much for your assistance.
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

  5. #5

    Default

    You are playing again???

  6. #6

    Default

    In shattered. He's not a real boy.
    Last edited by Donquix; 12-16-2016 at 01:01 PM.
    Mithrilschlong, 2015-03-10 to slightly later on 2015-03-10. You will not be forgotten!
    usable Meteor Swarm, late 2020-12-30 to early 2020-12-31. You will also not be forgotten!

  7. #7

    Default

    Quote Originally Posted by Durgrimst View Post
    You are playing again???
    I blame Casis. It is all his fault.

    It is less "playing" and more "I wonder if I can code a script that will do X?" kind of an exercise. The new will wear off, or I will get overly frustrated, and that will be the end of it again. I was mostly lured by the 2 free months of Prime, which made this a $5/month investment when you tack on the Shattered sub. If they would make Shattered a stand-alone $5 subscription I would most likely stay, but I'm not holding my breath.
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

  8. #8

    Default

    Before I carry over this code to other things, and inadvertently screw something up, what is the purpose of "status_tags" and "clear" the the section below?

    Code:
    DownstreamHook.add(hook_name, hook_proc)
    	status_tags
    	clear
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

  9. #9

    Default

    Nicely done!
    Luxie's adventures (because I must write) plus some guests from the past at my blog:
    http://www.thebardess.com

  10. #10

    Default

    Quote Originally Posted by Drunken Durfin View Post
    Before I carry over this code to other things, and inadvertently screw something up, what is the purpose of "status_tags" and "clear" the the section below?

    Code:
    DownstreamHook.add(hook_name, hook_proc)
    	status_tags
    	clear
    https://gswiki.play.net/Lich_scripti...ce#status_tags

    https://gswiki.play.net/Lich_scripting_reference#clear
    Mithrilschlong, 2015-03-10 to slightly later on 2015-03-10. You will not be forgotten!
    usable Meteor Swarm, late 2020-12-30 to early 2020-12-31. You will also not be forgotten!

Similar Threads

  1. Nixon: Fred Thompson is "Dumb as hell" but "Friendly"
    By chillmonster in forum Politics
    Replies: 108
    Last Post: 02-23-2021, 08:12 AM
  2. Why I love Russia! "Homo-Scanners" "Nigaz"
    By Solkern in forum Social Forum
    Replies: 4
    Last Post: 01-27-2011, 04:37 PM
  3. Replies: 20
    Last Post: 01-18-2011, 12:51 AM
  4. Replies: 4
    Last Post: 12-02-2005, 12:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •