function echoChat(channel) local str = string.title(channel) or "All" selectString(line,1) local er,eg,eb = getBgColor() local tflag = false if er == 0 and eg == 0 and eb == 0 then setBgColor(0,0,0) tflag = true end copy() if str ~= "Shouts" then appendBuffer("GUI.chat.All") end if str ~= "All" then appendBuffer("GUI.chat." .. str) end if tflag then setBgColor(0,0,0) end
GUI[str.. "tab"]:flash(1.5) end ---------------------------------------------------------- @Irruel Is the script I use the GUI stuff is my design/chat window .. that and 6 lines of code to capture from GMCP in a script with event handler
I can see that, with the getBgColor() func (though, shouldn't it be getFgColor()?) I'm not convinced that there isn't an easier way to figure the colour from the raw ansi.
string.match on the 32m bit, then compare the result to a table that converts it to a colour name, perhaps.
I'll test it out next time I get the chance, in a couple of day.
Sorry for the delay- Yes I did, @Irruel and am now doing the whole let's-unicorns-everything-up-and-see-what-happens point :P Thanks for all your help so far.
Here's a question:
^\((.+)\): (\w+) says?, "(.+)(\.|\?|!|\)|\()"$
I'm using that to capture messages over channels. My thought is to store all the messages into a table, but I'm worried that after being online for a while that it'll become a huge table. Is there a general best practice for the amount of string data to put in a table, or the amount of complexity/levels a table should hold before Mudlet starts to get angry with me?
I've been breaking mudlet just by copy/pasting the raw ansi - it seems to interpret part of the control codes as <- left arrow symbols, and once I try to paste that into the command line and send it to the mud (as a clan tell to KLL in this instance) I broke mudlet.
I'm 95% sure I have the solution I need for my script though (and if not I'll just copy Nalor's). It'll have to wait for Monday morning though, as that is the next moment I will have to spend coding anything.
function downloaded_file(_, filename) if filename:match("votePage", 1, true) then cecho(".") io.input(filename) local s = io.read("*all") local pzzzqaaz = string.match(s,'') cecho(".") local votehash = string.match(s,'') cecho(".") local mudid = string.match(s,'') cecho(".") local votestring = "http://www.topmudsites.com/vote.php?" .. "&do=in" .. "&pzzzqaaz=" .. pzzzqaaz .. "&mudid=" .. mudid .. "&votehash=" .. votehash cecho(".") downloadFile(getMudletHomeDir().."/voteDone.html", votestring) elseif filename:match("voteDone", 1, true) then cecho("Successful!)\n") send("voted", false) end end
IT used to work, Ive not changed any code in that and all of a sudden it doesnt work.. So unsure why that change would all of a sudden make it work
I trie *l before and it didnt do what it does/ did now before it stopped working
Looks like the changed the voting form, so the parse doesn't work anymore.
For anyone on TW, you can replace the vote_page_download script with the following and it should work.
HALP CODE FORMATTING
function vote_page_download(_, filename)
local ohRex = [[name="oldhash" type="hidden" value="(%x+)"]]
local thRex = [[name="testid" type="hidden" value="(%x+)"]]
local miRex = [[type="hidden" name="mudid" value="(%d+)"]]
local vhRex = [[type="hidden" name="votehash" value="(%x+)"]]
tmp.oldhash = nil
tmp.testid = nil
tmp.mudid = nil
tmp.votehash = nil
if filename == tostring(tmp.vote_page) then
for line in io.lines(filename) do
if line:find([[type="hidden"]]) then
if string.match(line, ohRex) then tmp.oldhash = string.match(line, ohRex) end
if string.match(line, thRex) then tmp.testid = string.match(line, thRex) end
if string.match(line, miRex) then tmp.mudid = string.match(line, miRex) end
if string.match(line, vhRex) then tmp.votehash = string.match(line, vhRex) end
end
end
if tmp.oldhash and tmp.mudid and tmp.votehash and tmp.testid then
tmp.votePhP = string.format("http://www.topmudsites.com/vote.php?do=in&oldhash=%s&mudid=%s&votehash=%s&temphash=%s", tmp.oldhash, tmp.mudid, tmp.votehash, tmp.testid)
info("Calling " .. tmp.votePhP)
info("Vote has been cast!")
downloadFile(tmp.voted_page, tmp.votePhP)
end
elseif filename == tostring(tmp.voted_page) then
send("voted", false)
end
end
{ name = "Someperson", channels = { "the Clan of The Crafting Guild of Sapience" } }, { name = "Someperson#2", channels = { "the City of Spinesreach", "the Clan of The Crafting Guild of Sapience", "crafts" } }, { name = "Someperson#3", channels = { "the City of Spinesreach", "crafts" } }
Kind of a general GMCP question/even more general question, but wasn't sure where to put this.
So what's the differences between crafts and the Clan of The Crafting Guild of Sapience? Crafts doesn't show up in Comm.Channel.List.
The one that isn't a clan, is a channel for the crafters able to approve designs. If it doesn't show in the comm channel, it is probably an oversight because it is a unique org.
Thanks! So at one point, my gmcp table was capturing the ANSI escape characters of the channel. I was using a yellow FG at the time, I've since switched it back to white FG/black BG, and my gmcp table quit showing ANSI code. I'm assuming that default coloring doesn't warrant one. On one of my other channels though, where I still have yellow FG/black BG, the ANSI code evolved into this instead of just the escape characters:
text = "[0;1;33m([4zCOLOR [4zSEND HREF=\"channelinfo ct\"Spinesreach[4z/SEND[4z/COLOR): Faerah says, \"Mmhm.\"[0m[0;37m",
The left-arrow symbols and some other ones aren't copying into my browser, and the COLOR and SEND HREF are confusing me. Earlier it was just the simple code [#;#;#m stuff that I knew what meant. I'm also assuming ANSI/ASCII are sufficient and I won't need unicode to capture all the characters?
Thanks for the link! Sub seems like a good way to separate it all out, also convenient that they already made the table. *yoink*
I imagine I'll eventually make a thing to parse all the ANSI so that my channel capture can use whatever colors are configured in the game, but all the SEND and HREF stuff isn't ANSI, and that's what I'm confused about.
Mine was showing things like this
[0;32m(Dark Fire): You say, \"Test.\"[0m[0;37m
but now it has way more symbols and also the SEND and HREF business which wasn't originally coming up when I looked in the GMCP table. Is your GMCP table also showing the left arrows and other things?
Just occurred to me it might also be the font I'm using that's contributing to some of the characters I've never seen associated with ANSI. I'm using Bitstream Vera Sans Mono which I think is the Mudlet default but can't remember. How about you?
edit: Too weird, so I reset the CONFIG COLOR back to white fg/black bg then back to yellow fg/black bg and now the ANSI looks normal again:
"Message: [0;1;33m(Market): Plato says, "Looking for a team to do the safari game with."[0m[0;37m"
The left arrows still don't copy into the browser, but I imagine I can just put the whole thing through a regex and find which ANSI character is representing them.
Edit: Also, this evening I hope to post the fortress gui xml so you can have a look at the rest of the code as well, if anyone is interested. It's still a work in progress as I want to match the 'config colour' stuff rather than defining a second table, but aside from that I'm really happy about how it turned out.
2. I have an event handler for gmcp.Comm.Channel.Text
function gmcp_Comm_Channel_Text_Handler() display("\n") display("Channel: ".. gmcp.Comm.Channel.Text.channel) display("Character: ".. gmcp.Comm.Channel.Text.talker) display("Message: ".. gmcp.Comm.Channel.Text.text) display("\n") end
I added a screencap in an earlier post, and that was shown using display(gmcp), but it looks identical to gmcp.Comm.Channel.Text.text. It also doesn't consistently do it, just when I start configuring colors IG.
Strange! Maybe it's time to restart Mudlet. Sometimes it's normal though:
Thanks for all the help :]
UPDATE: The problem seems to go away when I also set the BG color using CONFIG COLOR. That is, if I only set the FG color (even though there is a default BG) it sends me weird stuff, so I'm just making sure to set the BG to black every time now. (psst @Irruel)
Where codez is gmcp.Comm.Channel.Text.text that I'm passing through an alias for debugging purposes.
I don't know how much work string.match is, but it's only 2 string functions instead of 4. I do know pattern matching like this is tedious in general, so even if this is fewer string functions I can still see this being less efficient than your method. I'll have to run a thousand strings and find out some other time.
edit: That solution didn't work I found out. So far this this one is holding.
Whenever I connect to my Aetolia profile on Mudlet and then login on a character, there is a period where Mudlet almost threatens to go non-responsive. I don't think it actually is, but I blame windows 7 for displaying it as such. Sometimes the whole client even goes grey. Today, before I logged in I turned on the debugger to see what was holding it up.
07:33:59.980 [TIMER EXECUTES]: 5 fired. Executing command= and executing script: 07:34:08.756 LUA OK anonymous Lua function ran without errors 07:34:08.765 new line arrived:Please remember to Vote for Aetolia every day at http://www.aetolia.com/vote!
So it's happening right when these timers are going off. I then opened up my timers, and tried to find the culprit, but the only one I have (as in, I don't have 5 timers) is for the mudlet mapper's auto-update. That one goes off every hour I'm logged in, and if it's to blame it never lags me out the next time it fires. Is this a known Mudlet issue? Are there timers Mudlet doesn't give the user access to?
Anyone good with TW I need to add this line but I seem to have lost my mind and can not solve the problem.
The Adder rises up from behind (\w+), (\w+) dripping from its fangs. With a sudden lurch, it clamps its jaw tightly onto (\w+)'s neck and pumps .+ with the venom.
Original line: The Adder rises up from behind Lim, curare dripping from its fangs. With a sudden lurch, it clamps its jaw tightly onto Bob's neck and pumps his with the venom.
The adder gives different venom types when used, so it needs to detect this.
Anyone good with TW I need to add this line but I seem to have lost my mind and can not solve the problem.
The Adder rises up from behind (\w+), (\w+) dripping from its fangs. With a sudden lurch, it clamps its jaw tightly onto (\w+)'s neck and pumps .+ with the venom.
Original line: The Adder rises up from behind Lim, curare dripping from its fangs. With a sudden lurch, it clamps its jaw tightly onto Bob's neck and pumps his with the venom.
The adder gives different venom types when used, so it needs to detect this.
Not sure why it doesnt work. You can try the trigger by using ` before the original line you pasted (get rid of the line return since mudlets returns arent part of the matching). It seems to be fine for me.
You tilt your head back and deeply inhale any scents from the air. Avani: 12655 Central Basilica Milian: 14507, 28060 Arcan Antiquities Ensal: 26928, 25504, 24355A cozy livingroom Didi: 11939 Through the farmlands Parker: 13032 The Gemini Noelle: 11708, 53303 The Inner Gate of Spinesreach Aren: 26928, 25504, 24355A cozy livingroom Rilee: 14481 Fountain in a frozen courtyard Faerah: 11708, 53303 The Inner Gate of Spinesreach Argolis: 11708, 53303 The Inner Gate of Spinesreach Balance Used: 2.32 seconds
The numbers show up in this horribly hard to read blue. Is there -any- way I can change it to a lighter shade of blue? It's like, literally, almost impossible for me to read the blue it's in now against the black background.
Tell me and I forget, teach me and I remember, involve me and I learn. -Benjamin Franklin
Comments
local str = string.title(channel) or "All"
selectString(line,1)
local er,eg,eb = getBgColor()
local tflag = false
if er == 0 and eg == 0 and eb == 0 then
setBgColor(0,0,0)
tflag = true
end
copy()
if str ~= "Shouts" then
appendBuffer("GUI.chat.All")
end
if str ~= "All" then appendBuffer("GUI.chat." .. str) end
if tflag then
setBgColor(0,0,0)
end
GUI[str.. "tab"]:flash(1.5)
end
----------------------------------------------------------
@Irruel
Is the script I use the GUI stuff is my design/chat window .. that and 6 lines of code to capture from GMCP in a script with event handler
I can see that, with the getBgColor() func (though, shouldn't it be getFgColor()?)
I'm not convinced that there isn't an easier way to figure the colour from the raw ansi.
string.match on the 32m bit, then compare the result to a table that converts it to a colour name, perhaps.
I'll test it out next time I get the chance, in a couple of day.
Here's a question: I'm using that to capture messages over channels. My thought is to store all the messages into a table, but I'm worried that after being online for a while that it'll become a huge table. Is there a general best practice for the amount of string data to put in a table, or the amount of complexity/levels a table should hold before Mudlet starts to get angry with me?
edit lrn2moregoogle: Miniconsoles sound like exactly what I want: [Miniconsoles are] very efficient as well, so you can have many miniconsoles, even in spam, not lag you down.
JSYK she/her pronouns!
To reproduce, copy the string then echo() it out. Mudlet will break. Not sure what's causing it at this stage.
I'm 95% sure I have the solution I need for my script though (and if not I'll just copy Nalor's). It'll have to wait for Monday morning though, as that is the next moment I will have to spend coding anything.
its giving an error on this line
local votestring = "http://www.topmudsites.com/vote.php?" .. "&do=in" .. "&pzzzqaaz=" .. pzzzqaaz .. "&mudid=" .. mudid .. "&votehash=" .. votehash
and error is
<[string "function downloaded_file(_, filename)..."]:12: attempt to concatenate local
'pzzzqaaz' (a nil value)>
And IT was working til the other day and it suddenly stopped. Ive not edited it since I put it in my system months ago.
I'm assuming '' is two single quotes, but if so, why?
Also, read it by line with *l rather than *all and see if that yields the results you desire.
I trie *l before and it didnt do what it does/ did now before it stopped working
For anyone on TW, you can replace the vote_page_download script with the following and it should work.
HALP CODE FORMATTING
function vote_page_download(_, filename) local ohRex = [[name="oldhash" type="hidden" value="(%x+)"]] local thRex = [[name="testid" type="hidden" value="(%x+)"]] local miRex = [[type="hidden" name="mudid" value="(%d+)"]] local vhRex = [[type="hidden" name="votehash" value="(%x+)"]] tmp.oldhash = nil tmp.testid = nil tmp.mudid = nil tmp.votehash = nil if filename == tostring(tmp.vote_page) then for line in io.lines(filename) do if line:find([[type="hidden"]]) then if string.match(line, ohRex) then tmp.oldhash = string.match(line, ohRex) end if string.match(line, thRex) then tmp.testid = string.match(line, thRex) end if string.match(line, miRex) then tmp.mudid = string.match(line, miRex) end if string.match(line, vhRex) then tmp.votehash = string.match(line, vhRex) end end end if tmp.oldhash and tmp.mudid and tmp.votehash and tmp.testid then tmp.votePhP = string.format("http://www.topmudsites.com/vote.php?do=in&oldhash=%s&mudid=%s&votehash=%s&temphash=%s", tmp.oldhash, tmp.mudid, tmp.votehash, tmp.testid) info("Calling " .. tmp.votePhP) info("Vote has been cast!") downloadFile(tmp.voted_page, tmp.votePhP) end elseif filename == tostring(tmp.voted_page) then send("voted", false) end end
So what's the differences between crafts and the Clan of The Crafting Guild of Sapience? Crafts doesn't show up in Comm.Channel.List.
Thanks!
JSYK she/her pronouns!
The other one is just an ordinary clan.
JSYK she/her pronouns!
Look at the mudlet help forum for more details:
http://forums.mudlet.org/viewtopic.php?f=9&t=4545&sid=0bdd74a40cdcf92829330925c89e46e1
I imagine I'll eventually make a thing to parse all the ANSI so that my channel capture can use whatever colors are configured in the game, but all the SEND and HREF stuff isn't ANSI, and that's what I'm confused about.
Mine was showing things like this but now it has way more symbols and also the SEND and HREF business which wasn't originally coming up when I looked in the GMCP table. Is your GMCP table also showing the left arrows and other things?
JSYK she/her pronouns!
edit: Too weird, so I reset the CONFIG COLOR back to white fg/black bg then back to yellow fg/black bg and now the ANSI looks normal again: The left arrows still don't copy into the browser, but I imagine I can just put the whole thing through a regex and find which ANSI character is representing them.
JSYK she/her pronouns!
As for the table: you're welcome.
I made a new post to the thread with the working script in it. The table changed a bit and the subbing etc is worked out.
If you prefer hastebin to the mudlet forum:
http://hastebin.com/kulebibuga.js
Edit:
Also, this evening I hope to post the fortress gui xml so you can have a look at the rest of the code as well, if anyone is interested. It's still a work in progress as I want to match the 'config colour' stuff rather than defining a second table, but aside from that I'm really happy about how it turned out.
edit: Sorry for being vague and difficult, here's a screenshot:
JSYK she/her pronouns!
display(gmcp.Comm.Channel.Text.text)
do you see that weird stuff there?
Or is it only when you copy/paste it elsewhere?
I ask because you may have done 'copy html' by mistake.
1. I have an alias that just does a simple 2. I have an event handler for gmcp.Comm.Channel.Text I added a screencap in an earlier post, and that was shown using display(gmcp), but it looks identical to gmcp.Comm.Channel.Text.text. It also doesn't consistently do it, just when I start configuring colors IG.
JSYK she/her pronouns!
Thanks for all the help :]
UPDATE: The problem seems to go away when I also set the BG color using CONFIG COLOR. That is, if I only set the FG color (even though there is a default BG) it sends me weird stuff, so I'm just making sure to set the BG to black every time now. (psst @Irruel)
JSYK she/her pronouns!
Where codez is gmcp.Comm.Channel.Text.text that I'm passing through an alias for debugging purposes.
I don't know how much work string.match is, but it's only 2 string functions instead of 4. I do know pattern matching like this is tedious in general, so even if this is fewer string functions I can still see this being less efficient than your method. I'll have to run a thousand strings and find out some other time.
edit: That solution didn't work I found out. So far this this one is holding.
JSYK she/her pronouns!
Thanks!
JSYK she/her pronouns!
I tried to use this but it is wrong.
Abhorash says, "Ve'kahi has proved that even bastards can earn their place."
I tried to use this but it is wrong. Not sure why it doesnt work. You can try the trigger by using ` before the original line you pasted (get rid of the line return since mudlets returns arent part of the matching). It seems to be fine for me.
Avani: 12655 Central Basilica
Milian: 14507, 28060 Arcan Antiquities
Ensal: 26928, 25504, 24355A cozy livingroom
Didi: 11939 Through the farmlands
Parker: 13032 The Gemini
Noelle: 11708, 53303 The Inner Gate of Spinesreach
Aren: 26928, 25504, 24355A cozy livingroom
Rilee: 14481 Fountain in a frozen courtyard
Faerah: 11708, 53303 The Inner Gate of Spinesreach
Argolis: 11708, 53303 The Inner Gate of Spinesreach
Balance Used: 2.32 seconds
The numbers show up in this horribly hard to read blue. Is there -any- way I can change it to a lighter shade of blue? It's like, literally, almost impossible for me to read the blue it's in now against the black background.
I remember, involve me and I
learn.
-Benjamin Franklin