cmd_help.rb
znmud-0.0.1/cmd/zombie/cmd_help.rb · 1.3 KB
From the archive znmud-minimal-0.0.1.tar.gz
Download the archive « Back to the archive contents
#
# file:: cmd_help.rb
# author:: Macabre
# version:: 0.0.1
# date:: 10/3/2008
#
# Additional Contributor: Craig Smith
#
# This source code copyright (C) 2005 by Jon A. Lambert
# All rights reserved.
#
# Released under the terms of the TeensyMUD Public License
# See LICENSE file for additional information.
#
module Cmd
bindtextdomain("cmd")
# The help command
def cmd_help(args)
case args
when nil, ""
sendto _("====================HELP=======================")
line = String.new
wordcnt = 0
world.cmds.to_hash.values.each do |h|
if can_exec_cmd?(h) == true and not h.perm and not h.is_emote?
line += sprintf("%-15s", h.name)
wordcnt+=1
end
if wordcnt == 4
sendto(line)
line = ""
wordcnt = 0
end
end
sendto(line) if line
sendto _("NOTE: use @wizhelp for advanced commands") if world.can_build? id
else
q = world.cmds.find(args)
if q and world.can_build? id
if q.size > 0
sendto _("====================HELP=======================")
q.each do |h|
sendto(sprintf("%-10s - %s", h.name, h.help))
end
else
sendto _("No help on that.")
end
else
sendto _("No help on that.")
end
end
end
end