{"id":19156379,"url":"https://github.com/ess/muddy-old","last_synced_at":"2025-02-22T21:42:13.161Z","repository":{"id":66321353,"uuid":"46007951","full_name":"ess/muddy-old","owner":"ess","description":"This is a rather old, poorly-implemented script that used Term::Visual as a MUD interface. You totally shouldn't use it. I'm re-implementing it and am saving it here to remind myself that even my worst code today is better than my best code back then :)","archived":false,"fork":false,"pushed_at":"2015-11-11T20:30:08.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-03T20:10:28.462Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ess.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-11T20:26:40.000Z","updated_at":"2015-11-11T20:33:37.000Z","dependencies_parsed_at":"2023-03-09T05:00:58.985Z","dependency_job_id":null,"html_url":"https://github.com/ess/muddy-old","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ess%2Fmuddy-old","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ess%2Fmuddy-old/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ess%2Fmuddy-old/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ess%2Fmuddy-old/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ess","download_url":"https://codeload.github.com/ess/muddy-old/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240241803,"owners_count":19770463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T08:34:17.473Z","updated_at":"2025-02-22T21:42:13.142Z","avatar_url":"https://github.com/ess.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"MUDdy\n-----\nMuddy started out as a desire to give another client, Muby, a prettier UI.\n\nThat's still about all that it is, but the only thing that actually came\nfrom Muby was the connection code.\n\nCode\n----\nAs I mentioned already, Muddy uses selected chunks of the connection code\nfrom Muby (http://rubyforge.org/projects/muby) in order to handle telnet\ncommunications.  The telnet protocol isn't really fully supported, but it\nworks well enough with the only MUD that I actually play, so there you go.\n\nThe user interface is a slightly modified version of termvisual-0.0.3.  The\nreason that it's included in the archive is that 0.0.3 is the last version of\ntermvisual (http://rubyforge.org/projects/termvisual) that didn't make use\nof an event system that is only available in Mac OS X.  Also, in order to get\nthe color display code working properly, I had to disallow the wrapping of\ntext.  This leads to a slightly obnoxious bug, which is detailed in the Bugs\nsection of this text.  Also, since I'm tailoring termvisual to this project\nanyways, I went ahead and added KEY_UP and KEY_DOWN to the default bindings.\nFurther, the command history is capped at 100 entries.\n\nRequirements\n------------\nOkay, so this is the stuff that I know for a fact works:\n\n  * ruby-1.8.5-4 (Debian Etch)\n  * ncurses-ruby\n  * log4r (for debugging)\n\nThat should just about cover it.\n\nUsage\n-----\n/path/to/muddy.rb (-debug) server port\n\nExample\n-------\n./muddy.rb -debug scrymud.net 4444\n\nDifferences from Muby\n---------------------\nAside from the user interface, the only real difference between Muddy and Muby\nat this point (so far as a user should see) is in the scripting interface.\n\nI'm using a MUCH simpler scripting mechanism than Muby does, particularly in\nthe trigger system (see Triggers).  Muby allows for one to link a trigger to\npredefined methods (via Symbols), raw strings, and Threads.  Muddy allows one\nto link triggers only to raw strings, but the mechanism used allows for one\nto use predefined methods by listing the method name as a string.\n\nAnother difference, specifically in triggers, is that match output (like that\nwhich would be yielded by regexp grouping) is not passed on to the string\nthat is called when the trigger fires.  Considering that I never actually got\nthat to work in Muby, I'm thinking that I won't be hearing a lot of people\ncomplain, but I'll consider implementing it if I hear enough jag about it.\n\nHey, how about another difference relating to triggers ... there are no local\ntriggers.  I really don't see the point in them, and they actually cause\nthe footprint of the program to go up while causing the efficiency to go\ndown.  Not a good mix.\n\nFinally, there is no conf construct in Muddy.  I don't like it.  Live with it.\n\n\nScripting\n---------\nTo use user scripts, just drop them in a file in ~/.muddy called\nuser_methods.rb, and to use your scripts just execute them from the Muddy\ncommand line like so:  \n\n  /scriptname \"this is a string argument\", \"this is another\"\n\nTruth be told, you can stick any arbitrary ruby code into the command line,\nso long as '/' is the first character in the buffer.\n\nThere is an example user_methods.rb in the examples directory of the Muddy\nsource.  Please feel free to use this as a basis for your scripts.\n\nThere are only three built-in methods for user scripting.  These are print\n(print to the local window), echo (an alias to print), and send (send text\nto the MUD).  Following is a simple userscript that uses all three of these\nmethods:\n\ndef get_and_wear(item)\n  print \"Getting #{item} and wearing it ...\"\n  send \"get #{item}\"\n  send \"wear #{item}\"\n  echo \"Finished with #{item}.\"\nend\n\nWhile the scripting system might seem overly simplistic, I've scarcely had the\nneed for more than this.  For a real-world example, check out this keepalive\nmethod that I use on ScryMUD (also in the example user_methods.rb file):\n\ndef keepalive\n  @mythread = Thread.new do\n    loop do\n      sleep 60\n      send \"\"\n    end\n  end\nend\n\nSince all scripts are invoked through Ruby's eval method, anything that you\nhave available to you in Ruby is also available to you in Muddy scripting.\nThis even includes the ability to load other libraries and modules if you\nso wish.  Heck ... just saying that gives me the notion to write an automapper\nthat uses the ruby gtk+ bindings (though I'm not going to).\n\nAlso, just to throw another layer of complexity on top of what should be a\nreally simple scripting system, let's talk about triggers ...\n\nTriggers\n--------\nWhile the basic scripting system allows for a lot of active waylaying and so\non, sometimes, you just want to let your aggression be a little more passive.\nThat is that you'll want to react to what's going on instead of just causing\neverything to happen.  That's where triggers come in.\n\nInstead of being terribly long-winded on the subject, I'm just going to give\nyou an example.  Let's assume that you only ever use one particular weapon.\nLet's further assume that there are baddies in the realm that are capable of\ndisarming you.  Let's further assume that you hate it when those rat bastards\ndisarm you, but you don't want to be bothered to pick your weapon up and re-\nequip it.  Well, my friend, the following is for you:\n\n@triggers[\"disarms you\"] = \"getmydamnedswordback\"\n\ndef getmydamnedswordback\n  send \"get sword\"\n  send \"wield sword\"\nend\n\nThat's all there is to it.  If the text \"disarms you\" comes across your\nconnection, \"get sword\" and \"wear sword\" will be sent to the server.\n\nThe key for your trigger (the bit between the square brackets) can be either\na raw string or a proper regular expression ... makes no nevermind to old\nMuddy.\n\nThere are a few decent (even though I'm forced to say so myself) examples of\nterribly convoluted triggers in the included example user_methods.rb ... I\nuse them every time I play, so there you go.\n\nBugs\n----\nThe text wrapping bug has been fixed as of 2007-06-12.\n\nDue to the nature of the way that some MUDs generate ANSI color sequences,\nit's been brought to my attention that when setting a background color,\nthe foreground color will more than likely be reset to false.  This causes\nan effect such that the text is styled as \"black on background.\"  I'm working\non it.\n\n-- Scruff\npooster@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fess%2Fmuddy-old","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fess%2Fmuddy-old","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fess%2Fmuddy-old/lists"}