Little stuck on this one

Posted by AaronM86 on Wed 31 Mar 2010 06:57 PM — 12 posts, 37,760 views.

#0
------------------------------------------------------------

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
#1
Nvm, figured this out just by trial and error tinkering. :)
#2
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>
#3
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.
#4
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?
#5
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
#6
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!
#7
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?
#8
<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?
#9
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.
#10
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.
#11
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.