[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Little stuck on this one
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Little stuck on this one

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by AaronM86   (42 posts)  [Biography] bio
Date Wed 31 Mar 2010 06:57 PM (UTC)
Message
------------------------------------------------------------

7
Prepare these variables: mainMenu, subMenu, craftSac, ingredAmount, itemLevel, Resource, and OtherRes
2
NOTE: OtherRes is only defined if the recipe requires more than one ingredient type and you are using the crafting triggers from the CraftingMultiples groupname.

-----------------------------------------------------------

The above is a world.Note from my MUD World. From the above example, is there a method I can write my the script in my alias to make it so it will not Note the 7 and 2. I've tried several different combinations now, but still can't seem to get it right.


This is the alias I'm using to send the note, it's more or less just a reminder for all the variables I need to define before I start my crafting.

<aliases>
<alias
match="craftcheckup"
enabled="y"
group="Crafting"
send_to="12"
sequence="100"
>
<send>Note (GetNoteColour ())
SetNoteColour (2)
Note ("Prepare these variables: mainMenu, subMenu, craftSac, ingredAmount, itemLevel, Resource, and OtherRes")

Note (GetNoteColour ())
SetNoteColour (3)
Note ("NOTE: OtherRes is only defined if the recipe requires more than one ingredient type and you are using the crafting triggers from the CraftingMultiples groupname.")</send>
</alias>
</aliases>



Any help is greatly appreciated. :D
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #1 on Thu 01 Apr 2010 02:56 AM (UTC)
Message
Nvm, figured this out just by trial and error tinkering. :)
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #2 on Mon 05 Apr 2010 01:52 PM (UTC)
Message
Error number: 0
Event: Compile error
Description: [string "Trigger: "]:2: '}' expected (to close '{' at line 1) near '='
Called by: Immediate execution
------------------------------------------------------------

Above is the error I keep getting when this trigger attempts to fire. I can't for the life of me, figure out why it's asking for that. I referenced other similar triggers and everything is set up the same, so I'm not sure what my mistake is here... Below is the trigger:


<triggers>
<trigger
enabled="y"
expand_variables="y"
group="CraftingSockets"
match=" (* Sockets) (*) * Sickle [*]"
send_to="12"
sequence="100"
>
<send>socket_check = {
2 = true,
3 = true,
4 = true,
5 = true,
-- add more here
}

if socket_check [string.lower ("%1")] then
Send("put all.@craftSac Resources")
Send("get @ingredAmount @Resource")
Send("forge @mainMenu @subMenu @Count @itemLevel @Resource")</send>
</trigger>
</triggers>
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #3 on Mon 05 Apr 2010 04:13 PM (UTC)
Message
What I'm trying to do with my last post is sometimes I'll craft items that look like this:

(tiny) a bronze Sickle [4-38 dmg]

(1 Socket) (tiny) a bronze Sickle [4-38 dmg]

(2 Sockets) (tiny) a bronze Sickle [4-38 dmg]

My goal is to keep only the 2 sockets and above then put them in a container and continue to craft. After that sac the 1 socket and no socket items then continue to craft more.
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #4 on Mon 05 Apr 2010 04:38 PM (UTC)
Message
Tinkering with all this, I've worked it out to this, but still end up at the same error from the beginning...

<triggers>
<trigger
enabled="y"
expand_variables="y"
group="CraftingSockets"
keep_evaluating="y"
match="^ \((.*?) (.*?)\) \((.*?)\) (.*?) \[(.*?)\]$"
regexp="y"
send_to="12"
sequence="100"
>
<send>socket_check = {
2 = true,
3 = true,
4 = true,
5 = true,
-- add more here
}
socket_checkz = {
Socket = true,
-- add more here
}
if socket_check ("%1") then
Send("put all.@craftSac Resources")
Send("get @ingredAmount @Resource")
Send("forge @mainMenu @subMenu @Count @itemLevel @Resource")
elseif socket_checkz ("%2") then
Send("drop @craftSac")
Send("sac @craftSac")
else
Send("say Woah, something messed up!")
end</send>
</trigger>
</triggers>


Couldn't really figure out how to incorporate when an item has no sockets at all so it's missing a (1 Socket) or (2 Sockets) tag and just shows (tiny) a bronze Sickle [4-38 dmg]. So I also made this trigger and set both to keep evaluating:

<triggers>
<trigger
enabled="y"
expand_variables="y"
group="CraftingSockets"
keep_evaluating="y"
match="^ \((.*?)\) (.*?) \[(.*?) dmg\]$"
regexp="y"
sequence="100"
>
<send>drop @craftSac
sac @craftSac</send>
</trigger>
</triggers>


Another trigger fires when I sacrifice to commence more crafting. Now I still get the original script error, and after that trigger fails the sac trigger continues to sac my sockets I want to keep. Will I need to even re-arrange how I have it set up to match after I figure out my error problems as well? Or will the Socket check function run first and then it will null the other trigger out?
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #5 on Mon 05 Apr 2010 05:10 PM (UTC)
Message
Also tried putting it into my script and just running the function from the trigger, but ran into compiling errors... bah, I suck :( Thought I was starting to get a grasp on all this too haha. Sorry, I'm just frustrated with myself now.

function goattea()
socket_check = {
2 = true,
3 = true,
4 = true,
5 = true,
-- add more here
}

socket_none = {
Socket = true,
-- add more here
}

if socket_check ("%1") then
Send("put all.@craftSac Resources")
Send("get @ingredAmount @Resource")
Send("forge @mainMenu @subMenu @Count @itemLevel @Resource")
elseif socket_checkz ("%2") then
Send("drop @craftSac")
Send("sac @craftSac")
else
Send("say Woah, something messed up!")
end
end -- goattea
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #6 on Mon 05 Apr 2010 05:26 PM (UTC)
Message
Changed trigger Lua code to this:

<triggers>
<trigger
enabled="y"
expand_variables="y"
group="CraftingSockets"
match="^ \((.*?) (.*?)\) \((.*?)\) (.*?) \[(.*?)\]$"
regexp="y"
send_to="12"
sequence="100"
>
<send> if ("%1 &lt; 1") then
Send("put all.@craftSac Resources")
Send("get @ingredAmount @Resource")
Send("forge @mainMenu @subMenu @Count @itemLevel @Resource")
else
Send("drop @craftSac")
Send("sac @craftSac")
end</send>
</trigger>
</triggers>

Works perfect now, still unclear why it wouldn't work the other way though, I have a say channel trigger set up and written basically the same and it fires correctly. Ah well lol :) Got it to work anyway!
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #7 on Mon 05 Apr 2010 05:45 PM (UTC)
Message
if ("%1 < 1") then

Would that equal 1 and greater? Meaning I should use this?:

if ("%1 < 2") then

Since I only want to keep the 2 sockets and higher?
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #8 on Mon 05 Apr 2010 05:50 PM (UTC)
Message
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="CraftingSockets"
match="^ \((.*?) (.*?)\) \((.*?)\) (.*?) \[(.*?)\]$"
regexp="y"
send_to="12"
sequence="100"
>
<send>if ("%1 &lt; 2") then
Send("put all.@craftSac Resources")
Send("get @ingredAmount @Resource")
Send("forge @mainMenu @subMenu @Count @itemLevel @Resource")
else
Send("drop @craftSac")
Send("sac @craftSac")
end</send>
</trigger>
</triggers>


I have it set to that now, but it's still putting the (1 Socket) items in the container, instead of sac'ing them as well. Hrm?
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #9 on Mon 05 Apr 2010 05:56 PM (UTC)
Message
Changed the else in the middle of the trigger to:

elseif ("%1 > 2") then

Still puts the (1 Socket) items in the container. So confused lol.
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #10 on Mon 05 Apr 2010 06:34 PM (UTC)
Message
Noticed I had the > and < in the reverse spots. Re-arranged those but I am still oddly left with the same problem. Putting the 1 sockets into the portal instead of just 2 and above... hrm, so mind boggling lol.
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #11 on Mon 05 Apr 2010 06:37 PM (UTC)
Message
I'll be damned! I got it! lol :D

Rewrote it like this to, before I guess it was written incorrectly and just ignoring the ifcheck all together:

if %1 > 1 then
Send ("put all.@craftSac Resources")
Send ("get @ingredAmount @Resource")
Send ("forge @mainMenu @subMenu @Count @itemLevel @Resource")
elseif %1 < 2 then
Send ("drop @craftSac")
Send ("sac @craftSac")
end

Funny how it worked out so simple in the end lol. Sorry for all the random posting.
[Go to top] 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.


5,338 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]