Mudlet Scripting
Because I'm a nub who will constantly be asking for coding help while I'm figuring this crap out, I thought I'd go ahead and start this up and make a small contribution of my own. This is the trigger I've created to handle appending the roomnum and area to the room title via GMCP magic. I've used screwy colors for room_title via CONFIG COLOUR on purpose, since I just rehighlight over the room title anyways, to make it so that this doesn't trigger on everything else... like newsroom, quicksand, inventory, etc, like it will if you leave standard colors. There may be a simpler way to handle this, and I'd appreciate input if so, but this works without issue for me at present. Obviously, GMCP required. I use CONFIG COLOUR ROOM_TITLE 5 1 to make this work, though you can use any other unused color combination you would prefer.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MudletPackage>
<MudletPackage version="1.0">
<TriggerPackage>
<Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="yes" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="yes" isColorTriggerFg="yes" isColorTriggerBg="yes">
<name>RoomName Trigger</name>
<script>cecho("<blue>(<white>" .. gmcp.Room.Info.num .. "<blue>) <DarkGoldenrod>in " .. gmcp.Room.Info.area)</script>
<triggerType>0</triggerType>
<conditonLineDelta>0</conditonLineDelta>
<mStayOpen>0</mStayOpen>
<mCommand></mCommand>
<packageName></packageName>
<mFgColor>#aaaa00</mFgColor>
<mBgColor>#000000</mBgColor>
<mSoundFile></mSoundFile>
<colorTriggerFgColor>#800080</colorTriggerFgColor>
<colorTriggerBgColor>#800000</colorTriggerBgColor>
<regexCodeList>
<string>FG12BG4</string>
</regexCodeList>
<regexCodePropertyList>
<integer>6</integer>
</regexCodePropertyList>
</Trigger>
</TriggerPackage>
</MudletPackage>
Anyone else got something to add?
0
Comments
Trigger: named "caravan"
Pattern 0 - " ^Path: (.*)$
Pattern 1 - ^((n|ne|nw|s|se|sw|e|w|u|d|in|out)(,)?( )?)+$
Script:
--strip the Path: off it (if present) so the lines are identical
local pathingstring = string.gsub(matches[1],"Path: ","")
for token in string.gmatch(pathingstring, "[^,%s]+") do
table.insert(caravanpath,token)
end
--debug print to show that the list is getting populated
--for i,v in ipairs(caravanpath) do echo (i.." "..v.."\n") end
if (not (string.byte(pathingstring,-1) == 44 or string.byte(pathingstring,-2) == 44)) then
onbalance = "lead caravan "..caravanpath[1]
--disableTrigger(caravanpath_impy)
end
Second trigger: named "stepping" -
Pattern 0 - " ^You lead a caravan \w+\. "
Script -
table.remove(caravanpath,1)
if #caravanpath > 0 then
send("lead caravan "..caravanpath[1])
end
the claims are stated - it's the world I've created
char.peopleHere = {}
char.peopleChecking = true
enableTrigger("People Checking")
deleteLine()
for name in string.gmatch(matches[2], "[^, ]+") do
--insert some check to remove prompt data here
table.insert(char.peopleHere, name)
end
deleteLine()
Pattern[lua function]: isPrompt()
if (char.peopleChecking) then
disableTrigger("People Checking")
char.peopleChecking = false
for i = 1, 6 do
table.remove(char.peopleHere, 1)
end
whoHereAdd()
end
--How do I rid the 'Who Here' console of my prompt? The code below replaces the prompt for me,
--but does not rid the 'Who Here' console of the prompt data
--
--replaceLine("Here be the prompt")
Script:
--this function doesn't work, with or without the 'break'.
--I added them to try, since my only other use of a
--similar loop successfully used break
function filterPeopleHere()
for k, v in ipairs (char.peopleHere) do
if v == "TIME:" then
table.remove(char.peopleHere, k)
break
end
if v == "EST" then
table.remove(char.peopleHere, k)
break
end
end
end
function whoHereAdd()
filterPeopleHere()
--display function used below is solely for testing to see if anything changes in the table
display(char.peopleHere)
whoHereConsole:Clear()
whoHereConsole:CEcho("<red>PEOPLE HERE\n")
for k, v in ipairs (char.peopleHere) do
whoHereConsole:EchoLink( "(" .. v .. ") ", [[expandAlias("st ]]..v..[[") printTargetWindow()]], "Target " .. v, true, false )
end
end
function filterPeopleHere()
for k, v in ipairs (char.peopleHere) do
if v == "TIME:" then
table.remove(char.peopleHere, k)
end
if v == "EST" then
table.remove(char.peopleHere, k)
end
if v == "<eb" then
table.remove(char.peopleHere, k)
end
if v == "<eb>" then
table.remove(char.peopleHere, k)
end
if v == "db>" then
table.remove(char.peopleHere, k)
end
if v == "<-b" then
table.remove(char.peopleHere, k)
end
if v == "<e-" then
table.remove(char.peopleHere, k)
end
if v == "<--" then
table.remove(char.peopleHere, k)
end
if v == "pdb>" then
table.remove(char.peopleHere, k)
end
if v == "fdb>" then
table.remove(char.peopleHere, k)
end
if v == "pb>" then
table.remove(char.peopleHere, k)
end
if v == "pd>" then
table.remove(char.peopleHere, k)
end
if v == "b>" then
table.remove(char.peopleHere, k)
end
if v == "d>" then
table.remove(char.peopleHere, k)
end
if v == "XP:" then
table.remove(char.peopleHere, k)
end
end
end
"db>" still shows up in the peopleHere table, even though it's supposedly being filtered out by this function, and I'm not sure why.
the claims are stated - it's the world I've created
the claims are stated - it's the world I've created
selectString(multimatches[1][1],1) replace("") deselect() selectString(multimatches[2][1],1) replace("") deselect()
On multiple line triggers, there is a function like showMultimatches() or something similar to show what is being matched. Multimatches[1][1] would be the whole line of the first matched line in your trigger, multimatches[2][1] would be the whole line of the second matched line in your trigger. Hope this helps.the claims are stated - it's the world I've created
The ingame curing is pretty freaking awesome.
You CAN write a system that's better than it, but it'll be a lot of work.
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
Any help would be appreciated... Thanks in advance