Register forum user name Search FAQ

Gammon Forum

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 ➜ Lua ➜ trigger builing problem

trigger builing problem

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


Posted by Dragonlord   (24 posts)  Bio
Date Wed 25 Mar 2015 08:39 PM (UTC)
Message
You take 3 of a silver runestone from Vandemaar's Reagent Bag.
You take 3 of a browning mandrake leaf from Vandemaar's Reagent Bag.
You take 3 of a feather from a roc from Vandemaar's Reagent Bag.
You take 5 of a shimmering white fish scale from Vandemaar's Reagent Bag.
You take 2 of a sunstone from Vandemaar's Reagent Bag.
You take 3 of a pinch of sulfur from Vandemaar's Reagent Bag.

[839, 335]
[***][-/][safe]<2241hp 2255sp 1976st>
You need to reword your request - type 'commands' for a full list.

[839, 335]
[***][-/][safe]<2241hp 2255sp 1976st>
You drop a shimmering white fish scale.
A shimmering white fish scale vanishes in a puff of smoke.
You drop a shimmering white fish scale.
A shimmering white fish scale vanishes in a puff of smoke.
You drop a shimmering white fish scale.
A shimmering white fish scale vanishes in a puff of smoke.
You drop a shimmering white fish scale.
A shimmering white fish scale vanishes in a puff of smoke.
You drop a shimmering white fish scale.
A shimmering white fish scale vanishes in a puff of smoke.

[839, 335]
[***][-/][safe]<2241hp 2255sp 1976st>
There is no command 'else'. You may have meant: se, nose, cls, use, eye, east, rose, flee, clue
Type 'commands' for a list of commands.

[839, 335]
[***][-/][safe]<2241hp 2255sp 1976st>
There is no command 'end'. You may have meant: n, e, d, ne, nw, ni, ten, nod, eat
[***][-/][safe]<2241hp 2255sp 1976st>
You close Vandemaar's Reagent Bag.


<triggers>
<trigger
enabled="y"
group="(reagents)"
ignore_case="y"
keep_evaluating="y"
match="Your Vandemaar's Reagent Bag glows white as it accumulates possessions from the ether."
regexp="y"
send_to="10"
sequence="100"
>
<send>open itemg
get all itemg

if (You aren't carrying anything that will fit into a blue silk bag) then
drop all.reagent-water
else (put all.reagent-water waterreagents)
end -- if

if (You aren't carrying anything that will fit into a red silk bag) then
drop all.reagent-fire
else (put all.reagent-fire firereagents)
end -- if

if (You aren't carrying anything that will fit into a yellow silk bag) then
drop all.reagent-air&#9;
else (put all.reagent-air airreagents)
end

if (You aren't carrying anything that will fit into a black silk bag) then
drop all.reagent-earth
else (put all.reagent-earth earthreagents)
end -- if

if (You aren't carrying anything that will fit into a woven silver bag) then
drop all.gem
else (put all.gem gemreagents)
end -- if

if (You aren't carrying anything that will fit into a woven gold bag) then
drop all.reagent-ethereal
else (put all.reagent-ethereal ethrealreagent)
end -- if

close itemg
</send>
</trigger>
</triggers>

what this meant to do was to fill the reagent bags but if they was full then drop the reagents items
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 26 Mar 2015 04:01 AM (UTC)
Message

 if (You aren't carrying anything that will fit into a blue silk bag) then


I'm not sure what this is. Is this some kind of pseudo-code for what you want to achieve?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #2 on Thu 26 Mar 2015 05:18 AM (UTC)
Message
Part of the problem is you're sending the code you're attempting to process for your trigger to the mud. You can't send conditional statements to the mud like that, the command parser on the server has absolutely no idea what you're attempting to do.

That said, giving us actual output from the mud is a good start. The trigger is going to have to be completely rewritten though and possibly converted into several triggers based on which items are in play.

Nick, I'm pretty sure that's the response he's getting from the mud if the bag is full and wants to drop a reagent group in response to.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Dragonlord   (24 posts)  Bio
Date Reply #3 on Thu 26 Mar 2015 08:30 PM (UTC)
Message
Ok, the first part of the trigger receives,
"Your Vandemaar's Reagent Bag glows white as it accumulates possessions from the ether."

The Vandemaar's Reagent Bag has a keyword of itemg <-- itemg = itemgenerator

The second part of the trigger goes into opening the bag and getting the reagents from the itemgenerator

1) checks if my water reagent can be added to the bag, and if it gets a response, "You aren't carrying anything that will fit into a blue silk bag" it drops all the water reagents

if (You aren't carrying anything that will fit into a blue silk bag) then
drop all.reagent-water

2) If does get the first response then if proceeds with putting all water reagents into the blue silk bag.

else (put all.reagent-water waterreagents)

It looks like I am not proceeding to the second part of the trigger because it is dropping all my reagents

end -- if

<triggers>
<trigger
enabled="y"
group="(reagents)"
ignore_case="y"
keep_evaluating="y"
match="Your Vandemaar's Reagent Bag glows white as it accumulates possessions from the ether."
regexp="y"
send_to="10"
sequence="100"
>
<send>open itemg
get all itemg

if (You aren't carrying anything that will fit into a blue silk bag) then
drop all.reagent-water
else (put all.reagent-water waterreagents)
end -- if

if (You aren't carrying anything that will fit into a red silk bag) then
drop all.reagent-fire
else (put all.reagent-fire firereagents)
end -- if

if (You aren't carrying anything that will fit into a yellow silk bag) then
drop all.reagent-air&#9;
else (put all.reagent-air airreagents)
end

if (You aren't carrying anything that will fit into a black silk bag) then
drop all.reagent-earth
else (put all.reagent-earth earthreagents)
end -- if

if (You aren't carrying anything that will fit into a woven silver bag) then
drop all.gem
else (put all.gem gemreagents)
end -- if

if (You aren't carrying anything that will fit into a woven gold bag) then
drop all.reagent-ethereal
else (put all.reagent-ethereal ethrealreagent)
end -- if

close itemg
</send>
</trigger>
</triggers>
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #4 on Thu 26 Mar 2015 09:51 PM (UTC)
Message
The problem is you can't send that directly to the mud because the mud command parser has no idea what you're doing. Those invalid command messages you got were the mud failing to recognize if else or end as legitimate input and it processed the only command it recognized dropping your reagents.

You're going to need to either create separate triggers for each of the full bags (quick and simple but lots of triggers) or do some advanced scripting work to process the results of opening the first bag in one pass.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
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.


16,906 views.

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

Go to topic:           Search the forum


[Go to top] top

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