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
➜ caught in am endless loop
|
caught in am endless loop
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Dragonlord
(24 posts) Bio
|
| Date
| Fri 25 Mar 2016 11:04 PM (UTC) |
| Message
| PC_Equipments = "an eye of a Kraken|a ring of wizardry|the ring of the serpent|the Overlord\'s necklace of protection|holy symbol Ithrilis|a set of overlord armor|the leggings of an elder dragon|a pair of golden-spurred boots|the lieutenant\'s gauntlets|a pair of green dragonscale sleeves|a battered iron shield|Yourban\'s soul|a spectral aura|the belt of the master craftsman|a magical belt pouch|a bracelet set with white moonstones|a bracelet of the elements|an Eldmarian Slayer"
require "wait"
wait.make (function ()
for PC_Equipment in string.gmatch (PC_Equipments, "%a+") do
Send ("remove all.", PC_Equipment)
wait.time(1)
Send ("wear 'a pair of brass spectacles'")
wait.time(1)
Send ("wear ", PC_Equipment)
end -- forend -- for
end) -- function
For some reason after I added the wait function, I was caught in a endless loop, or it seemed endless. any idea on what i can do to fix it? The reason I need a wait function is because it will kick me out of the game and reconnect me. | | Top |
|
| Posted by
| Fiendish
USA (2,558 posts) Bio
Global Moderator |
| Date
| Reply #1 on Sat 26 Mar 2016 12:25 AM (UTC) Amended on Sat 26 Mar 2016 12:32 AM (UTC) by Fiendish
|
| Message
| First, this:
PC_Equipments = "an eye of a Kraken|a ring of wizardry|the ring of the serpent|the Overlord\'s necklace of protection|holy symbol Ithrilis|a set of overlord armor|the leggings of an elder dragon|a pair of golden-spurred boots|the lieutenant\'s gauntlets|a pair of green dragonscale sleeves|a battered iron shield|Yourban\'s soul|a spectral aura|the belt of the master craftsman|a magical belt pouch|a bracelet set with white moonstones|a bracelet of the elements|an Eldmarian Slayer"
...
for PC_Equipment in string.gmatch (PC_Equipments, "%a+") do
is terrible Lua. It looks like maybe you're trying to mimic a data format from zMUD without knowing how it translates into Lua yet?
Also, in a string wrapped in "", \' is an invalid escape sequence and is guaranteed to either be ignored or to do the wrong thing. If you want to send a slash, you need to have \ instead of just \, and if you don't, you don't need it at all. In my version below, I've removed them. Up to you.
Do this instead:
PC_Equipments = {
"an eye of a Kraken",
"a ring of wizardry",
"the ring of the serpent",
"the Overlord's necklace of protection",
"holy symbol Ithrilis",
"a set of overlord armor",
"the leggings of an elder dragon",
"a pair of golden-spurred boots",
"the lieutenant's gauntlets",
"a pair of green dragonscale sleeves",
"a battered iron shield",
"Yourban's soul",
"a spectral aura",
"the belt of the master craftsman",
"a magical belt pouch",
"a bracelet set with white moonstones",
"a bracelet of the elements",
"an Eldmarian Slayer"
}
require "wait"
wait.make (function ()
for index,item in ipairs(PC_Equipments) do
Send ("remove all.", item)
wait.time(1)
Send ("wear 'a pair of brass spectacles'")
wait.time(1)
Send ("wear ", item)
end -- for
end) -- function
Also you only use single quotes around the item for "wear 'a pair of brass spectacles'". Why not for the other stuff? |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Sat 26 Mar 2016 06:11 AM (UTC) |
| Message
| |
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sat 26 Mar 2016 06:12 AM (UTC) |
| Message
| @Dragonlord - please start using code tags for your triggers/aliases.
 |
To make your code more readable please use [code] tags as described here.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
17,482 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top