Mudlet Questions

by Rika

Back to Mechanic's Corner.

Lilia2010-10-10 22:30:37
That's understandable, I'll just leave it alone for now. Any idea what happened to my map though? I think it's one you wrote for Midkimia that demonnic ported over.
Vadi2010-10-10 22:40:24
I think appendBuffer was broken in one of the pre-releases actually, and that's what actually copies stuff from one window to another. Try using the latest pre-release or one before yours.
Calixa2010-10-10 23:36:25
QUOTE (Vadi @ Oct 11 2010, 12:40 AM) <{POST_SNAPBACK}>
I think appendBuffer was broken in one of the pre-releases actually, and that's what actually copies stuff from one window to another. Try using the latest pre-release or one before yours.


Map is working fine in pre6. Think I will skip pre7.
Unknown2010-10-11 04:12:10
Just wondering why using GMCP on Mudlet means you can no longer use the awesome editor (Nexus-like popup) when writing things in books or designing? I miss my easy editing sad.gif
Unknown2010-10-11 04:36:00
QUOTE (Palindromic @ Oct 11 2010, 05:12 AM) <{POST_SNAPBACK}>
Just wondering why using GMCP on Mudlet means you can no longer use the awesome editor (Nexus-like popup) when writing things in books or designing? I miss my easy editing sad.gif


It uses ATCP for that if I recall correctly. Successful GMCP negotiation disables ATCP.
Vadi2010-10-11 12:58:14
QUOTE (Palindromic @ Oct 11 2010, 12:12 AM) <{POST_SNAPBACK}>
Just wondering why using GMCP on Mudlet means you can no longer use the awesome editor (Nexus-like popup) when writing things in books or designing? I miss my easy editing sad.gif


It'll work again in future updates.
Calixa2010-10-11 14:44:00
If I want to revert to a previous stable release rather than the current pre-release, can that be safely done? Put a lot of work into getting everything set up nicely, I'd rather not lose it all.
Unknown2010-10-11 14:48:24
QUOTE (Calixa @ Oct 11 2010, 10:44 AM) <{POST_SNAPBACK}>
If I want to revert to a previous stable release rather than the current pre-release, can that be safely done? Put a lot of work into getting everything set up nicely, I'd rather not lose it all.


It should be fine, but you can always make a backup of your mudlet directory just to be safe. even just copying it out until you've finished the process would be fine. I've gone back and forth between versions while testing this or that, though, that I foresee no such issue with you.

Alternately, you can just uncheck 'gmcp' and go back to using atcp, if it's in regards to the other topic.
Lilia2010-10-13 00:43:18
What's the difference between (\\w*) and (\\w?) ? All I know is they're both optional, but is one better in certain circumstances than the other?
Vadi2010-10-13 00:46:36
? means the previous thing can either repeat once or not at all. * means the previous thing can repeat not at all or infinitely many times.

edit: corrected
Lilia2010-10-23 21:35:14
I'm having a problem similar to Rika's in the OP, but for the life of me, I can't figure out how she fixed it.

I'm making aliases for dreamweaving, I've got pacification set to: ^pacify\\s*(\\w*)$

The script:
if matches == nil then
send("outdr pacification;dreamcast pacification " ..tar)
else
send("outdr pacification;dreamcast pacification " ..matches)
end

This is only working if I put a name after pacify. Using just 'pacify' sends it with no target, even if I have tar set. I tried using ? instead of *, but that made it worse; still no target if none is specified, but it doesn't capture at all with one. Is it the regex that's the problem, or the script?
Neos2010-10-23 21:39:22
QUOTE (Lilia @ Oct 23 2010, 05:35 PM) <{POST_SNAPBACK}>
I'm having a problem similar to Rika's in the OP, but for the life of me, I can't figure out how she fixed it.

I'm making aliases for dreamweaving, I've got pacification set to: ^pacify\\s*(\\w*)$

The script:
if matches == nil then
send("outdr pacification;dreamcast pacification " ..tar)
else
send("outdr pacification;dreamcast pacification " ..matches)
end

This is only working if I put a name after pacify. Using just 'pacify' sends it with no target, even if I have tar set. I tried using ? instead of *, but that made it worse; still no target if none is specified, but it doesn't capture at all with one. Is it the regex that's the problem, or the script?


Try
CODE
^pacify( \\w+)?$

with the same code, it could probably be done better, but it's worked for me.
Lilia2010-10-23 21:41:12
QUOTE (AquaNeos @ Oct 23 2010, 04:39 PM) <{POST_SNAPBACK}>
Try
CODE
^pacify( \\w+)?$

with the same code, it could probably be done better, but it's worked for me.

I'm so glad that was so easy. Thanks!!!
Unknown2010-10-23 22:49:17
Does Mudlet have a way to create triggers from the command line yet? smile.gif
Vadi2010-10-24 00:05:44
Xiel2010-10-24 19:31:15
Since Vadi poked, here's a wee little script for an alias to continually do something in M&M that has the same syntax but different modifiers and consumes balance (like summoning fae). With an alias named 'fsummon', I use it for all sorts of awesome without having to rely on timers. biggrin.gif

CODE
for _, fae in pairs({"barghest", "redcap", "slaugh", "banshee", "pigwidgeon", "pooka", "willowisp", "pixie", "brownie", "leprechaun", "sprite"}) do
  mm.doadd("faesummon "..fae)
end

Lilia2010-10-25 19:28:57
I just made a little script to calculate average prices for commodities.

Trigger : ^You purchase (\\d+) (\\w+) for (\\d+) gold\\.$

Script:
comms = comms or {}

if matches == "fruit" then
comms.fruit = comms.fruit or {amount = 0, price = 0}
comms.fruit.amount = comms.fruit.amount + matches
comms.fruit.price = comms.fruit.price + matches
comms.fruit.average = comms.fruit.price / comms.fruit.amount
cecho("\\nAverage rice for fruit is: " ..comms.fruit.average)
end

My question is, is there anyway to do this without having to make the above script for all the comms? Can I just subsitiute fruit with matches and use the one script? This will also reset the tables every time I start a new session, right?
Vadi2010-10-25 19:49:27
Yes, you can just substitute matches:

CODE
comms] = comms] or {amount = 0, price = 0}
comms].amount = comms].amount + matches
comms].price = comms].price + matches
comms].average = comms].price / comms].amount
cecho("\\nAverage rice for "..matches.." is: " ..comms].average)


It would reset on a session close too, yes. You can use table.save and table.load to save things though.
Anisu2010-10-31 22:11:02
I am probably making a silly mistake, but can't see it myself

CODE
ALIAS:

local tradedb = db:get_database("trades")
local tradetemp = db:fetch(tradedb.reference, db:eq(tradedb.reference.trade, "tailor"))
local timelol = 5
for k,v in ipairs(tradetemp) do
for i,j in pairs(v) do
  if i == "type" then
   tempTimer( timelol, ] .. j ..])
   timelol = timelol + 5
  end
end
end

SCRIPT
function tradeskillcheck(args)
if tradecapturetrig ~= nil then
   killTrigger(tradecapturetrig)
end
if tradecapturetrig1 ~= nil then
   killTrigger(tradecapturetrig1)
end
if tradecapturetrig2 ~= nil then
   killTrigger(tradecapturetrig2)
end
tradecapturetrig = tempRegexTrigger(],, org=matches, appearance=matches)}]])
tradecapturetrig = tempTrigger("Type MORE to continue reading.", ])
tradecapturetrig2 = tempTrigger("Total:", ])
send("tailoring " .. args)
end


result:
CODE
Lua error::16: attempt
to concatenate local 'args' (a nil value)


now I confirmed by using an echo in the first part that j is a string not nil, when using an echo in the beginning of the function args does not exist. Am I concatenating my variables wrong in tempTimer, or am I missing something?
Unknown2010-10-31 22:15:14
Might also want to supply how you are sending 'args' to the function. I am seeing nothing syntactically wrong there, though granted, I literally just opened my eyes.