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
➜ Plugins
➜ Equipment analyzer/sorting plugin/script help needed!
|
Equipment analyzer/sorting plugin/script help needed!
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2 3
| Posted by
| Fiendish
USA (2,555 posts) Bio
Global Moderator |
| Date
| Reply #15 on Sat 01 Jun 2019 08:25 PM (UTC) Amended on Sat 01 Jun 2019 08:28 PM (UTC) by Fiendish
|
| Message
| That's a tricky scenario. What you need to do is wait until you know that all of the messages are done for the thing that you're looking at before you put anything in the box.
You will need to plan out a logical sequence of events between
- an alias or trigger that captures the name of the thing that you're using lore on
- then one or more triggers that capture the stat lines
- then some way of detecting that you're done receiving stat lines so that you can safely put just the one item in the box
|
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Sephiran
(16 posts) Bio
|
| Date
| Reply #16 on Sat 01 Jun 2019 08:45 PM (UTC) Amended on Sat 01 Jun 2019 08:59 PM (UTC) by Sephiran
|
| Message
| thanks fiendish for ur answer i will work on that. also wanted to know if i have different numbers set for all three like if "%1" >= "300" and "%1" >= "400" and "%1" >= "1000" then
Send("put 1. love")
end
...nvm that still matches on all three.. if i set damroll to %3 and spellpower to %2 and intelligence to %1 in variables it wont fire at all.. would i have to use like a,b,c for variables? i tried to just use a set value of 3000 for variable named damroll (damroll can go over 3k)... but again matched on all three stats... thinking i may need three separate triggers for each stat i want to compare instead of one for all three? there are "" around 300,400,1000 had to put them or else i get this error: string "Trigger: "]:1: attempt to compare number with string | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #17 on Sat 01 Jun 2019 10:59 PM (UTC) Amended on Sat 01 Jun 2019 11:19 PM (UTC) by Nick Gammon
|
| Message
| If %1 is a number then you should be able to write:
If you write:
Then you can (will) get problems with certain numbers. As strings, for example, "4" is greater then "300", because strings compare from the left.
It might be easier if you switch to putting code in a script file. There is provision in the Scripting configuration tab for making or selecting a script file. Then put the name of the script function in the trigger and leave the Send box blank. The function looks like this:
function myTrigger (name, line, wildcards, styles)
-- put your code here
end -- myTrigger
Inside such a function the wildards are table entries in the wildcards variable. eg.
local weaponstats = tonumber (wildcards [1]) -- first wildcard, convert to number
if weaponstats == nil then
return -- not a number
end -- if
if weaponstats >= 300 then
-- do something
end -- if
Now you don't have to muck around with %1 style wildcards.
You might also find it easier to name your wildcards, like this:
match="(.*)Affects (?<whichstat>(spellpower|intelligence|damroll)) by (?<statvalue>.*?)\."
Now the whole function can look like this:
function myTrigger (name, line, wildcards, styles)
local whichstat = wildcards.whichstat -- which stat, eg. spellpower, intelligence etc.
local statvalue = tonumber (wildcards.statvalue) -- what the value is, convert to number
if statvalue == nil then -- tonumber returns nil if the string cannot be converted to a number
return -- not a number
end -- if
if statvalue >= 300 then
-- do something
end -- if
end -- myTrigger
See my video about scripting: http://www.gammon.com.au/forum/?id=10212
Direct link to video: Vimeo: MUSHclient scripting tutorial
Also see this: http://www.gammon.com.au/scripting
That explains about putting scripts into a script file. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Sephiran
(16 posts) Bio
|
| Date
| Reply #18 on Sun 02 Jun 2019 02:45 AM (UTC) Amended on Sun 02 Jun 2019 02:52 AM (UTC) by Sephiran
|
| Message
| thanks nick, that may help out a lot.. question however looking at what you posted it seems like i will need a wildcard for each stat i have to compare?, some item will have none others just 1 & some maybe just 2 others could have all 3. Would I need a wildcard for each stat i am comparing? like 1 for damroll one for spellpower and one for intelligence? the statvalue will always be a random number. I just want values for the stats on the items to be equal to or greater then certain numbers.. like if damroll is >= 3000 and intelligence >= 400 and spellpower >= 400 then it would do something ... .... sorry maybe i am just confused or confusing my self.. being starting at ur post trying to figure it out. it makes sense but... Maybe it's cause i am hang up on this line here : if statvalue >= 300 then
-- do something
i have no clue why
ex of an item in game
Object 'unique Soratami Seer glittery sword of crack elite epic' is type weapon
Extra flags nolocate unique.
Extra2 flags elite epic
put epic love
Weight is 1, value is 0, level is 466.
Weapon type is sword.
Damage is 40d33(average 680).
Base critical chance is 5.00%.
Damage noun is hit.
Affects constitution by 893.
Affects spellpower by 469.
Affects hp by 11891.
Affects move by 32617.
Affects mana by 12605.
Affects hitroll by 1033.
Affects damroll by 1292.
Affects wisdom by 402.
Affects intelligence by 324.
Affects critical chance by 1.31% percent.
if damnroll was 300o or more and intelligence was 400 or more it would put this in a bag... only on items that have all three stats... | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #19 on Sun 02 Jun 2019 02:55 AM (UTC) Amended on Sun 02 Jun 2019 02:57 AM (UTC) by Nick Gammon
|
| Message
| I was doing a simplified example. I could answer better if you showed examples of the MUD output, with the various stats (you said you might have one, two or three of them).
Maybe show the whole thing you are trying to analyze? I am having to guess from your descriptions. This sort of stuff isn't very clear:
Quote:
is there a way to make it so it only puts the item that's lored in to something or dropped? by name or something? i tried to just have put 1. box but if an item matches on more the one stat it puts not only the item that i'm loring into a box but the other two after it that is in my inv. ex from game
Before you even start to code you want to have in your head a clear logic flow.
[EDIT] I note you added an example while I was typing. Thanks! Perhaps a few more? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #20 on Sun 02 Jun 2019 02:58 AM (UTC) |
| Message
| What would you get after those lines? In other words, what sort of line indicates the end of those attributes?
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #21 on Sun 02 Jun 2019 03:21 AM (UTC) Amended on Sun 02 Jun 2019 03:26 AM (UTC) by Nick Gammon
|
| Message
| Based on your example, this is the general idea:
<triggers>
<trigger
enabled="y"
match="*"
name="end_of_affects"
send_to="12"
sequence="110"
>
<send>
-- turn off most of the triggers
EnableTrigger ("affects", false)
EnableTrigger ("end_of_affects", false)
EnableTriggerGroup ("attributes_group", false)
-- show results
if objectDamage then
print ("Damage is", objectDamage)
print ("Average damage is", objectAverageDamage)
end -- if
local damroll = tonumber (objectStats ['damroll'])
local constitution = tonumber (objectStats ['constitution'])
local spellpower = tonumber (objectStats ['spellpower'])
-- check if good enough
if damroll and constitution and spellpower then -- if attributes exist
if damroll >= 1000 and constitution >= 500 and spellpower >= 100 then
print (string.format ("Putting %s in the bag", objectName))
else
print (string.format ("Object %s isn't good enough", objectName))
end -- if
end -- if
</send>
</trigger>
<trigger
match="Affects * by *."
name="affects"
send_to="12"
sequence="100"
>
<send>
objectStats ["%1"] = "%2" -- remember the affect
EnableTrigger ("end_of_affects", true) -- enable a trigger that matches anything
</send>
</trigger>
<trigger
group="attributes_group"
match="Damage is *(average *)."
send_to="12"
sequence="100"
>
<send>
objectDamage = "%1" -- remember damage
objectAverageDamage = "%2" -- and average damage
</send>
</trigger>
<trigger
enabled="y"
match="Object '*' is type *"
name="NewObject"
send_to="12"
sequence="100"
>
<send>
objectStats = {} -- no stats yet
objectName = "%1" -- remember name
objectType = "%2" -- remember type
EnableTrigger ("affects", true) -- get ready to receive affects
EnableTriggerGroup ("attributes_group", true) -- get ready to receive other attributes
</send>
</trigger>
<trigger
group="attributes_group"
match="Weight is *, value is *, level is *."
send_to="12"
sequence="100"
>
<send>
-- an example of collecting attributes
objectWeight = "%1"
objectValue = "%2"
objectLevel = "%3"
</send>
</trigger>
</triggers>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
What this does is wait for the line "Object '*' is type *" which enables a trigger and a trigger group. Those triggers start matching the incoming attributes (how ever many of them there are) and putting them in a table. Then when the final line comes (a line NOT starting with "Affects") then it can analyze what it found and make a decision.
In this particular case:
Damage is 40d33
Average damage is 680
Putting unique Soratami Seer glittery sword of crack elite epic in the bag
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Sephiran
(16 posts) Bio
|
| Date
| Reply #22 on Sun 02 Jun 2019 03:27 AM (UTC) Amended on Sun 02 Jun 2019 04:12 AM (UTC) by Sephiran
|
| Message
| Edit sorry i was slow in posting this just realized you posted again before i posted this thanks nick, here is a screenshot of an item that has only two of the stats i want on it so.. i would just drop this one... being lored in game... the best way i could explain what is after all the stats i was not sure how to explain it myself...
https://imgur.com/a/8d9v1lB
Edit sorry if this is a dumb question... confused your last post nick is all triggers? so each one will go under one trigger or all in one? or do i do the script file route? cause i tried that and got
Immediate execution
[string "Script file"]:3: unexpected symbol near '<'
Error context in script:
1 : function myTrigger (name, line, wildcards, styles)
2 :
3*: <triggers>
4 :
5 : <trigger
6 : enabled="y"
7 : match="*"
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #23 on Sun 02 Jun 2019 04:38 AM (UTC) |
| Message
| Yes, for compactness it is just triggers. I put a link how to use it:
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #24 on Sun 02 Jun 2019 04:40 AM (UTC) |
| Message
| | Rather than posting screenshots (which I can't copy and test) please copy/paste the actual text from the window like you did before. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Sephiran
(16 posts) Bio
|
| Date
| Reply #25 on Sun 02 Jun 2019 04:54 AM (UTC) |
| Message
| i understand that what i was confused about is for ex:
<triggers>
<trigger
enabled="y"
match="*"
name="end_of_affects"
send_to="12"
sequence="110"
>
<send>
-- turn off most of the triggers
EnableTrigger ("affects", false)
EnableTrigger ("end_of_affects", false)
EnableTriggerGroup ("attributes_group", false)
-- show results
if objectDamage then
print ("Damage is", objectDamage)
print ("Average damage is", objectAverageDamage)
end -- if
local damroll = tonumber (objectStats ['damroll'])
local constitution = tonumber (objectStats ['constitution'])
local spellpower = tonumber (objectStats ['spellpower'])
-- check if good enough
if damroll and constitution and spellpower then -- if attributes exist
if damroll >= 1000 and constitution >= 500 and spellpower >= 100 then
print (string.format ("Putting %s in the bag", objectName))
else
print (string.format ("Object %s isn't good enough", objectName))
end -- if
end -- if
</send>
</trigger>
would go in to one trigger alone? or paste all into one trigger? sorry again if this is a dumb question i know this is a simple matter, But simple and me always turns in to complicated... i tried pasting it all under one trigger set it to match lore but got this string ["Trigger: "]:1: unexpected symbol near '<'
just seen that u posted before i posted this so here is what the screenshot was of
lore 1.
Object 'unique A citizen autumn pendant of flowering elite epic' is type armor
Extra flags nolocate unique.
Extra2 flags elite epic
Weight is 1, value is 0, level is 463.
Worn on: take neck
Armor class is 13177 pierce, 13137 bash, 13126 slash, and 13177 vs. magic.
Affects dexterity by 420.
Affects constitution by 346.
Affects wisdom by 1116.
Affects intelligence by 962.
Affects strength by 339.
Affects move by 13193.
Affects spellpower by 259.
Affects mana by 10428.
[EX:NESWU][Align: -994][ETL: 35000]
<802574/802574Hp 409832/411332M 462674/462674Mv>
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #26 on Sun 02 Jun 2019 04:55 AM (UTC) Amended on Sun 02 Jun 2019 04:56 AM (UTC) by Nick Gammon
|
| Message
| Would you please look at that link that I posted twice and follow it? You seem to be ignoring that and trying to guess what to do. There are multiple triggers there and following that link will make all triggers be imported in one operation.
Here it is again:
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Sephiran
(16 posts) Bio
|
| Date
| Reply #27 on Sun 02 Jun 2019 05:33 AM (UTC) Amended on Sun 02 Jun 2019 05:45 AM (UTC) by Sephiran
|
| Message
| | it works thanks nick had to lore the sword for some reason before it started working bout my last post i'm sorry that was my bad i was trying load from file but clipboard solve my issue | | Top |
|
| Posted by
| Sephiran
(16 posts) Bio
|
| Date
| Reply #28 on Sun 09 Jun 2019 03:36 PM (UTC) |
| Message
| | would it be possible to edit this https://github.com/Aardurel/aard-plugins/blob/master/aard_inventory.xml for other muds? asking for a friend cause i didn't know if it could be done myself... i don't think he means the whole thing just certain parts of it only.. think he is trying to add it to other scripts he has. | | Top |
|
| Posted by
| Fiendish
USA (2,555 posts) Bio
Global Moderator |
| Date
| Reply #29 on Sun 09 Jun 2019 03:45 PM (UTC) |
| Message
| | Oof. Everything is possible within the limits of what other muds support, but Durel's inventory plugin for Aardwolf is 23000 lines long. Even just reading through it to figure out what would need to be changed would take more work than is reasonable if it's not your full time job. |
https://github.com/fiendish/aardwolfclientpackage | | 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.
99,109 views.
This is page 2, subject is 3 pages long:
1
2 3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top