Menu

#46 power? is a little inflexible

open
nobody
None
5
2003-09-07
2003-08-27
Moritz Voss
No

The power? primitive seems to insist on the full power
names instead of the handy shortcuts. The same holds
true for the @power command.

Example code:

me @ "r" power?

always returns false despite me having the
CONTROL_ALL power:

Avatar(#2PJCW4:r)

I'm currently circumventing this with a blob of code like
the one shown below, but.... I guess my point is clear.

str2power[ string:input -- string:output ] (translate
power shortcuts to full string)
input @
case
"m" strcmp not when "ALL_MUF_PRIMS"
end
"a" strcmp not when "ANNOUNCE" end
"b" strcmp not when "BOOT" end
"c" strcmp not when "CHOWN_ANYTHING"
end
"r" strcmp not when "CONTROL_ALL"
end
"f" strcmp not when "CONTROL_MUF"
end
"x" strcmp not when "EXPANDED_WHO"
end
"h" strcmp not when "HIDE" end
"i" strcmp not when "IDLE" end
"l" strcmp not when "LINK_ANYWHERE"
end
"g" strcmp not when "LONG_FINGERS"
end
"n" strcmp not when "NO_PAY" end
"o" strcmp not when "OPEN_ANYWHERE"
end
"p" strcmp not when "PLAYER_CREATE"
end
"u" strcmp not when "PLAYER_PURGE"
end
"s" strcmp not when "SEARCH" end
"e" strcmp not when "SEE_ALL" end
"w" strcmp not when "STAFF" end
"d" strcmp not when "SHUTDOWN" end
"t" strcmp not when "TELEPORT" end
default pop "" end
endcase
; PUBLIC str2power

Cyas, Thygrrr

Discussion

  • R Taylor

    R Taylor - 2003-09-07

    Logged In: YES
    user_id=42132

    Moving this to feature requests.

    -Akari

     
  • R Taylor

    R Taylor - 2003-09-07
    • labels: 102879 -->
    • milestone: 101715 -->
     
  • Blobbus

    Blobbus - 2003-09-11

    Logged In: YES
    user_id=181242

    Bah! You kids spoiled by your newfangled strings! Why in my
    day we had to use BINARY to access the POWERS flags! Not
    only that, strings didn't even EXIST back then! We had rows
    and rows of lights! And you didn't get punch cards or
    keyboards, you had to tap -two wires- together to make it
    work! And if you programmed it incorrectly, the program
    would crash and take the -entire powergrid- down with it!
    And don't even get me started about integer math, not to
    mention floating point! Back in my day, the closest you'd get
    to "floating point" was a safety pin hanging from a piece of
    thread!

     

Log in to post a comment.

Monday.com Logo