Other Codebase Compatibility @functions, v 2.0.2

Submitted by Kyrion on Tue, 2011-07-12 00:08

All right, here's a real introduction. This project is a major re-write and expansion of one by Raevnos. The code that follows implements a number (111, to be precise) of functions from other codebases in PennMUSH. Nearly all of these are from TinyMUSH or TinyMUX, which are the two other codebases I've written a significant amount of code for, but there are also a few from RhostMUSH. I hope this would be useful in porting code. A full list of functions and known incompatibilities is in the main object's @DESCRIBE, but it would be easier to list the functions that I didn't port:

  • Anything added after MUX 2.10.0.7 or TinyMUSH version 3.1 patchlevel 5
  • Functions relating to TinyMUSH features that Penn doesn't have: modules, stacks, structures, x-variables, the PRESENCE flag, and @program
  • MUX's moniker(), whose closest moral equivalent would be accname(), and strmem()
  • Comsys functions
  • Some side-effect functions, such as trigger() and wait()
  • Name conflicts, such as list()
  • A couple that didn't meet the cost-benefit test, such as crc32() and distribute()


@@ Other Codebase Compability @functions, version 2.0.2
@@ Copyright © 2011 Ton Kyrion (Pseudonym). All rights reserved.
@@
@@ I hereby release this code under the MIT license:
@@
@@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software
@@ and associated documentation files (the "Software"), to deal in the Software without restriction,
@@ including without limitation the rights to use, copy, modify, merge, publish, distribute,
@@ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
@@ furnished to do so, subject to the following conditions:
@@
@@ The above copyright notice and this permission notice shall be included in all copies or
@@ substantial portions of the Software.
@@
@@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
@@ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
@@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
@@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@
@@ -------------------------------------------------------------------------------------------------
@@ This is a major re-write and expansion of Raevnos' public-domain version of the Other Codebase
@@ Compatibility @functions. To see how much of one, look at the object. I created it for Dawn on
@@ the Edge of Forever MUSH, which you're welcome to visit at dawn.genesismuds.com port 6440
@@ (Telnet) or 6441 (SSL).
@@
@@ Please send bug reports and feedback to kyrion@genesismuds.com.
@@
@@ This file consists of a @decompile of several of the components of the system. On Dawn on the
@@ Edge of Forever, #8 is the main object, and #10 is an extra I created when the @function
@@ declarations overflowed its @startup. #15 is the event handler, and it is likely that you will
@@ want to merge the code here with your own rather than add it. None of these objects belong in
@@ the Master Room. #13 is a more traditional connect-listener, which does belong in the Master Room.
@@
@@ First, though, here is the @startup of the God character. Again, you will want to replace the
@@ DB numbers with the equivalents on your MUSH and merge rather than replace whatever you have in
@@ #1's startup currently. DO NOT JUST COPY AND PASTE THIS! Thank you. This section must be run by
@@ the God character.
@@
@@ v2.0.2: Re-wrote url_escape() and url_unescape() so as not to depend on helper functions.
@@ Removed all helper functions and their container. Also fixed a bug with ansipos() and
@@ strings containing Pueblo tags.
@@ v2.0.1: New implementations of pack() and unpack() with less overhead.
@@ v2.0: Added 102 functions.
@@
@STARTUP #1=@restart #8; @restart #10; @attribute/access connmax=wizard; @attribute/limit connmax=^\\d+$; @attribute/access connnum=wizard; @attribute/limit connnum=^\\d+$; @attribute/access conntotal=wizard; @attribute/limit conntotal=^\\d+$; @attribute/access freshconnect=wizard; @attribute/limit freshconnect=^\\d+$; @attribute/access connlast=wizard; @attribute/limit connlast=^\\d+$; @attribute/access LAST_PLAYER=wizard; @attribute/access LAST_THING=wizard; @attribute/access LAST_ROOM=wizard; @attribute/access LAST_EXIT=wizard; @attribute/access ShortDesc=visual nearby
@@
@@ Everything below this line must be run by a wizard. These objects do not belong in the Master Room:
@@
@@ Other Codebase Compability @functions (#8)
@create Other Codebase Compability @functions
@link Other Codebase Compability @functions = #5
@lock/Basic Other Codebase Compability @functions==me
@lset Other Codebase Compability @functions/Basic=no_inherit
@set Other Codebase Compability @functions = WIZARD
@set Other Codebase Compability @functions = NO_COMMAND
@power Other Codebase Compability @functions = Functions
@power Other Codebase Compability @functions = No_Pay
@power Other Codebase Compability @functions = MANY_ATTRIBS
&ACOSD Other Codebase Compability @functions=objeval(%@,acos(%0,d))
&ANDBOOL Other Codebase Compability @functions=objeval(%@,lmath(and,[tbool(%0)] [iter(%1,tbool(%i0),\,,%b)]))
&ANDZ Other Codebase Compability @functions=objeval(%@,lmath(and,[truez(%0)] [iter(%1,truez(%i0),\,,%b)]))
&ANSIPOS Other Codebase Compability @functions=objeval(%@,localize(ifelse(regmatch(decompose(mid(%0,%1,1)),\\\[ansi\\\((\\w+)\\\,.+\\\)\\\],-1 a),%qa,n)))
&ASIND Other Codebase Compability @functions=objeval(%@,asin(%0,d))
&ATAND Other Codebase Compability @functions=objeval(%@,atan(%0,d))
&BITTYPE Other Codebase Compability @functions=objeval(%@,letq(0,num(owner(%0)),case(1,not(hastype(%q0,PLAYER)),#-1,strmatch(%q0,#1),7,hasflag(%q0,WIZARD),5,hasflag(%q0,ROYALTY),4,haspower(%q0,builder),3,hasflag(%q0,JUDGE),2,cor(haspower(%q0,guest),hasflag(%q0,UNINSPECTED)),0,1)))
&BORDER Other Codebase Compability @functions=objeval(%@,iter(wrap(edit(%0,%t,%b),%1),%2[ljust(%i0,%1)]%3,%r,%r))
&CANDZ Other Codebase Compability @functions=objeval(%@,letq(r,1,[iter(%0,if(not(truez(%i0)),[setq(r,0)][ibreak()]),\,,)]%qr))
&CBORDER Other Codebase Compability @functions=objeval(%@,iter(wrap(edit(%0,%t,%b),%1),%2[center(%i0,%1)]%3,%r,%r))
&CHOMP Other Codebase Compability @functions=objeval(%@,regedit(%0,%r$,))
&CHOOSE Other Codebase Compability @functions=objeval(%@,localize([ifelse(eq(words(%0,%2),words(%1)),[setq(x,rand(1,ladd(%1)))][extract(%0,inc(ladd(map(#lambda/lt(\%0,\%qx),fold(#lambda/\[add(\%1,first(\%0))\] \%0,%1)))),1,%2)],#-1 LISTS MUST BE OF EQUAL SIZE)])
&COLORDEPTH Other Codebase Compability @functions=localize([objeval(%@,ifelse(isint(%0),[setq(0,%0)][setq(p,player(%0))],[setq(0,locate(me,%0,Pahilmny))][setq(p,%q0)]))][case(1,not(hastype(%qp,PLAYER)),#-1,pueblo(%q0),24,hasflag(%qp,ANSI),4,0)])
&COLUMNS Other Codebase Compability @functions=objeval(%@,localize([setq(3,case(%3,,0,%3))][iter(table(%0,dec(%1),sub(78,%q3),%2),[space(%q3)]%i0,%r,%r)][if(t(words(%0,%2)),%r)]))
&CONNLEFT Other Codebase Compability @functions=convtime(xget(objeval(%@,num(%0)),LASTLOGOUT))
&CONNRECORD Other Codebase Compability @functions=3
&CORZ Other Codebase Compability @functions=objeval(%@,cor(truez(s(%0)),truez(s(%1)),truez(s(%2)),truez(s(%3)),truez(s(%4)),truez(s(%5)),truez(s(%6)),truez(s(%7)),truez(s(%8)),truez(s(%9))))
&COSD Other Codebase Compability @functions=objeval(%@,cos(%0,d))
&CPAD Other Codebase Compability @functions=objeval(%@,localize([setq(m,strlen(%0))][ifelse(gte(%qm,%1),%0,[setq(2,case(%2,,%b,%2))][setq(n,strlen(%q2))][setq(h,div(sub(%1,%qm),2))][strreplace(left(repeat(%q2,div(add(%1,%qn,-1),%qn)),%1),%qh,%qm,%0)])]))
&CREDITS Other Codebase Compability @functions=Copyright (c) 2011 Ton Kyrion (pseudonym). All rights reserved. You have my permission to redistribute and use this code, with or without modification, so long as you retain this notice whenever you redistribute it. Based on public-domain code by Raevnos.
&CTABLES Other Codebase Compability @functions=objeval(%@,localize([setq(4,case(%4,,%b,%4),5,case(%5,,%b,%5),6,case(%6,,%b,%6),s,words(%1))][case(%3,,iter(%0,iter(iter(lnum(1,words(%i0,%q4),%b,%qs),extract(%i1,%i0,%qs,%q4),%b,%r),%2[iter(%i0,letq(L,elements(%1,inum(0)),left(center(%i0,%qL,%q6),%qL)),%q4,%q5)],%r,%r),%r,%r),iter(%0,iter(iter(lnum(1,words(%i0,%q4),%b,%qs),extract(%i1,%i0,%qs,%q4),%b,%r),%2[iter(%i0,letq(L,elements(%1,inum(0)),left(center(%i0,%qL,%q6),%qL)),%q4,%q5)][if(lt(words(%i0,%q4),%qs),%q5[iter(lnum(inc(words(%i0,%q4)),%qs),repeat(%q6,elements(%1,%i0)),%b,%q5)])]%3,%r,%r),%r,%r))]))
&DELIMIT Other Codebase Compability @functions=objeval(%@,iter(get(%0),%i0,%2,%1))
@DESCRIBE Other Codebase Compability @functions=Emulation of various functions from TinyMUSH 3, plus a few from Rhost. Useful for porting code from other mush servers to PennMUSH 1.7.3+.%r%r[ljust(Function, 20)] TinyMUSH3 Rhost%r[ljust(ladd, 20)] [center(X, 9)] %b%bX%r[ljust(land\, lor, 20)] [center(X, 9)] %b%bX%r[ljust(lmin\, lmax, 20)] [center(X, 9)] %b%bX%r[ljust(ljc\, rjc, 20)] [space(9)] %b%bX%r[ljust(ncomp, 20)] [center(X, 9)] %b%bX%r[ljust(streq, 20)] [center(X, 9)] %b%bX%r%r[ansi(h,Added by Ton Kyrion:)]%r%r[ansi(uh,Function)]%r[table(acosd andbool ansipos asind atand attrcnt bittype border candbool cborder chomp colordepth columns connlast connleft connmax connnum conntotal connrecord corbool cosd cpad ctables delimit digittime dumping elockstr error exptime group hasflags hasquota helptext html_escape html_unescape iabs iadd idiv iffalse iftrue imul inzone isfalse isign isort israt istrue landbool lastobject lattrcmds lcmds ldiff ledit linter loop lorbool lpad lrand lreplace lunion motd nescape nonzero notbool nsecure objcall orbool pack pfind playmem private qvars rborder restartsecs roman rtables session sha1 sind singletime startsecs strip strtrunc subeval successes tables tand translate unpack until uprivate url_escape url_unescape usefalse usetrue whenfalse whentrue while wildmatch writable writetime xorbool,14)]%r%r[ansi(uh,Compatibility notes:)]%rThe TinyMUX version of attrcnt()\, like its version of lattr()\, works on objects the caller can't examine.%b This version does not.%b As Penn lacks percent substitutions for ansi codes\, this implementation of ansipos() does not support a third argument.%b The border() family of functions will insert dashes if it wraps a word across multiple lines\, which the TinyMUSH function will not do.%b The expression \[ctables\(foo,6,,,,,.\)\] evaluates to ..foo. on Tiny and .foo.. on Penn. %bI only implemented the three-argument form of delimit(). %bThe iftrue() and iffalse() functions parse backslashes strangely on Tiny. %bI haven't tried to emulate this behavior; suffice it to say that #\\$ will give you a literal #$ in the output. %bThe loop() function is implemented as an iter() with \%r as the output delimiter, losing its special semantics.%b I've made many functions give error messages on garbage inputs\, instead of failing silently in undocumented ways.%b These include: colordepth(), hasquota(), iabs(), iadd(), idiv(), imul(), isign(), isub() and translate().%b The builtin function controls() is buggy with respect to attributes\, and writable() reflects this.%b The return value of lastobject() is an objid rather than a dbref.%r%r[space(5)]I've retained PennMUSH semantics for output delimiters: the null delimiter is a blank argument, not @@. %bIf the input delimiters of isfalse() and istrue() contain side-effect functions, they might get called more than once.%b The successes() function does not take a "version" argument.%b Functions that potentially take more than 10 arguments generally don't handle arguments containing commas correctly\; use the list equivalents instead for this.%b Several time functions on TinyMUX\, notably writetime() and singletime()\, erroneously report intervals of "months" and "years" that contradict the common meaning of those words.%b This implementation keeps the values in days.%r%r[space(5)]This implementation configures booleans to have their Penn interpretation\, and makes Tiny's *bool family of functions available as aliases.%b I provide land(), landbool(), lor(), lorbool() and xorbool() with TinyMUSH semantics.%b I also provide the following functions\, which take what TinyMUX calls z-booleans: andz(), candz(), corz(), notz(), truez(), xorz().%b These are not actually compatible with Tiny\, but they could ease porting code that depends on all DBREFs being false.%r%r[space(5)]Lattrcmds() takes an optional second argument.%b If this is 1\, the function checks the no_command flag on the object and attributes.
@set Other Codebase Compability @functions/DESCRIBE=no_command visual prefixmatch nearby
&DIGITTIME Other Codebase Compability @functions=objeval(%@,trim(etimefmt($xzD $2H:$2M,%0))
&DUMPING Other Codebase Compability @functions=0
&ELOCKSTR Other Codebase Compability @functions=localize([setq(0,objeval(%@,num(%0)),1,objeval(%@,num(%1)))][ifelse(or(strmatch(%q1,%@),nearby(%q1,%@)),ifelse(controls(%@,%q0),objeval(%@,testlock(%2,%q1)),#-1 PERMISSION DENIED),#-1 TOO FAR AWAY)])
&ERROR Other Codebase Compability @functions=Huh?%b (Type "help" for help.)
&EXPTIME Other Codebase Compability @functions=objeval(%@,squish(etimefmt($xzd $xzh $xzm $xs,%0)))
&F_CONNLAST Other Codebase Compability @functions=letq(0,objeval(%@,locate(me,%0,Pahilmny)),ifelse(hastype(%q0,PLAYER),get(%q0/connlast),#-1 PLAYER NOT FOUND))
&F_CONNMAX Other Codebase Compability @functions=letq(0,objeval(%@,locate(me,%0,Pahilmny)),ifelse(hastype(%q0,PLAYER),max(default(%q0/connmax,0),conn(%q0)),#-1 PLAYER NOT FOUND))
&F_CONNNUM Other Codebase Compability @functions=letq(0,objeval(%@,locate(me,%0,Pahilmny)),ifelse(hastype(%q0,PLAYER),default(%q0/connnum,0),#-1 PLAYER NOT FOUND))
&F_CONNTOTAL Other Codebase Compability @functions=letq(0,objeval(%@,locate(me,%0,Pahilmny)),ifelse(hastype(%q0,PLAYER),add(default(%q0/conntotal,0),conn(%q0)),#-1 PLAYER NOT FOUND))
&FCOUNT Other Codebase Compability @functions=case(%0,,dec(first(%?)),objeval(%@,sub(-3,sub(first(%?),[null(s(%0))][first(%?)]))))
&FDEPTH Other Codebase Compability @functions=case(%0,,last(%?),sub(last(%?),[null(objeval(%@,%1))][last(%?)]))
&GROUP Other Codebase Compability @functions=objeval(%@,localize([setq(2,case(%2,,%b,%2))][setq(3,case(0,gt(%+,3),%q2,strlen(%3),,%3))][setq(4,case(0,gt(%+,4),%3,strlen(%4),,%4))][setq(w,words(%0,%q2))][iter(iter(lnum(1,%1),lnum(%i0,%qw,%b,%1),%b,%r),iter(%i0,elements(%0,%i0,%q2),%b,%q3),%r,%q4)]))
&HASFLAGS Other Codebase Compability @functions=objeval(%@,letq(0,num(%0),cor(andlflags(%q0,%1),andlflags(%q0,%2),andlflags(%q0,%3),andlflags(%q0,%4),andlflags(%q0,%5),andlflags(%q0,%6),andlflags(%q0,%7),andlflags(%q0,%8),andlflags(%q0,%9))))
&HASQUOTA Other Codebase Compability @functions=letq(0,objeval(%@,locate(me,%0,Pahilmny)),case(0,isint(%1),#-1,isdbref(%q0),#-1,gte(sub(quota(%q0),nlsearch(%q0),%1),0))
&HTML_ESCAPE Other Codebase Compability @functions=objeval(%@,edit(%0,&,&amp\;,<,&lt\;,>,&gt\;,",&quot\;))
&HTML_UNESCAPE Other Codebase Compability @functions=objeval(%@,edit(%0,&lt\;,<,&gt\;,>,&quot\;,",&amp\;,&))
&IABS Other Codebase Compability @functions=objeval(%@,ifelse(isnum(%0),abs(trunc(%0)),#-1 ARGUMENTS MUST BE NUMBERS))
&IADD Other Codebase Compability @functions=objeval(%@,ladd(iter(%0,ifelse(isnum(%i0),trunc(%i0),#-1),\,,%b)))
&IDIV Other Codebase Compability @functions=objeval(%@,ifelse(cand(isnum(%0),isnum(%1)),div(trunc(%0),trunc(%1)),#-1 ARGUMENTS MUST BE NUMBERS))
&IFFALSE Other Codebase Compability @functions=objeval(%@,ifelse(t(s(%0)),s(switch\(%0,*,%2\)),s(switch\(%0,*,%1\))))
&IFTRUE Other Codebase Compability @functions=objeval(%@,ifelse(t(s(%0)),s(switch\(%0,*,%1\)),s(switch\(%0,*,%2\))))
&IMUL Other Codebase Compability @functions=objeval(%@,lmath(mul,iter(%0,ifelse(isnum(%i0),trunc(%i0),#-1),\,,%b)))
&INZONE Other Codebase Compability @functions=objeval(%@,lsearch(all,zone,%0))
&ISFALSE Other Codebase Compability @functions=objeval(%@,elements(%0,s(iter\(%0,if(not(%1),inum(0)),%2,\%b\)),s(%2),case(%+,4,s(%3),%b)))
&ISORT Other Codebase Compability @functions=objeval(%@,letq(3,case(%+,4,%3,3,%2,%b),sortkey(#lambda/elements(%0,\%0,%2),lnum(1,words(%0,%2)),%1,%b,%q3)))
&ISRAT Other Codebase Compability @functions=regmatch(%0,^(\\+|\\-)?\\d*\\.?\\d+$)
&ISTRUE Other Codebase Compability @functions=objeval(%@,elements(%0,s(iter\(%0,if(t(%1),inum(0)),%2,\%b\)),s(%2),case(%+,4,s(%3),%b)))
&ISUB Other Codebase Compability @functions=objeval(%@,sub(ifelse(isnum(%0),trunc(%0),#-1),ifelse(isnum(%1),trunc(%1),#-1)))
&LADD Other Codebase Compability @functions=objeval(%@,lmath(add, %0, %1))
&LAND Other Codebase Compability @functions=objeval(%@,letq(1,case(%1,,%b,%1),lmath(and,iter(%0,truez(%i0),%q1,%q1),%q1)))
&LANDBOOL Other Codebase Compability @functions=objeval(%@,letq(1,case(%1,,%b,%1),lmath(and,iter(%0,t(%i0),%q1,%q1),%q1)))
&LANDZ Other Codebase Compability @functions=objeval(%@,letq(1,case(%1,,%b,%1),lmath(and,iter(%0,truez(%i0),%q1,%q1),%q1)))
&LASTCREATE Other Codebase Compability @functions=localize([setq(0,case(%0,,%@,objeval(%@,num(%0))))][ifelse(controls(%@,%q0),switch(%1,P*,default(%q0/LAST_PLAYER,#-1),T*,default(%q0/LAST_THING,#-1),E*,default(%q0/LAST_EXIT,#-1),R*,default(%q0/LAST_ROOM,#-1),,first(sort([get(%q0/LAST_PLAYER)] [get(%q0/LAST_THING)] [get(%q0/LAST_ROOM)] [get(%q0/LAST_EXIT)],ctime)),#-1 INVALID OBJECT TYPE),#-1 PERMISSION DENIED)])
&LATTRCMDS Other Codebase Compability @functions=objeval(%@,localize([setq(0,num(%0))][setq(a,wildgrep(%q0,*,$*:*))][case(1,not(%1),%qa,hasflag(%q0,no_command),,filter(#lambda/not(hasflag(%q0/\%0,no_command)),%qa))]))
&LCMDS Other Codebase Compability @functions=objeval(%@,localize([setq(0,num(%0))][setq(1,case(%1,,%b,%1))][setq(2,case(%2,,$,%2))][setq(a,wildgrep(%q0,*,%q2*:*))][case(%q2,$,iter(%qa,[null(strmatch(xget(%q0,%i0),$*:*,p))]%qp,%b,%q1),^,iter(%qa,[null(strmatch(xget(%q0,%i0),^*:*,p))]%qp,%b,%q1),#-1 UNSUPPORTED TYPE)]))
&LDIFF Other Codebase Compability @functions=objeval(%@,setdiff(%0,%1,%3,%2,case(%+,5,%4,4,case(%3,,%b,%3),%b)))
&LEDIT Other Codebase Compability @functions=objeval(%@,localize([setq(3,case(%3,,%b,%3))][setq(4,case(%+,5,%4,4,%q3,%b))][iter(%0,case(member(%1,%i0,%q3),0,%i0,elements(%2,%$0,%q3)),%q3,%q4)]))
&LINTER Other Codebase Compability @functions=objeval(%@,setinter(%0,%1,%3,%2,case(%+,5,%4,4,case(%3,,%b,%3),%b)))
&LJC Other Codebase Compability @functions=objeval(%@,ljust(left(%0, %1), %1, %2))
&LMAX Other Codebase Compability @functions=objeval(%@,lmath(max, %0, %1))
&LMIN Other Codebase Compability @functions=objeval(%@,lmath(min, %0, %1))
&LOOP Other Codebase Compability @functions=objeval(%@,s(iter\(%0,%1,%2,%r\)))
&LOR Other Codebase Compability @functions=objeval(%@,letq(1,case(%1,,%b,%1),lmath(or,iter(%0,truez(%i0),%q1,%q1),%q1)))
&LORBOOL Other Codebase Compability @functions=objeval(%@,letq(1,case(%1,,%b,%1),lmath(or,iter(%0,t(%i0),%q1,%q1),%q1)))
&LORZ Other Codebase Compability @functions=objeval(%@,letq(1,case(%1,,%b,%1),lmath(or,iter(%0,truez(%i0),%q1,%q1),%q1)))
&LPAD Other Codebase Compability @functions=objeval(%@,localize([setq(m,strlen(%0))][ifelse(gte(%qm,%1),%0,[setq(2,case(%2,,%b,%2))][setq(n,strlen(%q2))][setq(h,div(sub(%1,%qm),2))][strreplace(left(repeat(%q2,div(add(%1,%qn,-1),%qn)),%1),0,%qm,%0)])]))
&LRAND Other Codebase Compability @functions=objeval(%@,s(iter\(lnum(%2),rand(%0,%1),%b,case(%+,4,%3,\%b)\)))
&LREPLACE Other Codebase Compability @functions=objeval(%@,localize([setq(3,case(%3,,%b,%3))][setq(i,decompose(%q3))][setq(4,case(%+,5,%4,4,%q3,%b))][setq(w,words(%2))][case(%qw,words(%1,%q3),iter(fold(#lambda/replace(\%0,elements(%2,\%1),elements(%1,\%1,%qi),%qi),lnum(1,%qw),%0),%i0,%q3,case(%+,5,%q4,%b)),#-1 NUMBER OF WORDS MUST BE EQUAL)]))
&LUNION Other Codebase Compability @functions=objeval(%@,setunion(%0,%1,%3,%2,case(%+,5,%4,4,case(%3,,%b,%3),%b)))
&MOTD Other Codebase Compability @functions=objeval(%@,list(motd))
&NCOMP Other Codebase Compability @functions=objeval(%@,sign(sub(%1, %0)))
&NESCAPE Other Codebase Compability @functions=objeval(%@,escape(%0))
&NONZERO Other Codebase Compability @functions=objeval(%@,case(0,strlen(%0),%2,isnum(%0),%1,trunc(%0),%2,%1))
&NOTBOOL Other Codebase Compability @functions=not(trunc(%0))
&NOTZ Other Codebase Compability @functions=objeval(%@,not(trunc(%0)))
&NSECURE Other Codebase Compability @functions=objeval(%@,secure(%0))
&OBJCALL Other Codebase Compability @functions=s(objeval\(ifelse(controls(%@,objeval(%@,num(%0))),objeval(%@,num(%0)),%@),ulambda(#lambda/[escape(objeval(%@,default(%1,)))],%2)\))
&ORBOOL Other Codebase Compability @functions=objeval(%@,lmath(or,[tbool(%0)] [iter(%1,tbool(%i0),\,,%b)]))
&ORZ Other Codebase Compability @functions=objeval(%@,lmath(or,[truez(%0)] [iter(%1,truez(%i0),\,,%b)]))
&PACK Other Codebase Compability @functions=objeval(%@,letq(0,abs(%0),1,case(%1,,64,%1),case(0,cand(isint(%0),isint(%q1)),#-1 ARGUMENTS MUST BE INTEGERS,cand(gt(%q1,1),lte(%q1,64)),#-1 RADIX MUST BE AN INTEGER BETWEEN 2 and 64,gt(%q1,36),ucstr(baseconv(%0,10,%q1)),[if(lt(%0,0),-)][foreach(#lambda/mid(0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@$,lpos(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_,\%0),1),baseconv(%q0,10,%q1))])))
&PFIND Other Codebase Compability @functions=locate(%@,%0,Pamy)
&QVARS Other Codebase Compability @functions=objeval(%@,case(words(%0),words(%1,%2),iter(lnum(1,%$0),setq(elements(%0,%i0),elements(%1,%i0,%2)),%b,),#-1 LISTS MUST BE OF EQUAL SIZE))
&RBORDER Other Codebase Compability @functions=objeval(%@,iter(wrap(edit(%0,%t,%b),%1),%2[rjust(%i0,%1)]%3,%r,%r))
&RESTARTSECS Other Codebase Compability @functions=objeval(%@,convtime(restarttime()))
&RJC Other Codebase Compability @functions=objeval(%@,rjust(left(%0, %1), %1, %2))
&ROMAN Other Codebase Compability @functions=objeval(%@,case(0,isint(%0),#-1 NON COMPOS MENTIS,gte(%0,0),#-1 PARUM,gt(%0,0),NULLA,lt(%0,4000),#-1 NIMIUM,[case(div(%0,1000),1,M,2,MM,3,MMM)][case(div(mod(%0,1000),100),1,C,2,CC,3,CCC,4,CD,5,D,6,DC,7,DCC,8,DCCC,9,CM)][case(div(mod(%0,100),10),1,X,2,XX,3,XXX,4,XL,5,L,6,LX,7,LXX,8,LXXX,9,XC)][case(mod(%0,10),1,I,2,II,3,III,4,IV,5,V,6,VI,7,VII,8,VIII,9,IX)])
&RPAD Other Codebase Compability @functions=objeval(%@,localize([setq(m,strlen(%0))][ifelse(gte(%qm,%1),%0,[setq(2,case(%2,,%b,%2))][setq(n,strlen(%q2))][setq(h,div(sub(%1,%qm),2))][strreplace(left(repeat(%q2,div(add(%1,%qn,-1),%qn)),%1),sub(%1,%qm),%qm,%0)])]))
&RTABLES Other Codebase Compability @functions=objeval(%@,localize([setq(4,case(%4,,%b,%4),5,case(%5,,%b,%5),6,case(%6,,%b,%6),s,words(%1))][case(%3,,iter(%0,iter(iter(lnum(1,words(%i0,%q4),%b,%qs),extract(%i1,%i0,%qs,%q4),%b,%r),%2[iter(%i0,letq(L,elements(%1,inum(0)),left(rjust(%i0,%qL,%q6),%qL)),%q4,%q5)],%r,%r),%r,%r),iter(%0,iter(iter(lnum(1,words(%i0,%q4),%b,%qs),extract(%i1,%i0,%qs,%q4),%b,%r),%2[iter(%i0,letq(L,elements(%1,inum(0)),left(rjust(%i0,%qL,%q6),%qL)),%q4,%q5)][if(lt(words(%i0,%q4),%qs),%q5[iter(lnum(inc(words(%i0,%q4)),%qs),repeat(%q6,elements(%1,%i0)),%b,%q5)])]%3,%r,%r),%r,%r))]))
&SESSION Other Codebase Compability @functions=objeval(%@,[cmds(%0)] [sent(%0)] [recv(%0)])
&SHA1 Other Codebase Compability @functions=objeval(%@,ucstr(digest(sha1,%0)))
&SIND Other Codebase Compability @functions=objeval(%@,sin(%0,d))
&SINGLETIME Other Codebase Compability @functions=objeval(%@,first(timestring(%0)))
&STARTSECS Other Codebase Compability @functions=objeval(%@,convtime(starttime()))
@STARTUP Other Codebase Compability @functions=@function acosd=me, acosd, 1, 1; @function andz=me, andz, 2, -2; @function ansipos=me, ansipos, 2, 2; @function asind=me, asind, 1, 1; @function atand=me, atand, 1, 1; @function bittype=me, bittype, 1, 1; @function border=me, border, 2, 4; @function candz=me, candz, 1, -1; @function cborder=me, cborder, 2, 4; @function chomp=me, chomp, 1, 1; @function choose=me, choose, 2, 3; @function colordepth=me, colordepth, 1, 1; @function columns=me, columns, 2, 4; @function connlast=me, f_connlast, 1, 1; @function connleft=me, connleft, 1, 1; @function connmax=me, f_connmax, 1, 1; @function connnum=me, f_connnum, 1, 1; @function connrecord=me, connrecord, 0, 0; @function conntotal=me,f_conntotal, 1, 1; @function corz=me, corz, 2, 10; @function cosd=me, cosd, 1, 1; @function cpad=me, cpad, 2, 3; @function ctables=me, ctables, 2, 7; @function delimit=me, delimit, 3, 3; @function digittime=me, digittime, 1, 1; @function dumping=me, dumping, 0, 0; @function elockstr=me, elockstr, 3, 3; @function error=me, error, 0, -1; @function exptime=me, exptime, 1, 1; @function fcount=me, fcount, 0, -1; @function fdepth=me, fdepth, 0, 0; @function group=me, group, 2, 5; @function hasflags=me, hasflags, 2, 10; @function hasquota=me, hasquota, 2, 2; @function html_escape=me, html_escape, 1, -1; @function html_unescape=me, html_unescape, 1, -1; @function iabs=me, iabs, 1, 1; @function iadd=me, iadd, 1, -1; @function idiv=me, idiv, 2, 2; @function iffalse=me, iffalse, 2, 3; @function iftrue=me, iftrue, 2, 3; @function imul=me, imul, 1, -1; @function inzone=me, inzone, 1, 1; @function isfalse=me, isfalse, 2, 4; @function isort=me, isort, 1, 4; @function israt=me, israt, 1, 1; @function istrue=me, istrue, 2, 4; @function isub=me, isub, 2, 2; @function ladd=me, ladd, 1, 2; @function land=me, land, 1, 2; @function landbool=me, landbool, 1, 2; @function lastcreate=me, lastcreate, 0, 2; @function lattrcmds=me, lattrcmds, 1, 2; @function lcmds=me, lcmds, 1, 4; @function ldiff=me, ldiff, 2, 5; @function ledit=me, ledit, 3, 5; @function linter=me, linter, 2, 5; @function ljc=me, ljc, 2, 3; @function lmax=me, lmax, 1, 2; @function lmin=me, lmin, 1, 2; @function loop=me, loop, 2, 3; @function lor=me, lor, 1, 2; @function lorbool=me, lorbool, 1, 2; @function lpad=me, lpad, 2, 3; @function lrand=me, lrand, 3, 4; @function lreplace=me, lreplace, 3, 5; @function lunion=me, lunion, 2, 5; @function motd=me, motd, 0, 0; @function ncomp=me, ncomp, 2, 2; @function nescape=me, nescape, 1, -1; @function nonzero=me, nonzero,2,3; @function notz = me, notz, 1, 1; @function nsecure=me, nsecure, 1, -1; @function objcall=me, objcall, 2, -3; @function orz = me, orz, 2, -2; @function pack=me, pack, 1, 2; @function pfind=me, pfind, 1, 1; @function qvars=me, qvars, 2, 3; @function rborder=me, rborder, 2, 4; @function restartsecs=me, restartsecs, 0, 0; @function rjc=me, rjc, 2, 3; @function roman=me, roman, 1, 1; @function rpad=me, rpad, 2, 3; @function rtables=me, rtables, 2, 7; @function session=me, session, 1, 1; @function sha1=me, sha1, 1, -1; @function sind=me, sind, 1, 1; @function singletime=me, singletime, 1, 1; @function startsecs=me, startsecs, 0, 0; @function streq=me, streq, 2, 2; @function strip=me, strip, 1, 2; @function subeval=me, subeval, 1, 1; @function successes=me, successes, 2, 2; @function tables=me, tables, 2, 7; @function tand=me, tand, 1, 1; @function translate=me, translate, 1, 2; @function truez = me, truez, 1, 1; @function unpack=me, unpack, 1, 2; @function until=me, until, 6, 10; @function url_escape=me, url_escape, 1, -1; @function url_unescape=me, url_unescape, 1, -1; @function usefalse=me, usefalse, 1, 2; @function usetrue=me, usetrue, 1, 2; @function whenfalse=me, whenfalse, 2, 4; @function whentrue=me, whentrue, 2, 4; @function while=me, while, 4, 6; @function writable=me, writable, 2, 2; @function writetime=me, writetime, 1, 1; @function xorbool=me, xorbool, 2, -2; @function xorz=me, xorz, 2, -2
@set Other Codebase Compability @functions/STARTUP=no_command prefixmatch
&STREQ Other Codebase Compability @functions=objeval(%@,eq(comp(lcstr(%0), lcstr(%1)), 0))
&STRIP Other Codebase Compability @functions=objeval(%@,case(%1,,stripansi(%0),fold(#lambda/edit(\%0,mid(%1,\%1,1),),lnum(strlen(%1)),%0)))
&SUBEVAL Other Codebase Compability @functions=objeval(%@,s(edit(%0,\[,\\\[,\],\\\],\{,\\\{,\},\\\},\,,\\\,\(,\\\(,\),\\\),\$,\\\$,\^,\\\^,\;,\\\;)))
&SUCCESSES Other Codebase Compability @functions=objeval(%@,localize(ladd(iter(iter(lnum(%0),rand(1,10)),case(1,eq(%i0,1),-1,gte(%i0,%1),1,0)))))
&TABLES Other Codebase Compability @functions=objeval(%@,localize([setq(4,case(%4,,%b,%4),5,case(%5,,%b,%5),6,case(%6,,%b,%6),s,words(%1))][case(%3,,iter(%0,iter(iter(lnum(1,words(%i0,%q4),%b,%qs),extract(%i1,%i0,%qs,%q4),%b,%r),%2[iter(%i0,letq(L,elements(%1,inum(0)),left(ljust(%i0,%qL,%q6),%qL)),%q4,%q5)],%r,%r),%r,%r),iter(%0,iter(iter(lnum(1,words(%i0,%q4),%b,%qs),extract(%i1,%i0,%qs,%q4),%b,%r),%2[iter(%i0,letq(L,elements(%1,inum(0)),left(ljust(%i0,%qL,%q6),%qL)),%q4,%q5)][if(lt(words(%i0,%q4),%qs),%q5[iter(lnum(inc(words(%i0,%q4)),%qs),repeat(%q6,elements(%1,%i0)),%b,%q5)])]%3,%r,%r),%r,%r))]))
&TAND Other Codebase Compability @functions=objeval(%@,tan(%0,d))
&TBOOL Other Codebase Compability @functions=objeval(%@,t(trunc(%0)))
&TRANSLATE Other Codebase Compability @functions=objeval(%@,case(%1,0,stripansi(%0),s,stripansi(%0),1,decompose(%0),p,decompose(%0),,decompose(%0),#-1 UNRECOGNIZED TYPE))
&TRUEZ Other Codebase Compability @functions=objeval(%@,t(trunc(%0)))
&UNPACK Other Codebase Compability @functions=objeval(%@,letq(0,switch(%0,-*,after(%0,-),%0),1,case(%1,,64,%1),case(0,isint(%q1),#-1 ARGUMENTS MUST BE INTEGERS,cand(gt(%q1,1),lte(%q1,64)),#-1 RADIX MUST BE AN INTEGER BETWEEN 2 and 64,gt(%q1,36),baseconv(lcstr(%0),%q1,10),[switch(%0,-*,-)][baseconv(foreach(#lambda/mid(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_,lpos(0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@$,\%0),1),%q0),%q1,10)])))
&UNTIL Other Codebase Compability @functions=objeval(%@,case(%+,6,iter(%2,[u(%0,%i0)][if(regmatch(u(%1,%i0),%3),ibreak())],%4,%5),7,iter(lnum(1,lmath(max,[words(%2,%5)] [words(%3,%5)])),[u(%0,elements(%2,%i0,%5),elements(%3,%i0,%5))][if(regmatch(u(%1,elements(%2,%i0,%5),elements(%3,%i0,%5)),%4),ibreak())],%b,%6),8,iter(lnum(1,lmath(max,[words(%2,%6)] [words(%3,%6)] [words(%4,%6)])),[u(%0,elements(%2,%i0,%6),elements(%3,%i0,%6),elements(%4,%i0,%6))][if(regmatch(u(%1,elements(%2,%i0,%6),elements(%3,%i0,%6),elements(%4,%i0,%6)),%5),ibreak())],%b,%7),9,iter(lnum(1,lmath(max,[words(%2,%7)] [words(%3,%7)] [words(%4,%7)] [words(%5,%7)])),[u(%0,elements(%2,%i0,%7),elements(%3,%i0,%7),elements(%4,%i0,%7),elements(%5,%i0,%7))][if(regmatch(u(%1,elements(%2,%i0,%7),elements(%3,%i0,%7),elements(%4,%i0,%7),elements(%5,%i0,%7)),%6),ibreak())],%b,%8),10,iter(lnum(1,lmath(max,[words(%2,%8)] [words(%3,%8)] [words(%4,%8)] [words(%5,%8)] [words(%6,%8)])),[u(%0,elements(%2,%i0,%8),elements(%3,%i0,%8),elements(%4,%i0,%8),elements(%5,%i0,%8),elements(%6,%i0,%8))][if(regmatch(u(%1,elements(%2,%i0,%8),elements(%3,%i0,%8),elements(%4,%i0,%8),elements(%5,%i0,%8),elements(%6,%i0,%8)),%7),ibreak())],%b,%9)))
&URL_ESCAPE Other Codebase Compability @functions=objeval(%@,foreach(#lambda/ifelse(lpos(0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$\\\%\(\)*.-/?^\\\[\\\]:~,\%0),\%0,\\\%\[baseconv\(ord\(\%0\),10,16\)\]),stripansi(%0)))
&URL_UNESCAPE Other Codebase Compability @functions=objeval(%@,regeditall(%0,\%\[0-9a-fA-F\]\{2\},chr(baseconv(after($0,\%),16,10))))
&USEFALSE Other Codebase Compability @functions=objeval(%@,ifelse(%0,%1,%0))
&USETRUE Other Codebase Compability @functions=objeval(%@,ifelse(%0,%0,%1))
&WHENFALSE Other Codebase Compability @functions=objeval(%@,s(iter\(%0,%1\[if(t(\%i0),ibreak())\],%2,[case(%+,4,%3,\%b)]\)))
&WHENTRUE Other Codebase Compability @functions=objeval(%@,s(iter\(%0,%1\[if(not(\%i0),ibreak())\],%2,[case(%+,4,%3,\%b)]\)))
&WHILE Other Codebase Compability @functions=objeval(%@,iter(%2,[u(%0,%i0)][if(strmatch(u(%1,%i0),%3),ibreak())],%4,case(%+,6,%5,%b)))
&WRITABLE Other Codebase Compability @functions=cand(strmatch(%1,*/*),controls(objeval(%@,num(%0)),%1))
&WRITETIME Other Codebase Compability @functions=objeval(%@,squish([case(etimefmt($d,%0),0,,1,1 day,%$0 days)] [case(etimefmt($h,%0),0,,1,1 hour,%$0 hours)] [case(etimefmt($m,%0),0,,1,1 minute,%$0 minutes)] [case(etimefmt($s,%0),0,,1,1 second,%$0 seconds)]))
&XORBOOL Other Codebase Compability @functions=objeval(%@,lmath(bxor,t(%0) [iter(%1,t(%i0),\,,%b)]))
&XORZ Other Codebase Compability @functions=objeval(%@,lmath(bxor,[truez(%0)] [iter(%1,truez(%i0),\,,%b)]))
@@
@@ Additional @Function Declarations (#10)
@create Additional @Function Declarations
@lock/Basic Additional @Function Declarations==me
@lset Additional @Function Declarations/Basic=no_inherit
@set Additional @Function Declarations = WIZARD
@set Additional @Function Declarations = SAFE
@set Additional @Function Declarations = NO_COMMAND
@DESCRIBE Additional @Function Declarations=As there were too many functions in the compatibility library for them all to be declared in a single @startup attribute, I created this object to hold the overflow.
@set Additional @Function Declarations/DESCRIBE=no_command visual prefixmatch public nearby
@STARTUP Additional @Function Declarations=@function/alias and=andbool; @function/alias cand=candbool; @function/alias cor=corbool; @function/alias left=strtrunc; @function/alias localize=private; @function/alias msecs=lastaccess; @function/alias nattr=attrcnt; @function/alias not=notbool; @function/alias sign=isign; @function/alias or=orbool; @function/alias playermem=playmem; @function/alias strmatch=wildmatch; @function/alias textfile=helptext; @function/alias ulocal=uprivate; @function/restrict corz=noparse; @function/restrict fcount=noparse; @function/restrict iffalse=noparse; @function/restrict iftrue=noparse; @function/restrict isfalse=noparse; @function/restrict istrue=noparse; @function/restrict loop=noparse; @function/restrict lrand=noparse; @function/restrict nescape=noparse; @function/restrict nsecure=noparse; @function/restrict whenfalse=noparse; @function/restrict whentrue=noparse
@set Additional @Function Declarations/STARTUP=no_command prefixmatch
@@
@@ The following is a @decompile of my event handler object. You will want to merge this code with
@@ your own, not copy and paste this code:
@@
@@ Event Handler (#15)
@create Event Handler
@link Event Handler = #5
@lock/Basic Event Handler==me
@lset Event Handler/Basic=no_inherit
@set Event Handler = WIZARD
@set Event Handler = SAFE
@set Event Handler = NO_COMMAND
@DESCRIBE Event Handler=It handles events and needs wizard privileges.
@set Event Handler/DESCRIBE=no_command visual prefixmatch public nearby
&DUMP Event Handler=
&DUMP`1MIN Event Handler=&dumping #8=1
&DUMP`COMPLETE Event Handler=&dumping #8=0
&OBJECT Event Handler=
&OBJECT`CREATE Event Handler=&LAST_[type(%0)] %#=%0
&PLAYER Event Handler=
&PLAYER`CONNECT Event Handler=@assert [eq(1,%1)]; &freshconnect %0=[secs()]
&PLAYER`CREATE Event Handler=@name %0={iter(%1,capstr(%i0))}; @lock/enter %0=$%0; @lock/use %0=$%0; @channel/on Public=%0
&PLAYER`DISCONNECT Event Handler=@break %1; think [setq(t,secs())][setq(s,sub(%qt,default(%0/freshconnect,%qt)))]; &conntotal %0=[add(default(%0/conntotal,0),%qs)]; &connmax %0=[max(default(%0/connmax,0),%qs)]; &connlast %0=%6
@@
@@ The following object, and only the following object, goes in the Master Room:
@@ Connect Listener (Wizard Privileges) (#13)
@create Connect Listener (Wizard Privileges)
@link Connect Listener (Wizard Privileges) = #2
@lock/Basic Connect Listener (Wizard Privileges)==me
@lset Connect Listener (Wizard Privileges)/Basic=no_inherit
@set Connect Listener (Wizard Privileges) = WIZARD
@set Connect Listener (Wizard Privileges) = SAFE
@set Connect Listener (Wizard Privileges) = NO_COMMAND
@ACONNECT Connect Listener (Wizard Privileges)=think [setq(N,default(%#/connnum,0))]; @switch/first 1=%1, {&connnum %#=inc(%qN)}; @switch/first 1=gt(setr(n,nwho()),get(#8/connrecord)), {&connrecord #8=%qn}
@set Connect Listener (Wizard Privileges)/ACONNECT=no_command prefixmatch
@DESCRIBE Connect Listener (Wizard Privileges)=This object runs commands on connecting and disconnecting players that require wizard privileges.%b Currently, this means setting &connnum on connect and &connmax on disconnect.
@set Connect Listener (Wizard Privileges)/DESCRIBE=no_command visual prefixmatch public nearby