Only just discovered MUSHclient plugins a couple of days ago, soo some of this may be newbie-ish..
Anyways, I'm messing with a plugin and have a problem, specifically with a related trigger and function. The problem is likely in the function, but I'll give all the info here just in case.
First, the text I'm trying to capture, when the command 'gp' is entered, the following comes out:
You have 555 (555) guild points.
* You can use 201 (201) for covert commands.
* You can use 205 (205) for crafts commands.
* All of your guild points can be used for faith commands.
* You can use 269 (269) for fighting commands.
* You can use 139 (139) for magic commands.
* You can use 265 (265) for people commands.
* You can use 265 (265) for adventuring commands.
>
However it can also very easily come out as:
You have 8 (555) guild points.
* You cannot use any guild points for covert commands until you have more than 354.
* You cannot use any guild points for crafts commands until you have more than 350.
* All of your guild points can be used for faith commands.
* You cannot use any guild points for fighting commands until you have more than 286.
* You cannot use any guild points for magic commands until you have more than 416.
* You cannot use any guild points for people commands until you have more than 290.
* You cannot use any guild points for adventuring commands until you have more than 290.
>
Or something between the two. Which is why I was trying to grab the individual lines.
The trigger I was using for that is:
<trigger
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="^(?:> |)*^\* You can use (\d+) ?\((\d+)\) for (.+) commands.$"
regexp="y"
send_to="12"
sequence="2"
variable="test"
>
<send> TypeGPTrigger(%1,%2,%3)</send>
</trigger>
And the function the data is being sent to, is:
function TypeGPTrigger (vGP, vMaxGP, vType)
if (string.find ("covert", [[vType]]) == nil) then mushvar.MaxCoGP = vMaxGP end
if (string.find ("crafts", [[vType]]) == nil) then mushvar.MaxCrGP = vMaxGP end
if (string.find ("faith", [[vType]]) == nil) then mushvar.MaxFaGP = vMaxGP end
if (string.find ("fighting", [[vType]]) == nil) then mushvar.MaxFiGP = vMaxGP end
if (string.find ("magic", [[vType]]) == nil) then mushvar.MaxMaGP = vMaxGP end
if (string.find ("people", [[vType]]) == nil) then mushvar.MaxPeGP = vMaxGP end
if (string.find ("adventuring", [[vType]]) == nil) then mushvar.MaxAdGP = vMaxGP end
CompleteSet()
end -- TypeGPTrigger
With the above, all the variables I'm trying to set, come out as the last one, Adventuring, at 265. I think it's an issue with the string.find not being used correctly or being the wrong command. I had a lot of trouble trying to figure out string comparison for this as I hadn't seen this code before a couple of days ago.
That's everything I think, would appreciate any help I can get, thanks in advance!
Anyways, I'm messing with a plugin and have a problem, specifically with a related trigger and function. The problem is likely in the function, but I'll give all the info here just in case.
First, the text I'm trying to capture, when the command 'gp' is entered, the following comes out:
You have 555 (555) guild points.
* You can use 201 (201) for covert commands.
* You can use 205 (205) for crafts commands.
* All of your guild points can be used for faith commands.
* You can use 269 (269) for fighting commands.
* You can use 139 (139) for magic commands.
* You can use 265 (265) for people commands.
* You can use 265 (265) for adventuring commands.
>
However it can also very easily come out as:
You have 8 (555) guild points.
* You cannot use any guild points for covert commands until you have more than 354.
* You cannot use any guild points for crafts commands until you have more than 350.
* All of your guild points can be used for faith commands.
* You cannot use any guild points for fighting commands until you have more than 286.
* You cannot use any guild points for magic commands until you have more than 416.
* You cannot use any guild points for people commands until you have more than 290.
* You cannot use any guild points for adventuring commands until you have more than 290.
>
Or something between the two. Which is why I was trying to grab the individual lines.
The trigger I was using for that is:
<trigger
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="^(?:> |)*^\* You can use (\d+) ?\((\d+)\) for (.+) commands.$"
regexp="y"
send_to="12"
sequence="2"
variable="test"
>
<send> TypeGPTrigger(%1,%2,%3)</send>
</trigger>
And the function the data is being sent to, is:
function TypeGPTrigger (vGP, vMaxGP, vType)
if (string.find ("covert", [[vType]]) == nil) then mushvar.MaxCoGP = vMaxGP end
if (string.find ("crafts", [[vType]]) == nil) then mushvar.MaxCrGP = vMaxGP end
if (string.find ("faith", [[vType]]) == nil) then mushvar.MaxFaGP = vMaxGP end
if (string.find ("fighting", [[vType]]) == nil) then mushvar.MaxFiGP = vMaxGP end
if (string.find ("magic", [[vType]]) == nil) then mushvar.MaxMaGP = vMaxGP end
if (string.find ("people", [[vType]]) == nil) then mushvar.MaxPeGP = vMaxGP end
if (string.find ("adventuring", [[vType]]) == nil) then mushvar.MaxAdGP = vMaxGP end
CompleteSet()
end -- TypeGPTrigger
With the above, all the variables I'm trying to set, come out as the last one, Adventuring, at 265. I think it's an issue with the string.find not being used correctly or being the wrong command. I had a lot of trouble trying to figure out string comparison for this as I hadn't seen this code before a couple of days ago.
That's everything I think, would appreciate any help I can get, thanks in advance!