Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Serialize
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #15 on Mon 13 Dec 2004 11:31 PM (UTC) |
| Message
| Ok, a little mis-communication going on here. Let me clarifyskills = {}
function do_skill_trigger (name, line, wildcards)
-- make a regexp the same as the trigger, excluding the {1,3} at the end
re = rex.new (string.gsub (GetTriggerInfo (name, 1), "{1,3}", ""))
-- save name and mastery
re:gmatch (line, function (m, t) skills [t.name] = t.mastery end )
skills_sorted = {}
for k in pairs (skills) do
table.insert (skills_sorted, k)
end
table.sort (skills_sorted)
for _, v in skills_sorted do
print (string.format ("%-20s", v), skills [v])
end
end -- function
The last for statement.
for _, v in skills_sorted do
print (string.format ("%-20s", v), skills [v])
end
That prints like crazy amounts of lines... I don't know where to put that bit of code, I put it in the scriptfile, because that's where I figured it went...
I was under the impression that as you walked through each step you built on the existing function do_skills_trigger.
I think what you're saying is that, I don't have to have that in the do_skills_trigger, I can put that in an alias, or a different trigger. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #16 on Tue 14 Dec 2004 12:07 AM (UTC) |
| Message
| I was illustrating ideas. Not saying to put the whole heap in a single trigger.
The trigger, which is called for every line, should simply gather information, eg.
skills = {}
function do_skill_trigger (name, line, wildcards)
-- make a regexp the same as the trigger, excluding the {1,3} at the end
re = rex.new (string.gsub (GetTriggerInfo (name, 1), "{1,3}", ""))
-- save name and mastery
re:gmatch (line, function (m, t) skills [t.name] = t.mastery end )
end -- function
The rest is done elsewhere, once you have all the lines. For example, you could make a trigger that matches something at the end of the skills list, whatever that is. Or just make an alias to do it when you need the sorted list.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #17 on Tue 14 Dec 2004 12:25 AM (UTC) Amended on Tue 14 Dec 2004 12:26 AM (UTC) by David Berthiaume
|
| Message
| Gotcha gotcha... I understand now. I misunderstood what it was you were doing, then I thought I understood, but I understood incorrectly, but it worked out because it did what I wanted it to do anyways.
I think this part of the script is just about finished. All that's left is to finish off the replace text script we're working on in the other thread, then we can run this script through that one, and re-order our skill/spell lists. | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
64,432 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top