Gwen's MUSH Idler

From Gwen Morse's Wiki
Jump to: navigation, search

This will idle all MUSH-family based games on all connected worlds. MUD servers connected will probably return errors.

Call it with: /idler

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Auto-idler

/def idler=\
   /if (world_info()!~"") \
      /send -W @@%;\
      /repeat -0:6:00 1 /idler%;\
   /endif%;\
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Second version that changes idles by world type
;;;
;;; Diku-muds have a 'save' command that saves progress.

/def idler=\
   /if (world_info()!~"") \
	/if (${world_type} =/ "*diku*") \
		/send -w save%;\
	/elseif (${world_type} =/ "*tiny*") \
		/send -w @@%;\
	/else \
	/endif%;\
	/repeat -0:6:00 1 /idler%;\
   /endif%;\

Latest version with some simple connect/disconnect hooks

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Auto-idler
;;; Gwen Morse


;; Diku's don't seem to have an ignored garbage character like MU's @@
;; You can 'save' however and this is a safe command to send multiple times.
;; It's supposed to save your game status and it's good for your character.
;;
;; New Radiant Action: Now only sends idler command if you're connected to
;; at least one world. Added OCT 26 2011.
;;
;; Time set to 1 minute 30 seconds to get around my CrystalMUSH autostop
;; which is configured to 2 minutes.
;;
;; Feb 28 2014, modified code to borrow Christian Robinson's idler features.
;;

/def -i idler = \
  /let _worlds= %;\
  /let i=1 %;\
  /let _sockets=$(/listsockets -s) %;\
  /let _line=$(/nth %{i} %{_sockets}) %;\
  /while (_line !~ "") \
    /let _worlds=%_worlds %_line %;\
    /test ++i %; \
    /let _line=$(/nth %{i} %{_sockets}) %;\
  /done %;\
  /for i 1 $(/length %{_worlds}) \
    /send -w\$(/nth \%{i} \%{_worlds}) @@ %;\
  /repeat  -0:1:30 1 /idler %;\
  /set idlerpid %?

; This is a reconnect hook if you get disconnected (QUIT or game lost connection)
; It will not trigger if you use /dc (so you can close a world gracefully)

/def -Fp90 -h'disconnect' reconnect_hook = /retry %* 30

;; On CrystalMUSH Singer worlds connection check if in sled and refresh speed
/def -Fp90 -w'cm' -t'Last connect was from *.' cm_login_hook = \
  /if (LZ_ALT>=30 & FLYSET=~"add") \
    /send -w speed 26%;\
    /send -w TFRC: Testing for Sled Movement on reconnect%;\
  /endif

/def -Fp90  -w'ss' -t'Last connect was from *.' ss_login_hook = \
  /if (LZ_ALT>=30 & FLYSET=~"add") \
    /send -w speed 26%;\
    /echo -w TFRC: Testing for Sled Movement on reconnect%;\
  /endif