Random @doings on connect

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

Random @doings on Individual Worlds using Galvin's Virtual Array

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Random @doings on Individual Worlds
;
; Using the Virtual Array package, I can randomize @doing messages sent when I connect to
; any particular world I'm playing on (assuming I have the messages pre-configured into
; an array for that world).
;
; This usage is keyed to logging in specific worlds (the array varies by world-name).
; It could easily be modified to work on ANY connected world.
;
; By Gwen Morse
;
; Sample code:
;
;/test put_array('galli_doing', 0, '@doing SORTER: Please feed Reality Monkey!')
;/test put_array('galli_doing', 1, '@doing SORTER: Tallying the flaws.')
;/test put_array('galli_doing', 2, '@doing SORTER: Michiko\'s Lucky Charm.')


/def -p3 -F -1 -w -h"CONNECT" doing_connect_hook = \
    /test doing_value := get_array('${world_name}_doing',rand(0,get_array_count('${world_name}_doing',0)))%;\
        /send -w %{doing_value}%;\
        /send -w @pemit me=%{doing_value}

;;; If I don't like the @doing I ended up with, I can call it again with '/redoing'

/def -i -F -w -q redoing = \
        /test doing_value := get_array('${world_name}_doing',rand(0,get_array_count('${world_name}_doing',0)))%;\
        /send -w %{doing_value}%;\
        /send -w @pemit me=%{doing_value}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;