replace the script named "CheckMask"
Code: Select all
-------------------------------------------------
-- Put your Lua functions here. --
-- --
-- Note that you can also use external Scripts --
-------------------------------------------------
-- The checkMask function returns true/false if a character is a member of a set of classes.
-- checkMask(xmask, xname)
-- xmask - name of the mask to use
-- xname - name to check, or nil (whoami)
-- Returns true if xname's class is a member of the set
-- Example: Adud is a warrior
-- if checkMask("rogue", "Adud") then
-- display("This won't happen because Adud isn't a rogue")
-- end
-- Not including a character name means the character logged in will be used
-- Example: Nyyrazzilyss (an illithid) is currently logged in
-- if checkMask("psi") then
-- display("Nyyrazzilyss is a psi")
-- end
masks = {
classes = { "War", "Blk", "Pal", "UNK", "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
noPsi = { "War", "Blk", "Pal", "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
nopriest = { "War", "Blk", "Pal", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
nocleric = { "War", "Blk", "Pal", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
psi = { "Psi" },
enc = { "Enc" },
war = { "War" },
cle = { "Cle" },
sha = { "Sha" },
rog = { "Rog" },
ill = { "Ill" },
inv = { "Inv" },
dru = { "Dru" },
bar = { "Bar" },
ctr = { "Ctr" },
ran = { "Ran" },
ele = { "Ele" },
pal = { "Pal" },
blk = { "Blk" },
lic = { "Lic" },
nec = { "Nec" },
dire = { "Dir" },
all = { "War", "Blk", "Pal", "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
self = { "Enc", "Sha" },
petrescue = { "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec" },
traintanks = {"War", "Pal", "Blk", "Ran", "Dir", "Bar", "Ctr"},
warrior = {"War", "Pal", "Blk"},
fighter = {"War", "Pal", "Blk", "Ran", "Dir" },
kicker = {"War", "Blk"},
hitter = { "Rog", "Dir", "Ran", "Blk", "Pal" },
hitterToRescue = { "Rog", "Dir", "Ran" },
singer = {"Bar", "Ctr"},
autobless = {"Bar", "Ctr"},
autohide = {"Psi", "Rog", "Ran"},
hitterSinger = { "Rog", "Dir", "Ran", "Blk", "Pal", "Bar", "Ctr"},
displace = { "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
rightWindow = {"UNK", "War", "Blk", "Pal", "Bar", "Ctr", "Dir", "Ran", "Rog"},
caster = {"Dru", "Enc", "Inv", "Lic", "Nec", "Ill", "Ele", "Cle", "Sha" },
mage = {"Enc", "Inv", "Lic", "Nec", "Ill", "Ele" },
casterGlobe= {"Enc", "Nec", "Lic"},
casterSinger = {"Dru", "Enc", "Inv", "Lic", "Nec", "Ill", "Ele", "Cle", "Sha", "Bar", "Ctr" },
casterPsi = {"Psi", "Dru", "Enc", "Inv", "Lic", "Nec", "Ill", "Ele", "Cle", "Sha" },
casterPsiSinger = {"Psi", "Dru", "Enc", "Inv", "Lic", "Nec", "Ill", "Ele", "Cle", "Sha", "Bar", "Ctr" },
statHitter = {"War", "Pal", "Blk", "Ran", "Dir", "Bar", "Ctr", "Rog" },
priest = {"Sha", "Dru", "Ctr", "Cle" },
pray = {"Sha", "Dru", "Cle", "Blk", "Dir" },
nonPriestCaster = { "Blk", "Dir" },
rogue = {"Rog", "Bar", "Ctr"},
petRescue = { "Psi", "Cle", "Enc", "Dru", "Lic", "Sha", "Inv", "Ill", "Ele", "Nec", "Bar", "Ctr", "Rog", "Ran" },
haster = { "Enc", "Nec", "Ele", "Lic" },
summonmount = { "Blk", "Dir"},
mountedCombat = { "Blk", "Dir"},
tiavit = { "Sha", "Enc", "Ill", "Bar", "Ele", "Rog", "Nec", "Psi"},
missile = { "Sha", "Ele", "Dir", "Enc", "Nec", "Inv", "Lic", "Ill", "Dru", "Ran" },
hlarea = { "Cle", "Blk", "Pal", "Sha", "Ele", "Dir", "Enc", "Nec", "Inv", "Lic", "Ill", "Dru", "Ran" },
ffire = { "Enc", "Ill", "Inv", "Dru", "Sha"},
stoner = { "Sha", "Ele", "Enc" },
venomer = { "Rog", "Blk" },
dmgundead = { "Cle", "Nec", "Lic", "Pal"},
necros = { "Lic", "Nec" }
}
function checkMask(xmask, xname)
local classname
if xname == nil then
xname = whoami()
end
classname = whoclass(xname) or "UNK"
if masks[xmask] == nil then
echoDebug("<red>[Error: mask " .. xmask .. " does not exist]\n")
return
end
if table.contains( masks[xmask], classname ) then
return(true)
end
return(false)
end
and then InitNyylib
Code: Select all
-------------------------------------------------
-- Put your Lua functions here. --
-- --
-- Note that you can also use external Scripts --
-------------------------------------------------
NyyLIB = NyyLIB or {}
automem = automem or 0
function initNyyLIB()
echo("\n\n\n")
cecho([[<green>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO]])
cecho("<green>THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE")
cecho("<green>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,")
cecho("<green>TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN")
cecho("<green>THE SOFTWARE.")
echo("\n\n\n")
cecho("<red>[Initializing NyyLIB...]\n")
expandAlias("@version", false)
NyyLIB.homedir = getMudletHomeDir() .. "\\" .. NyyLIB.version .. "\\"
local WindowWidth, WindowHeight = getMainWindowSize()
splashwindow = Geyser.Label:new({name="splash", x="10%", y="10%", width="50%", height="75%"})
splashwindow:setStyleSheet([[border-image: url(]] .. mainpath("splash.png") .. [[)]])
tempTimer(6, [[splashwindow:hide()]] )
NyyLIB.areaTable = {}
-- load list of all area names on the mud
for line in io.lines(mainpath("arealist.txt")) do
local areainfo = string.split(line, " ")
local areaid = areainfo[1]:trim()
local areaname = areainfo[2]
NyyLIB.areaTable[tonumber(areaid)] = areaname
end
-- loading charData table
charData:load()
NyyLIB.buttonarray = {}
NyyLIB.leftbuttonarray = {}
NyyLIB.deadpeople = NyyLIB.deadpeople or {}
NyyLIB.initgui = false
NyyLIB.ticktimer = 60
if charData:get("style", true) then
setStyle()
end
NyyLIB.classes = { "War", "UNK", "Blk", "Pal", "Cle", "Dru", "Sha", "Ctr",
"Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" }
NyyLIB.fullclasslist = { {"Rogue", "Rog"},
{"Cleric", "Cle"},
{"Paladin", "Pal"},
{"Shaman", "Sha"},
{"Illusionist", "Ill"},
{"Ranger", "Ran"},
{"Lich", "Lic"},
{"Blackguard", "Blk"},
{"Necromancer", "Nec"},
{"Battlechanter", "Ctr"},
{"Invoker", "Inv"},
{"Enchanter", "Enc"},
{"Druid", "Dru"},
{"Warrior", "War"},
{"Elementalist", "Ele"},
{"Dire Raider", "Dir"},
{"Bard", "Bar"},
{"Psionicist", "Psi"}
}
NyyLIB.fullracelist = { {"Human", "M"},
{"Barbarian", "M"},
{"Drow Elf", "M"},
{"Moon Elf", "M"},
{"Half-Elf", "M"},
{"Shield Dwarf", "M"},
{"Half-Orc", "M"},
{"Duergar", "M"},
{"Duergar Dwarf", "M"},
{"Gnome", "S"},
{"Halfling", "S"},
{"Ogre", "L"},
{"Troll", "M"},
{"Illithid", "M"},
{"Orc", "M"},
{"Yuan-Ti", "M"}
}
NyyLIB.reversedirs = {
n = "s",
e = "w",
s = "n",
w = "e",
u = "d",
d = "u",
north = "south",
east = "west",
south = "north",
west = "east",
up = "down",
down = "up"
}
NyyLIB.fulldirs = {
n = "north",
e = "east",
s = "south",
w = "west",
u = "up",
d = "down"
}
NyyLIB.statuschar=""
NyyLIB.damagelevels = { "Excellent", "Few Scratches", "Small Wounds", "Few Wounds", "nasty wounds", "Pretty Hurt", "Awful" }
NyyLIB.torescue=""
NyyLIB.psilag="none"
loadwholist()
opendb()
createconsumabledb()
demonnicOnStart()
setBorder()
-- enable mapper
mudlet = mudlet or {}; mudlet.mapper_script = true
expandAlias("@map init", false)
-- only load mapfile if loaded map is < 35000 rooms i.e. not mudlet loaded mapfile
if map:countRooms() < 35000 then
map:loadMap()
end
NyyLIB.initcompleted = true
registerAnonymousEventHandler("sysWindowResizeEvent", "GUIScripts")
registerAnonymousEventHandler("newRoomEvent", "newRoomEvent")
expandAlias("@stats reset", false)
cecho ("<red>[NyyLIB initialized.]\n")
echo("Account name: ")
end
function initFullData()
echoDebug("<red>[initFullData called]\n")
disableTrigger("scribenext")
charData:init(whoami(), {}, true)
charData:init("memcount", 0)
charData:init("groupwindow", "split")
charData:init("iconbar", "bottom")
charData:init("statname", "unset")
if NyyLIB.initgui == false then
if NyyLIB.mapwindow == nil then
cecho("<red>[error: mapwindow is nil]\n")
else
map:hide()
end
if whoami() == nil then
cecho("<red>[error: whoami() is nil]\n")
end
if whoclass(whoami()) == nil then
cecho("<red>[error: whoclass(whoami) is nil]\n")
end
local nx
local label
for nx=1, 20, 1 do
label=findlabel("button" .. nx)
if label ~= nil then
label:hide()
end
end
NyyLIB.buttonarray = {}
initgui()
-- call class initialization script (buttons)
initClass()
-- call custom initaliziation script 'initCustom()' if it exists
if _G["initCustom"] ~= nil then
_G["initCustom"]()
else
echoDebug("\n<red>[Custom script initCustom() does not exist]\n")
end
NyyLIB.initgui = true
end
end
-- class initialization script (buttons)
function initClass()
local fnInit="init" .. string.gsub(whoclass(whoami()), "-", "_")
if _G[fnInit] ~= nil then
_G[fnInit]()
else
echoDebug("\n<red>[Class script " .. fnInit .. " does not exist]\n")
end
end
you will need http://sqlitebrowser.org/ for this part
gotta also do an insert into classes db
Code: Select all
INSERT INTO "classes" VALUES('Blackguard','Blk','Fighter','ANTI-WARRIOR');