Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Curing System

Curing System

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Simimi   (40 posts)  Bio
Date Reply #15 on Wed 22 Aug 2007 06:12 AM (UTC)
Message
I hoped so, but this one is probably my problem, and not yours... there is an error if the trigger is calling;

riftcapture( sTrig, sLine, wildcards )

[string "Script file"]:3: attempt to index local 'wildcards' (a nil value)
stack traceback:
	[string "Script file"]:3: in function 'riftcapture'
	[string "Trigger: "]:1: in main chunk

OR

riftcapture()

[string "Script file"]:3: attempt to index local 'wildcards' (a nil value)
stack traceback:
	[string "Script file"]:3: in function 'riftcapture'
	[string "Trigger: "]:1: in main chunk

OR

showrift()

[string "Script file"]:24: attempt to call a table value
stack traceback:
	[string "Script file"]:24: in function 'showrift'
	[string "Trigger: "]:1: in main chunk


It also boots me from the mud, with an error:


could not decompress text file from mud: -5


The Mushclient error flashes pretty fast on my system, I'm trying to catch it exactly but it appears to be as above.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #16 on Wed 22 Aug 2007 06:44 AM (UTC)
Message
As for an editor, I am very happy with Crimson Editor, freeware, that syntax colours Lua (and other things) and is very fast:

http://www.crimsoneditor.com/

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #17 on Wed 22 Aug 2007 06:47 AM (UTC)
Message
I pasted your code into Crimson Editor, which underlines the matching bracket, which is very helpful in cases where you leave out one. To get it to compile OK you had to have the final bracket paired with the opening one, like this:


  riftsort = { { "tints", {"yellowtint", "redtint", "bluetint", "purpletint", "greentint", "goldtint" } },
             { "herbs", {"sparkleberry", "wormwood", "yarrow", "pennyroyal", "sargassum", "weed",
	                 "arnica", "calamus", "chevril", "colewort", "coltsfoot", "faeleaf", "flax",
			 "galingale", "kafe", "kombu", "marjoram", "merbloom", "mistletoe", "myrtle",
			 "reishi", "rosehips", "sage" },
             { "commodities", {"wood", "gems", "rope", "gold", "coal", "leather" } },
             { "gems", {"moonstone", "ruby", "emerald", "amethyst", "coral", "pearl", "beryl", "bloodstone",
	                "garnet", "jade", "onyx", "opal", "sapphire", "turquoise" }
           }
           }}


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #18 on Wed 22 Aug 2007 06:52 AM (UTC)

Amended on Wed 22 Aug 2007 06:53 AM (UTC) by Nick Gammon

Message
However, I wonder at your table layout. You have lots of items which are numerically keyed. It might be simpler to do it like this:


  riftsort = {
    tints = {"yellowtint", "redtint", "bluetint", "purpletint", "greentint", "goldtint" },
    herbs = {"sparkleberry", "wormwood", "yarrow", "pennyroyal", "sargassum", "weed",
             "arnica", "calamus", "chevril", "colewort", "coltsfoot", "faeleaf", "flax",
             "galingale", "kafe", "kombu", "marjoram", "merbloom", "mistletoe", "myrtle",
             "reishi", "rosehips", "sage" },
    commodities  = {"wood", "gems", "rope", "gold", "coal", "leather" },
    gems = {"moonstone", "ruby", "emerald", "amethyst", "coral", "pearl", "beryl", "bloodstone",
            "garnet", "jade", "onyx", "opal", "sapphire", "turquoise" },
           }


If you do that, you can see the overall layout with a bit of debugging code:


require "tprint"
tprint (riftsort)


This prints:


"gems":
  1="moonstone"
  2="ruby"
  3="emerald"
  4="amethyst"
  5="coral"
  6="pearl"
  7="beryl"
  8="bloodstone"
  9="garnet"
  10="jade"
  11="onyx"
  12="opal"
  13="sapphire"
  14="turquoise"
"commodities":
  1="wood"
  2="gems"
  3="rope"
  4="gold"
  5="coal"
  6="leather"
"tints":
  1="yellowtint"
  2="redtint"
  3="bluetint"
  4="purpletint"
  5="greentint"
  6="goldtint"
"herbs":
  1="sparkleberry"
  2="wormwood"
  3="yarrow"
  4="pennyroyal"
  5="sargassum"
  6="weed"
  7="arnica"
  8="calamus"
  9="chevril"
  10="colewort"
  11="coltsfoot"
  12="faeleaf"
  13="flax"
  14="galingale"
  15="kafe"
  16="kombu"
  17="marjoram"
  18="merbloom"
  19="mistletoe"
  20="myrtle"
  21="reishi"
  22="rosehips"
  23="sage"


With this layout you can refer to your gems (which is a table), as riftsort.gems.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #19 on Wed 22 Aug 2007 06:56 AM (UTC)
Message
Quote:

It also boots me from the mud, with an error:

could not decompress text file from mud: -5


Sometimes a script error can do that. For now you can disable compression - see the world configuration -> Output -> Disable Compression.




When pasting code into this forum it helps to "quote forum codes" - this puts a backslash in front of square brackets, otherwise things like [i] turn the text that follows into italics. You can do this inside MUSHclient by copying the code to the clipboard, and selecting Edit menu -> Convert Clipboard Forum Codes.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #20 on Wed 22 Aug 2007 07:00 AM (UTC)
Message
First off, the trigger wasn't working with the {1,3} for some reason. It was just grabbing the last argument.

<triggers>
  <trigger
   enabled="y"
   match="^  (?:\[([ \d]{4})\] (\w+)\s*)(?:\[([ \d]{4})\] (\w+)\s*)?(?:\[([ \d]{4})\] (\w+)\s*)?"
   name="zzzztestingthing"
   regexp="y"
   script="riftcapture"
   sequence="100"
  >
  </trigger>
</triggers>

As far as the code went, I'm not sure where everything got messed up, but now that I'm actually back on a computer where I could test things out:

riftitems={}
function riftcapture( sTrig, sLine, wildcards )
  riftitems[ wildcards[2] ] = tonumber( wildcards[1] )
  if wildcards[4] then
    riftitems[ wildcards[4] ] = tonumber( wildcards[3] )
    if wildcards[6] then
      riftitems[ wildcards[6] ] = tonumber( wildcards[5] )
    end
  end
end

riftsort = { { "tints", {"yellowtint", "redtint", "bluetint", "purpletint", "greentint", "goldtint" } },
             { "herbs", {"sparkleberry", "wormwood", "yarrow", "pennyroyal", "sargassum", "weed",
	                 "arnica", "calamus", "chevril", "colewort", "coltsfoot", "faeleaf", "flax",
			 "galingale", "kafe", "kombu", "marjoram", "merbloom", "mistletoe", "myrtle",
			 "reishi", "rosehips", "sage" } },
             { "commodities", {"wood", "gems", "rope", "gold", "coal", "leather" } },
             { "gems", {"moonstone", "ruby", "emerald", "amethyst", "coral", "pearl", "beryl", "bloodstone",
	                "garnet", "jade", "onyx", "opal", "sapphire", "turquoise" } }
           }
function showrift()
  for _,i in ipairs( riftsort ) do
    Note( "*("..string.upper(i[1])..")*" )
    for _,j in ipairs( i[2] ) do
      if riftitems[j] ~= nil then
        Tell( string.format( "  [%d] %s", riftitems[j], j ) )
      end
    end
    Note( "" )
  end

Here's the output when I did the test:

  [ 125] amethyst           [  40] arnica             [  86] bluetint
  [ 159] calamus            [  59] chervil            [   2] coal
  [  10] colewort           [   3] coltsfoot          [ 225] faeleaf
  [  10] flax               [   7] galingale          [  40] gems
  [  34] gold               [  34] goldtint           [ 130] greentint
  [ 120] kafe               [   6] kombu              [ 144] leather
  [  38] marjoram           [  10] merbloom           [  10] mistletoe
*(TINTS)*
  [86] bluetint  [130] greentint  [34] goldtint
*(HERBS)*
  [40] arnica  [159] calamus  [10] colewort  [3] coltsfoot  [225] faeleaf  [10] flax  [7] galingale  [120] kafe  [6] kombu  [38] marjoram  [10] merbloom  [10] mistletoe
*(COMMODITIES)*
  [40] gems  [34] gold  [2] coal  [144] leather
*(GEMS)*
  [125] amethyst

I'd set up an alias so that when you enter the command to look into the rift, it clears the table.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #21 on Wed 22 Aug 2007 07:00 AM (UTC)
Message
Quote:

I hoped so, but this one is probably my problem, and not yours... there is an error if the trigger is calling;


riftcapture( sTrig, sLine, wildcards )


I am not sure what you are doing here. MUSHclient calls the script, you shouldn't be doing it yourself. Again I think you are confusing techniques here. Have you read:

http://www.gammon.com.au/forum/?id=6030

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Simimi   (40 posts)  Bio
Date Reply #22 on Wed 22 Aug 2007 07:23 AM (UTC)
Message
I pasted your script and trigger into my MUSH exactly as it is for you and it does nothing for me when rift is done...

3289h, 3106m, 2923e, 10p, 15345en, 14430w elrx-
ir
Glancing into the Rift, you see:
  [ 125] amethyst           [  40] arnica             [  86] bluetint
  [ 159] calamus            [  59] chervil            [   2] coal
  [  10] colewort           [   3] coltsfoot          [ 225] faeleaf
  [  10] flax               [   7] galingale          [ 290] gems
  [  34] gold               [  34] goldtint           [ 130] greentint
  [ 118] kafe               [   6] kombu              [ 143] leather
  [  38] marjoram           [  10] merbloom           [  10] mistletoe
Type MORE to continue reading. (57% shown)
3289h, 3106m, 2923e, 10p, 15345en, 14430w elrx-


And thanks Nick, I'm glad I am learning so much from this project!
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #23 on Wed 22 Aug 2007 08:08 AM (UTC)
Message
You have to call the showrift function somehow. I did it from the command line, but if I were to call it often, I'd just have an alias for it. Possibly figure out how a quick way to display the information automatically, but that can get tricky.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Simimi   (40 posts)  Bio
Date Reply #24 on Wed 22 Aug 2007 07:33 PM (UTC)
Message
Same as other thread. Showrift plugin located here.

http://forums.lusternia.com/index.php?act=attach&type=post&id=1519
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #25 on Wed 22 Aug 2007 09:33 PM (UTC)
Message
I couldn't access that page, and a search for "showrift" returned no results.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #26 on Wed 22 Aug 2007 09:37 PM (UTC)
Message
Quote:

attempt to index local 'wildcards' (a nil value)


Without seeing the code, it looks like you are calling riftcapture without supplying the wildcards array, hence the error message about it being nil.

Your snippet showed this:



riftcapture()


If you called that, then you haven't supplied the 3 arguments that riftcapture is expecting.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Simimi   (40 posts)  Bio
Date Reply #27 on Wed 22 Aug 2007 10:09 PM (UTC)

Amended on Wed 22 Aug 2007 10:10 PM (UTC) by Simimi

Message
So sorry Nick! I had changed the name of the plugin shortly after making that post.

Both plugins can be found here, on my website.

http://www.icitan.net/lusternia/systembuilding/

The plugin is now called, "riftsort"

It seems to be working just fine.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #28 on Wed 22 Aug 2007 11:06 PM (UTC)
Message
OK, so problem solved, then?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Simimi   (40 posts)  Bio
Date Reply #29 on Thu 23 Aug 2007 01:55 AM (UTC)
Message
Yes sir, the only 'problem' now is that the users want it to print in different ways, like in columns (right now the print is determined by your in game wrap width,((I think)) which mine is 255).

Since I had been working for a long time to try and figure out -how- to do custom prints like that, all I have to study on is this code here. I'm afraid I am not skilled enough for the fancy custom prints the users are looking for...

Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


76,900 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.