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
➜ how do I check multiple lines
how do I check multiple lines
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Wed 17 Aug 2011 10:08 PM (UTC) |
Message
| I want to display my score (character sheet)
I want to check to see if the Armor spell is on.
if not I want to automatically cast the Armor spell
here is how my character sheet looks
_____________________________________________
Warbit * (level: 20)
Your levels: Wa: 20 Th: 20 Mo: 17 Ba: 10 Dr: 9 Ne: 9 Cl: 8 Ma: 7
You are 23 years, 15 months, 14 days old.
You are a citizen of Valkyre.
You are a devout worshipper of Nia.
Your throat is starting to get dry.
You have a heart of blackest evil.
You are quite familiar with most of this area.
You have 514(514) hit, 27(89) mana and 255(255) movement points.
Your armor class is -5.4.
You have 33043 gold coins.
You have thirty drachma.
You have 5881020 unused experience points.
You have been playing for 22 days, 19 hours, 56 minutes.
Str: 18[18], Int: 9[9], Wis: 13[13], Dex: 18[18], Con: 16[16]
You are standing.
You are singing 'lion chorus'.
You are affected by the following spells:
Resist Cold
Armor
Bless
Water Breathing
Lion Chorus
____________________________________________________________
that's with the armor spell on. Though with Aegis or other spells Armor can be anywhere in the list.
I would like to see if I am affected by the Armor spell.
(see if it is on the list)
and if its not on the list I would like for my guy to automatically cast the armor spell.
_______________________________________________
How do i do that?
What would go in the trigger box?
What would go in the send box?
I am guessing because it with most likely be a script in send box.
that i will be using
the send to script selection, from drop down box.
thanks again !!!
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 17 Aug 2011 10:15 PM (UTC) |
Message
| |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Reply #2 on Wed 17 Aug 2011 10:17 PM (UTC) Amended on Thu 18 Aug 2011 12:00 AM (UTC) by Warbit
|
Message
| reading it now , but it seems like that might be what I am looking for thanks Nick!
<triggers>
<!-- trigger to match start of inventory -->
<trigger
enabled="y"
match="You are carrying:"
send_to="12"
sequence="100"
>
<send>
inventory_table = {}
EnableTrigger ("inventory_line", true)
EnableTrigger ("inventory_stopper", true)
</send>
</trigger>
<!-- trigger to match an inventory line -->
<trigger
match="*"
name="inventory_line"
send_to="12"
sequence="50"
>
<send>
table.insert (inventory_table, "%0") -- add inventory item to our table
</send>
</trigger>
<!-- trigger to match end of inventory -->
<trigger
match="(^<)|^$"
name="inventory_stopper"
regexp="y"
send_to="12"
sequence="40"
>
<send>
-- don't need to track inventories any more
EnableTrigger ("inventory_line", false)
EnableTrigger ("inventory_stopper", false)
-- in case no table yet
inventory_table = inventory_table or {}
table.sort (inventory_table)
print ("In your inventory is:")
for _, item in ipairs (inventory_table) do
print (item)
end -- for
</send>
</trigger>
</triggers>
ok What does this mean?
send_to="12"
sequence="100"
I am guessing sequence it the order of trigger firing
(but the order is reverse (highest number first.)
have no idea what send_to 12 is.
I see the send to box
and have learned here that
Send("cast 'armor'") will send my command to the mud world.
I will chance this
<triggers>
<!-- trigger to match start of inventory -->
<trigger
enabled="y"
match="You are carrying:"
send_to="12"
sequence="100"
>
<send>
inventory_table = {}
EnableTrigger ("inventory_line", true)
EnableTrigger ("inventory_stopper", true)
</send>
</trigger>
to this?
trigger box
You are affected by the following spells:
<triggers>
<!-- trigger to match start of inventory -->
<trigger
enabled="y"
match="You are affected by the following spells:"
send_to="12"
sequence="100"
>
<send>
inventory_table = {}
EnableTrigger ("inventory_line", true)
EnableTrigger ("inventory_stopper", true)
</send>
</trigger>
where inventory_line is do I put the word
Armor
for the name of the spell I want to check is there?
for inventory_stopper can i use my prompt?
<514/514hp 67/89ma 255/255mv>
but change it to
<*/*hp*/*ma*/*mv>
I am in the Edit Trigger Section
of the mushclient.
Where do I put send_to="12"
<trigger
enabled="y"
match="You are affected by the following spells:"
send_to="12"
sequence="100"
>
<send>
inventory_table = {}
EnableTrigger ("inventory_line", true)
EnableTrigger ("inventory_stopper", true)
</send>
</trigger>
all the above goes in the send section right?
in trigger box also goes
You are affected by the following spells:
If I am right I think I might have it.
Nope it only got me disconnected from mud.
my guess you can't use the prompt to stop trigger.
Here is what I put just in case someone has answer before i find it out.
Think I am going to have to use the wait command, I thought I read.
Trigger 1
You are affected by the following spells:
in send box
<trigger
enabled="y"
match="You are affected by the following spells:"
send_to="12"
sequence="100"
>
<send>
inventory_table = {}
EnableTrigger ("Armor", true)
EnableTrigger ("<*/*hp*/*ma*/*mv>", true)
</send>
</trigger>
send to box
Script
Sequence box
100
____________________________________________
trigger 2
Trigger box
Armor
send box
<trigger
match="*"
name="Armor"
send_to="12"
sequence="50"
>
<send>
table.insert (inventory_table, "%0") -- add inventory item to our table
</send>
</trigger>
Send to box
script
Sequence box
50
__________________________________________________
trigger 3
trigger box
<*/*hp*/*ma*/*mv>
Send box
<trigger
match="(^<)|^$"
name="<*/*hp*/*ma*/*mv>"
regexp="y"
send_to="12"
sequence="40"
>
<send>
-- don't need to track inventories any more
EnableTrigger ("Armor", false)
EnableTrigger ("<*/*hp*/*ma*/*mv>", false)
-- in case no table yet
inventory_table = inventory_table or {}
table.sort (inventory_table)
print ("In your inventory is:")
for _, item in ipairs (inventory_table) do
print (item)
end -- for
</send>
</trigger>
</triggers>
Send to box
Script
Sequence box
40 | Top |
|
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Reply #3 on Thu 18 Aug 2011 12:05 AM (UTC) |
Message
| Those wait instructions seem to involve a lot of stuff i do not understand.
So I will check back here today and read the replies.
Thanks again.
My bandwidth is capped the rest of this month so I would have to wait till the 23 to view the youtube video.
| Top |
|
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Reply #4 on Thu 18 Aug 2011 02:39 PM (UTC) |
Message
| My issue still not resolved.
Thanks in advance to any willing to help. | Top |
|
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Reply #5 on Thu 18 Aug 2011 03:47 PM (UTC) |
Message
| Changed code to this but it still isn't working.
Trigger
You are affected by the following spells:* /n * /n * /n * /n * /n * /n * /n * /n * /n * /n
Send
Armor = False
if %1 ="Armor" then
Armor = True
else
if %2 ="Armor" then
Armor = True
else
if %3 ="Armor" then
Armor = True
else
if %4 ="Armor" then
Armor = True
else
if %5 ="Armor" then
Armor = True
else
if %6 ="Armor" then
Armor = True
else
if %7 ="Armor" then
Armor = True
else
if %8 ="Armor" then
Armor = True
else
if %9 ="Armor" then
Armor = True
else
if %10 ="Armor" then
Armor = True
end--if
if Armor = False then
Send("cast 'Armor' ")
end--if
{/code]
| Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #6 on Thu 18 Aug 2011 03:58 PM (UTC) |
Message
| \n, not /n. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Reply #7 on Thu 18 Aug 2011 04:05 PM (UTC) Amended on Thu 18 Aug 2011 04:06 PM (UTC) by Warbit
|
Message
| |
Posted by
| Fiendish
USA (2,534 posts) Bio
Global Moderator |
Date
| Reply #8 on Thu 18 Aug 2011 04:59 PM (UTC) Amended on Thu 18 Aug 2011 05:19 PM (UTC) by Fiendish
|
Message
| Please don't double, triple, and quadruple space the lines n your posts. It's REALLY difficult to read what you write when the line spacing isn't logically coherent.
Warbit said:ok What does this mean?
send_to="12"
sequence="100"
I am guessing sequence it the order of trigger firing
(but the order is reverse (highest number first.)
The meanings of the "send-to" field are:
0: World
1: Command window
2: Output window
3: Status line
4: Notepad (new)
5: Notepad (append)
6: Log File
7: Notepad (replace)
8: Command queue
9: Send To Variable
10: Execute (re-parse as command)
11: Speedwalk (send text is speedwalk, queue it)
12: Script (send to script engine)
13: Immediate (send to world in front of speedwalk queue)
14: Script - after omit
And sequence is lower number first. 100 just gives you room to insert smaller numbers below it later.
Warbit said: where inventory_line is do I put the word
Armor
for the name of the spell I want to check is there?
Down in inventory_stopper, instead of
you want to check if the item == "Armor" and then do something depending on the answer
Warbit said: for inventory_stopper can i use my prompt?
<514/514hp 67/89ma 255/255mv>
but change it to
<*/*hp*/*ma*/*mv>
You can use whatever you want, as long as it makes sense.
Quote: all the above goes in the send section right?
FAQ entry 37 already tells you how to copy/paste the code into MUSHclient. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Reply #9 on Thu 18 Aug 2011 05:21 PM (UTC) |
Message
| thanks again appreciate it.
I will work on it, and get back to you with how it went. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #10 on Thu 18 Aug 2011 09:04 PM (UTC) Amended on Thu 18 Aug 2011 09:05 PM (UTC) by Nick Gammon
|
Message
|
Warbit said:
Changed code to this but it still isn't working.
Send
Armor = False
if %1 ="Armor" then
Armor = True
else
if %2 ="Armor" then
Armor = True
else
...
Also it is == for comparisons not = (but still read the FAQ item). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Reply #11 on Fri 19 Aug 2011 09:22 AM (UTC) |
Message
| Thanks Nick looking at it now. | Top |
|
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Reply #12 on Wed 21 Sep 2011 12:17 PM (UTC) Amended on Wed 21 Sep 2011 12:40 PM (UTC) by Warbit
|
Message
| Screen shows
Warbit ... (level: 20)
Your levels: Wa: 20 Th: 20 Mo: 20 Ba: 17 Dr: 11 Ne: 12 Cl: 8 Ma: 7
You are 28 years, 10 months, 17 days old.
You are a citizen of Valkyre.
You are a devout worshipper of Vom.
You are an example to us all.
You are quite familiar with most of this area.
You have 532(532) hit, 100(100) mana and 302(302) movement points.
Your armor class is -4.0.
You have 153971 gold coins.
You have seventy drachma.
You have eighty-six honor.
You have 11415869 unused experience points.
You have been playing for 38 days, 9 hours, 37 minutes.
Str: 18[18], Int: 9[9], Wis: 13[13], Dex: 18[18], Con: 16[16]
You are standing.
Your song can affect as many as two people.
You are affected by the following spells:
Resist Fire
Resist Cold
Water Breathing
You are imbued with the following spells:
call lightning (3 charges)
magic missile (5 charges)
demon bind (4 charges)
The You are imbued with the following spells: part is not guaranteed to be there it goes away.
My Trigger is
<triggers>
<trigger
enabled="y"
match="*You are affected by the following spells:*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n"
send_to="12"
sequence="100"
>
<send>if %1 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %2 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %3 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %4 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %5 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %6 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %7 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %8 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %9 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %10 == "Resist Fire" then
Send("Say Resist Fire")
end--if
if %11 == "Resist Fire" then
Send("Say Resist Fire")
end--if</send>
</trigger>
</triggers>
Already looked at help you gave other guy with his multi-line trigger.
Looked at http://mushclient.com/forum/?id=7794#37
Don't see why it is not seeing Resist Fire. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #13 on Thu 22 Sep 2011 03:08 AM (UTC) |
Message
| Because this:
if %2 == "Resist Fire" then
Send("Say Resist Fire")
end--if
Expands out to:
if Resist Fire == "Resist Fire" then
Send("Say Resist Fire")
end--if
That doesn't make syntactic sense.
It needs to be:
if "%2" == "Resist Fire" then
Send("Say Resist Fire")
end--if
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Warbit
USA (47 posts) Bio
|
Date
| Reply #14 on Thu 22 Sep 2011 10:51 AM (UTC) |
Message
| Thanks Nick, made the changes. Turned echo on , but still can't see me saying Resist fire. Here is the current trigger
<triggers>
<trigger
enabled="y"
group="Spellz"
match="*You are affected by the following spells:*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n"
send_to="12"
sequence="100"
>
<send>if "%1" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%2" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%3" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%4" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%5" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%6" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%7" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%8" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%9" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%10" == "Resist Fire" then
Send("Say Resist Fire")
end--if
if "%11" == "Resist Fire" then
Send("Say Resist Fire")
end--if</send>
</trigger>
</triggers>
There are no error messages it just does nothing visible. | 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.
58,637 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top