MU Soapbox

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Muxify
    • Mustard

    @scan and search tools for MUX

    MU Code
    4
    7
    2038
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Ashen-Shugar
      Ashen-Shugar last edited by Ashen-Shugar

      This is Penn's @scan and some additional tools for MUX2. Enjoy.

      @create ScanObj=10
      &CREDITS ScanObj=Ashen-Shugar@RhostMUSH
      &CMD_SCAN ScanObj=$@scan* *:@pemit %#=[u(do_scan[not(words(%0))][match(/room /self /zone /global,%0)],%0,%1,%#,$,@scan)]
      &DO_SCAN00 ScanObj=Unrecognized switch '[lcstr(secure(%0))]' for command %4.
      &CMD_SCAN2 ScanObj=$@scan:@pemit %#=What command do you want to scan for?
      &CMD_SCAN3 ScanObj=$@scan/*:@pemit %#=[u(do_scan00,/%0,x,x,x,@lscan)]
      &DO_SCAN10 ScanObj=[u(scan_contents,%0,%1,%2,%3,%4)][u(scan_self,%0,%1,%2,%3,%4)][u(scan_zone,%0,%1,%2,%3,%4)][u(scan_master,%0,%1,%2,%3,%4)]
      &DO_SCAN01 ScanObj=[u(scan_contents,%0,%1,%2,%3,%4)]
      &DO_SCAN02 ScanObj=[u(scan_self,%0,%1,%2,%3,%4)]
      &SCAN_CONTENTS ScanObj=%rMatching on contents of your location:[iter(setdiff(lcon(loc(%2)),%2),u(scan_obj,##,%1,%2,%3,%4),%b,@@)]
      &SCAN_OBJ ScanObj=[setq(v,0)][setq(1,trim(iter(lattrcmds(%0),u(scan_obj[hasflag(%0/##,regexp)],%0,%1,%2,%3,##),,@@)))][if(gt(words(%q1),0),%r[name(%0)]%(%0[flags(%0)]%) %[%qv: %q1%])]
      &SCAN_SELF ScanObj=%rMatching on self and carried objects:[iter(setunion(lcon(%2),%2),u(scan_obj,##,%1,%2,%3,%4),,@@)]
      &SCAN_ZONE ScanObj=%rMatching on zones in vicinity:[iter(setunion(lzone(loc(%2)),lzone(%2),u(dozone,[lcon(%2)] [lcon(loc(%2))])),u(scan_obj,##,%1,%2,%3,%4),,@@)]
      &DOZONE ScanObj=[iter(%0,lzone(##))]
      &DO_SCAN04 ScanObj=[u(scan_master,%0,%1,%2,%3,%4)]
      &DO_SCAN03 ScanObj=[u(scan_zone,%0,%1,%2,%3,%4)]
      &SCAN_MASTER ScanObj=%rMatching on master room:[iter(lcon(config(master_room)),u(scan_obj,##,%1,%2,%3,%4),,@@)]
      &CMD_LSCAN ScanObj=@listenscan* *:@pemit %#=[u(do_scan[not(words(%0))][match(/room /self /zone /global,%0)],%0,%1,%#,^,@lscan)]
      &CMD_LSCAN2 ScanObj=@listenscan:@pemit %#=What listen do you want to scan for?
      &CMD_LSCAN3 ScanObj=@listenscan/*:@pemit %#=[u(do_scan00,/%0,x,x,x,@lscan)]
      &CANUSE ScanObj=[gte(bittype(%#),5)]
      @lock/UseLock ScanObj=CANUSE/1
      &SCAN_OBJ0 ScanObj=[if(strmatch(%1,before(after(get(%0/%4),%3),:)),[setq(v,add(%qv,1))]%0/%4%b)]
      &SCAN_OBJ1 ScanObj=[if(regmatch(%1,before(after(get(%0/%4),%3),:)),[setq(v,add(%qv,1))]%0/%4%b)]
      &FUN_SCAN ScanObj=[u(scan_contents,%0,%1,%2,%3,%4)][u(scan_self,%0,%1,%2,%3,%4)][u(scan_zone,%0,%1,%2,%3,%4)][u(scan_master,%0,%1,%2,%3,%4)]
      &CMD_COMMANDTREE ScanObj=$+commandtree*:@pemit %#=[switch([gt(words(setr(1,locate(%#,%0,*))),0)][gt(words(%0),0)],?0,list(lcon(config(master_room)),[ansi(hc,[name(%i0)]%(%i0[flags(%i0)]%))][u(fn_pipe,%i0)]),01,CommandTree: Target not found[setq(1,X)],11,[ansi(hc,[name(%q1)]%(%q1[flags(%q1)]%))][u(fn_pipe,%q1)]%r)][if(not(match(X,%q1)),ansi(hc,<--END))]
      &FN_PIPE ScanObj=[setq(0,lcmds(%0,beep()))][iter(lattrcmds(%0),[if(or(not(words(%1)),regmatch(extract(%q0,#@,1,beep()),%1)),%r[ljust(if(hasflag(%0/%i0,noprog),ansi(hr,*LK*)),5)][ansi([ifelse(hasflag(%0/%i0,regexp),<#ffaf00>,<#af00ff>)],%i0)] -> [edit(edit(ansi(hg,extract(%q0,#@,1,beep())),*,ansi(hr,*)),?,ansi(hr,?))])])]
      &CMD_SEARCHTREE ScanObj=$+searchtree *:@pemit %#=[list(lcon(config(master_room)),[ansi(hc,[name(%i0)]%(%i0[flags(%i0)]%))][u(fn_pipe,%i0,edit(%0,+,%[+%]))])][if(not(match(X,%q1)),ansi(hc,<--END))]
      &CMD_SEARCHBYOBJ ScanObj=$+searchbyobj *=*:@pemit %#=[list([setdiff([setq(0,locate(%#,%0,*))] [lcon(loc(%q0))],#-1 #-2)],[ansi(hc,[name(%i0)]%(%i0[flags(%i0)]%))][u(fn_pipe,%i0,edit(%1,+,%[+%]))])][if(not(match(X,%q1)),ansi(hc,<--END))]
      &CMD_SEARCHALL ScanObj=$+searchall *:@pemit %#=[list(search(eval=%[grep%(##%,*%,%0%)%]),[ansi(hc,[name(%i0)]%(%i0[flags(%i0)]%))][u(fn_pipe,%i0,edit(%0,+,%[+%]))])][if(!match(X,%q1),ansi(hc,<--END))]
      @set ScanObj=INHERIT
      @set ScanObj=SAFE
      
      Thenomain 1 Reply Last reply Reply Quote 0
      • Thenomain
        Thenomain @Ashen-Shugar last edited by

        @Ashen-Shugar

        Is there, er, a help file?

        “If you wish to make an apple pie from scratch, you must first invent the universe.”
        ― Carl Sagan, Cosmos

        Ashen-Shugar 1 Reply Last reply Reply Quote 0
        • Ashen-Shugar
          Ashen-Shugar @Thenomain last edited by

          @Thenomain said in @scan and search tools for MUX:

          @Ashen-Shugar

          Is there, er, a help file?

          Narp.

          But, here's the help.

          • @scan <command> -- Find the dbref# in your search path that contains the exact match of the command.
            • Example: @scan +who
            • Example: @scan +finger Thenomain
            • Switches:
              • /global -- default - shows all locations
              • /room - show only current room
              • /self - show only on current person and inventory
              • /zone - show in zone only
          • @listenscan <command> - Find dbref# in search path with exact listen (^) match
            • Examples: Same as with @scan
            • Switches: Same as with @scan
          • +commandtree [<dbref#>] - Show all commands in the master room. Optionally specify a dbref# to just do that specific object.
            • Example: +commandtree
            • Example: +commandtree #1234
          • +searchtree <partial command prefix> - Search the master room for all dbref#'s that contain a command starting with the partial.
            • Example: +searchtree +fi
            • Example: +searchtree +set
          • +searchbyobj <object>=<partial command prefix> -- Search the target and anything around target for dbref#'s that contain a command matching partial match
            • Example: +searchbyobj #123=+fi
            • Example: +searchbyobj %#=+set
          • +searchall <partial command prefix> - Search the entire db for dbref#'s with the partial command match.
            • Example: +searchall +fi
            • Example: +searchall +set strength=

          And that's that.

          1 Reply Last reply Reply Quote 0
          • I
            ixokai last edited by

            As someone with the memory of a gecko, I can't code without @scan.

            I'm just saying.

            Ashen-Shugar Thenomain 2 Replies Last reply Reply Quote 0
            • Ashen-Shugar
              Ashen-Shugar @ixokai last edited by

              @ixokai said in @scan and search tools for MUX:

              As someone with the memory of a gecko, I can't code without @scan.

              I'm just saying.

              Here's the Rhost equiv of the added features for @scan, @ixokai

              &CMD_COMMANDTREE Global: ScanObj <SO>=$+commandtree*:@pemit %#=[switch([!!^setr(1,locate(%#,%0,*))][!!$v(0)],?0,list(lcon(globalroom()),[ansi(hc,[name(%i0)]%(%i0[flags(%i0)]%))][u(fn_pipe,%i0)]),01,CommandTree: Target not found[setq(1,X)],11,[ansi(hc,[name(%q1)]%(%q1[flags(%q1)]%))][u(fn_pipe,%q1)]%r)][ifelse(!match(X,%q1),ansi(hc,<--END))]
              &FN_PIPE Global: ScanObj <SO>=[setq(0,lcmds(%0,beep()))][iter(lattr(%0,,$),[ifelse(or(!$v(1),regmatch(extract(%q0,#@,1,beep()),%1)),%r[ljc(ifelse(hasflag(%0/%i0,noprog),ansi(hr,*LK*)),5)][ansi([ifelse(hasflag(%0/%i0,regexp),+orange,+purple)],%i0)] -> [edit(edit(ansi(hg,extract(%q0,#@,1,beep())),*,ansi(hr,*)),?,ansi(hr,?))])])]
              &CMD_SEARCHTREE Global: ScanObj <SO>=$+searchtree *:@pemit %#=[list(lcon(globalroom()),[ansi(hc,[name(%i0)]%(%i0[flags(%i0)]%))][u(fn_pipe,%i0,edit(%0,+,%[+%]))])][ifelse(!match(X,%q1),ansi(hc,<--END))]
              &CMD_SEARCHBYOBJ Global: ScanObj <SO>=$+searchbyobj *=*:@pemit %#=[list([listdiff([setq(0,locate(%#,%0,*))] [lcon(loc(%q0))],#-1 #-2)],[ansi(hc,[name(%i0)]%(%i0[flags(%i0)]%))][u(fn_pipe,%i0,%1)])][ifelse(!match(X,%q1),ansi(hc,<--END))]
              &CMD_SEARCHDB Global: ScanObj <So>=$+searchdb *:@break [lt(bittype(%#),6)]=@pemit %#=Permission denied;@pemit %#=[list(search(eval=%[grep%(##%,*%,*%0*%)%]),[ansi(hc,[name(%i0)]%(%i0[flags(%i0)]%))][u(fn_pipe,%i0,edit(%0,+,%[+%]))])][ifelse(!match(X,%q1),ansi(hc,<--END))]
              
              1 Reply Last reply Reply Quote 0
              • Thenomain
                Thenomain @ixokai last edited by

                @ixokai said in @scan and search tools for MUX:

                As someone with the memory of a gecko, I can't code without @scan.

                I'm just saying.

                In the Mux world, it's @whence. As it isn't mine, I didn't post the softcode anywhere, but same thing different @Chime.

                “If you wish to make an apple pie from scratch, you must first invent the universe.”
                ― Carl Sagan, Cosmos

                1 Reply Last reply Reply Quote 0
                • Lithium
                  Lithium last edited by

                  This is rather neat. Thanks @Ashen-Shugar .

                  Also, I did fix that problem... was a simple /space/. Silly spaces messing up code...

                  Hello! Long time listener, first time caller...

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post