Results 1 to 4 of 4

Thread: Error with sf_to_wiz

  1. #1

    Default Error with sf_to_wiz

    The error doesn't matter to me but thought I might raise it.

    I made this script to count arrows:
    Code:
    silence_me
    arrow_total = 0
    bundle_total = 0
    arrow_counts = []
    
    action = proc { |server_string|
    	if server_string =~ /find (\d*) in the bundle/i
    		arrow_counts.push($1)
    		arrow_total += $1.to_i
    #		nil
    	elsif server_string =~ /surrounded by a scintillating|arrow has been crafted|nothing unusual|aura of holy light/i
    		arrow_counts.push("1")
    		arrow_total += 1
    	elsif server_string =~ /individual projectile|^.$/mi
    	else server_string
    	end
    }
    DownstreamHook.add('arrowcount', action)
    GameObj[Lich.quiver].contents.find_all { |obj| obj.name =~ /arrow|bolt/ }.each { |bundle|
    	bundle_total += 1
    	fput "look ##{bundle.id}"
    }
    DownstreamHook.remove('arrowcount')
    
    respond("\n\t### Arrows: #{arrow_total}, Bundles: #{bundle_total}")
    respond("\t### Bundle Counts: #{arrow_counts.join(", ")}\n\n")
    With "nil" commented out, I get the following (I just used nil to hide the error, the script still counts my arrows just fine with or without it):
    Code:
    --- Lich: arrowcount active.
    --- Error: sf_to_wiz: private method `scan' called for 29:Fixnum
    $_SERVERSTRING_: You carefully count the <a exist="67632545" noun="arrows">arrows</a> and find 29 in the bundle, each one being a whalebone arrow, with a strength of 20 and a durability of 40.  The <a exist="67632545" noun="arrows">arrows</a> are surrounded by a scintillating white light.
    H>--- Error: sf_to_wiz: private method `scan' called for 59:Fixnum
    $_SERVERSTRING_: You carefully count the <a exist="67632642" noun="arrows">arrows</a> and find 30 in the bundle, each one being a whalebone arrow, with a strength of 20 and a durability of 40.  The <a exist="67632642" noun="arrows">arrows</a> are surrounded by a scintillating white light.
    H>--- Error: sf_to_wiz: private method `scan' called for 89:Fixnum
    $_SERVERSTRING_: You carefully count the <a exist="67632563" noun="arrows">arrows</a> and find 30 in the bundle, each one being a whalebone arrow, with a strength of 20 and a durability of 40.  The <a exist="67632563" noun="arrows">arrows</a> are surrounded by a scintillating white light.
    H>--- Error: sf_to_wiz: private method `scan' called for 119:Fixnum
    $_SERVERSTRING_: You carefully count the <a exist="67632571" noun="arrows">arrows</a> and find 30 in the bundle, each one being a whalebone arrow, with a strength of 20 and a durability of 40.  The <a exist="67632571" noun="arrows">arrows</a> are surrounded by a scintillating white light.
    H>--- Error: sf_to_wiz: private method `scan' called for 143:Fixnum
    $_SERVERSTRING_: You carefully count the <a exist="64351241" noun="arrows">arrows</a> and find 24 in the bundle, each one being a whalebone arrow, with a strength of 20 and a durability of 40.  The <a exist="64351241" noun="arrows">arrows</a> are surrounded by a scintillating white light.
    H>
           ### Arrows: 143, Bundles: 5
           ### Bundle Counts: 29, 30, 30, 30, 24
    
    --- Lich: arrowcount has exited.

  2. Default

    That's not so much a bug as it is a misuse of DownstreamHook. When you comment out the nil, the last line executed in the action proc is "arrow_total += $1.to_i" when server_string =~ /find (\d*) in the bundle/i. The value of the last line executed is the value of arrow_total, which is an integer. This is what the proc returns, and this is what's passed to any other DownstreamHooks and then to sf_to_wiz as the server string. If you want to hide the server string from the game window, having a nil there is correct. If you want the real server string or a modified one to show up in the game window, then that's what the action proc should return. If you don't want to hide or modify any server strings, then DownstreamHook is the wrong thing to use.
    Get Lich - Vote for Gemstone (topmudsites.com)

  3. #3

    Default

    I see. I think I confused myself at some point because I'm used to making return explicit. I was thinking it was always nil unless explicitly stated. Thanks. Makes perfect sense.

  4. Default

    I should probably point out now that explicitly returning from a proc gives a warning in Ruby 1.8 and an error in Ruby 1.9. I was using the term return kind of loosely.
    Get Lich - Vote for Gemstone (topmudsites.com)

Similar Threads

  1. Lich Error --- error: no map database found
    By Elgrim in forum The Lich Project
    Replies: 4
    Last Post: 08-27-2017, 10:22 PM
  2. error: SpellRanks.load: dump format error(0x9)
    By TheDude in forum The Lich Project
    Replies: 15
    Last Post: 03-14-2014, 04:35 PM
  3. Error with EXP
    By kgolfer in forum The Lich Project
    Replies: 2
    Last Post: 09-04-2011, 11:24 PM
  4. error
    By xdigitalx in forum GemStone Websites
    Replies: 1
    Last Post: 11-23-2009, 01:04 AM
  5. SGE Error
    By Methais in forum General Gemstone
    Replies: 7
    Last Post: 07-24-2008, 02:27 AM

Posting Permissions

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