Help!

by Unknown

Back to Mechanic's Corner.

Unknown2007-12-09 18:36:53
So I am working on my scripting again in Mushclient...not sure why but I like the client so much I want to actually get good in it...

Anyways, I'm just goofing off and making a forging script and here is the part I am having trouble with. I want to get it so I pull my hammer from the forge and weapon probe it. If the stats for speed are under 275, put it back in and smelt it down and begin again.

Any suggestions please?
Fualkner2007-12-09 19:20:39
Hrm... Well, I'm no expert on forging. However, you could have it trigger on the line that gives the speed of the weapon, like this

Speed: *

And the code it sends:

CODE
if %1 < 275 then
  send ("")
end


Make sure that sends to Script and you should be good.

If you need more help / need more code, just tell me.
Unknown2007-12-09 19:24:32
QUOTE(Fualkner @ Dec 9 2007, 11:20 AM) 463733
Hrm... Well, I'm no expert on forging. However, you could have it trigger on the line that gives the speed of the weapon, like this

Speed: *

And the code it sends:

CODE
if %1 < 275 then
  send ("")
end


Make sure that sends to Script and you should be good.

If you need more help / need more code, just tell me.


Thanks. Will give it a try.
Unknown2007-12-09 19:34:48
Tried it and I got an error. This is what it was...

Error number: 0
Event: Compile error
Description: :1: '=' expected near '<'
Called by: Immediate execution


Here is the code I used to...


enabled="y"
match="Speed: *"
regexp="y"
send_to="12"
sequence="100"
>
If %1 < 275 then
send ("put hammer in forge")
send ("smelt hammer")
end



Unknown2007-12-10 00:46:09
Don't use regex?
Unknown2007-12-10 02:34:42
QUOTE(Zarquan @ Dec 9 2007, 04:46 PM) 463785
Don't use regex?


Then it doesn't do anything. Doesn't even give an error message.

It can't be this hard...there is something simple I'm missing I'm sure. Just not sure what it is or where to find it in the help files...
Arundor2007-12-10 04:55:01
How do you want to initiate this sequence of events? Does it get fired from another trigger or an alias or something else? As an alias, I'd do it like this:

CODE

        match="go"
    enabled="y"
    send_to="12"
    sequence="100"
    >
    
        Send("get hammer from forge")
        Send("weaponprobe hammer")
        EnableTrigger("weaponcheck", true)
    

    



        match="Speed: (\\d+)"
    name="weaponcheck"
    regexp="y"
    send_to="12"
    sequence="100"
    >
    
        if (tonumber("%1") < 275) then
            Send("put hammer in forge")
            Send("smelt hammer")
        end
        EnableTrigger("weaponcheck", false)
    

    
Unknown2007-12-10 04:59:45
How do I put that in without screwing it up? If I copy paste it won't work for some reason...and thanks Arundor for the help. I really appreciate it.
Arundor2007-12-10 05:01:53
The "Paste" button on MUSHClient's interface is working for me. What goes wrong when you try?
Unknown2007-12-10 05:05:17
hmm...I've been putting it in the command bar and hitting enter...just like I use to for Zmud...
Arundor2007-12-10 05:08:42
Try this.

1. Select the section from "" to "" and copy it in the normal way (Ctrl-C or Edit->Copy).
2. Open MUSHClient's alias window and hit the "Paste" button. That's the paste button on MUSHClient's interface, not the normal Ctrl-V keystroke. It's in the lower right corner of the alias window.
3. Select the section from "" to "" and copy it the normal way.
4. Open MUSHClient's trigger window and hit the "Paste" button.
Unknown2007-12-10 05:12:19
Did that and got this error.

Error number: 0
Event: Run-time error
Description: :2: attempt to compare nil with number

stack traceback:

:2: in main chunk
Called by: Immediate execution


Any ideas? I have no clue what the error even says...
Arundor2007-12-10 05:15:36
Hmm. Yeah, that's my fault, I screwed up.

In the trigger, change the "%2" to "%1". I'll make that change in the code I posted above too.
Unknown2007-12-10 05:22:28
It worked!!!! It is alive!!!! Thank you so much Arundor!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Unknown2007-12-10 05:26:27
okay final thing...is there a way to trigger the alias to go off after the syntax...

Your eye for detail tells you that a dwarven battle hammer cannot be refined any
Arundor2007-12-10 05:35:44
Yep, you could edit it to look like this:

CODE

        enabled="y"
    match="Your eye for detail tells you that a dwarven battle hammer cannot be refined any"
    regexp="y"
    send_to="12"
    sequence="100"
    >
    
        Send("get hammer from forge")
        Send("weaponprobe hammer")
        EnableTrigger("weaponcheck", true)
    

    

        match="Speed: (\\d+)"
    name="weaponcheck"
    regexp="y"
    send_to="12"
    sequence="100"
    >
    
        if (tonumber("%1") < 275) then
            Send("put hammer in forge")
            Send("smelt hammer")
        end
        EnableTrigger("weaponcheck", false)
    

    


Also, if you wanted to edit that to work with any weapon, you could change the match text for the first trigger to "Your eye for detail tells you that (.+) cannot be refined any"
Unknown2007-12-10 05:43:05
Thank you! yourock.gif