[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]  Triggers With Multiple Random Characters...to triggers calling upon aliases...
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Triggers With Multiple Random Characters...to triggers calling upon aliases...

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


Pages: 1 2  

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Thu 29 Sep 2016 02:06 PM (UTC)
Message
Ok here is the question, I dont have it set up, nor do I know where to start on this...
But here is goes.

Here is the start:
I type: getq (which is get quest)
and I get this:
The message goes, 'You are to find and capture eharS Baer.'

Now keep in mind the "eharS Baer" are randomized.
In this Example it is Share Bear, but it could be randomly chosen mob in the game.

Now what I want it to do, is unscramble the words, and then goto the mob in question and then start the attack then capture it, easy to do via a travel command
astral share
k share
cap share

Is there anyway to do this at all?

~~~~

Now as for the triggers calling upon aliases...
IS there anyways a trigger, or a timer, or even another alias calling upon the aliases in MC that I have already made?
I couldnt figure out if there was a way to do this.
Personally I would like to have a trigger, call upon a MC alias and run it. Is this even possible?
I have alot of aliases, and transferring the alias to triggers is a pita would like to just call it from a trigger instead.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 29 Sep 2016 10:07 PM (UTC)
Message
Quote:

Personally I would like to have a trigger, call upon a MC alias and run it. Is this even possible?
I have alot of aliases, and transferring the alias to triggers is a pita would like to just call it from a trigger instead.


Yes, this is easy. In the trigger you can "send to execute" which will execute (re-evaluate) whatever you are sending as if you had typed it. Thus, aliases are called.

Or if you have a script you can "Execute" an alias, eg.


Execute ("foo")  // call alias foo if it exists otherwise send "foo" to the MUD


Template:function=Execute Execute

The documentation for the Execute script function is available online. It is also in the MUSHclient help file.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #2 on Thu 29 Sep 2016 10:56 PM (UTC)
Message
Ahh.... Ok... that makes sense...Thank you Nick... I didnt figured you wouldn't even be answering questions anymore, I know it is your program and all, but I just wouldn't have expected it at all.
I take your words as gospel when it comes to you your own program vs other people if they would have answered... Heh.

I guess the other part of the question section... I guess is impossible? I know I can get all the mob names, most of them are repeating, so getting a list isnt hard...if I need a list then I can get one, just how would I implement it all... that is the real question.

Again Thank you so much, Been using MC since it was v1 ish. SO in other words forever.
Just got back into Mudding, so alot of things I have forgotten, but always comming back to your Client versus any other, and always will.

Again Thank you for putting out such an awesome client.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 30 Sep 2016 01:43 AM (UTC)
Message
Quote:

Now what I want it to do, is unscramble the words, and then goto the mob in question and then start the attack then capture it, easy to do via a travel command


No doubt it is possible, but some of my friends run MUDs, and this sounds like one of theirs. :)

They won't be too pleased if I give out scripts to make a bot.

No doubt you can find an anagram unscrambler algorithm, especially if you know the target words, and if you know the target length.

As for automatically killing it - well some MUDs have policies against bots - be careful you don't get banned. ;)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #4 on Fri 30 Sep 2016 11:41 AM (UTC)
Message
Oh I whole heartly understand...
This one...
-==================================[ BOT ]==================================-
Multiplaying,
playersharing,
and Botting are Perfectly OK!

Combat can only be 1vs1 meaning 1 player alt per fight..


-==============================================================================-

LOL
AS odd as it is... that is the most hilarious thing. SO Iam going to use it to my advantage while it is still legal, and It dont change.

Dont ask me why they did it but they did, but oddly, there aint people going around being idiots, i think it is hard enough to get powerful on there anyway, pita really. So they expect it.

But yes, I do understand.

Yeh, Oddly It is pretty easy to get the names and the lengths. Only one which I wont so are the multiple colors, since they based it to be even more difficult with colored names on some of them, and the quest sees those colors as well as the quest mob too. Which is fine, I doubt the trigger will see color and differentiate but that is ok I can still do them manually from time to time.

But thank you Nick again for your wisdom, keep up the good work!
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Fri 30 Sep 2016 10:16 PM (UTC)
Message
Well, if this MUD allows it. Here is a way I thought up to detect anagrams from a list of known words.

Basically A is an anagram of B is it has the same letters with the same frequencies (eg. 2 x A, 3 x E, 2 x T). So we can take our known words and turn them into a table, like this:

"00020000100000000000000000"="Did"
"01001010000000300110010000"="borogoves"
"00000000100001000000000000"="in"
"11001000000000000000001000"="wabe"
"00001001000000000001000000"="the"
"10000000000200000000000000"="All"
"00000000100020000010000010"="mimsy"
"10010000000001000000000000"="And"
"00002000000000000100001000"="were"
"00001000000000100011010000"="toves"
"00001010000000000100000010"="gyre"
"01000010200200000100000000"="brillig"
"00001000000020100000000000"="mome"
"10000001000000000111000000"="raths"
"10000000000000000011001000"="Twas"
"00000001100100000011000010"="slithy"
"11001010000000100101100000"="outgrabe"
"01001010100110000000000000"="gimble"


The word "All" for example has 1 x A and 2 x L ("10000000000200000000000000").

So we can save them in a table, and look up a target word to see if it has the same pattern (like "LAL" would have).


-- return a string with a count for each occurrence of the letters A-Z
function calculateFrequencies (str)
  -- no letters have appeared yet
  local t = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
  for i = 1, #str do
    local c = str:sub (i, i):upper ()  -- get each character (in upper case)
    if c >= "A" and c <= "Z" then
      local val = string.byte (c) - string.byte ("A") + 1
      t [val] = t [val] + 1  -- one more occurence of this one
    end -- if alphabetic
  end -- for
  for k, v in ipairs (t) do
    if v > 9 then  -- if more than 9 of one letter put an "x" there
      t [k] = "x"
    else
      t [k] = tostring (v)  -- turn into a string
    end -- if
  end -- for each one
  return table.concat (t)
end -- calculateFrequencies

-- words we know
knownWords = {
"Twas",   "brillig",  "and",   "the",   "slithy",
"toves",  "Did",      "gyre",  "and",   "gimble",
"in",     "the",      "wabe",  "All",   "mimsy",
"were",   "the",      "borogoves",      "And",
"the",    "mome",     "raths",          "outgrabe",
    }

-- converted into frequencies
convertedWords = { }

for k, v in ipairs (knownWords) do
   convertedWords [calculateFrequencies (v)] = v
end -- for each word

-- words to test against
testWords = {
  "food", "candy", "nick", "lua",  -- not known
  "swat", "votes", "dna",  "mmoe"  -- known
  }

for k, v in ipairs (testWords) do
  print (v)
  local original = convertedWords [calculateFrequencies (v)]
  if original then
    print ("  -->", original)
  else
    print ("  not known.")
  end -- if
end -- for


Output from test:


food
  not known.
candy
  not known.
nick
  not known.
lua
  not known.
swat
  -->	Twas
votes
  -->	toves
dna
  -->	And
mmoe
  -->	mome

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Fri 30 Sep 2016 10:28 PM (UTC)

Amended on Fri 30 Sep 2016 10:29 PM (UTC) by Nick Gammon

Message
Of course, some words will have multiple anagrams, like "god" and "dog", or "and" and "dna" so you won't necessarily get the right result.

You could conceivably store a table of words per item rather than a single word. For example:


convertedWords = {
  ["10010000000001000000000000"] = { "And", "DNA" },
  }


However I'll leave that as an exercise. :)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #7 on Fri 30 Sep 2016 10:29 PM (UTC)
Message
So the randomization wouldnt matter, for this place, it actually every time i would type getq, it will randomize the word(so much that the word or words itself appear)... All it does is look at it once then compares it to the list and checks it?
From what I read in what you did, that is what it seems like anyways... It wouldnt matter how it was spelled as long as the right letters are in there ie: lal for all, not La or Alll or Alal... etc....been a while since I even though about doing a comparing like this, a long long time.

SO what I am understanding is that the words in here:
-- words we know
knownWords = {
"Twas", "brillig", "and", "the", "slithy",
"toves", "Did", "gyre", "and", "gimble",
"in", "the", "wabe", "All", "mimsy",
"were", "the", "borogoves", "And",
"the", "mome", "raths", "outgrabe",
}

Is the list that it compares it too. Iam guessing that i would have to add the new word to the list every time I need to update it. Cause every time I would type getq,
It can change lets say... lal, to lla or even all for that matter. Or keep the lal to lal or lal to lla and be a pita when i need 'all' for example.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Fri 30 Sep 2016 11:19 PM (UTC)
Message
CyrusMonroe said:

I know I can get all the mob names, most of them are repeating, so getting a list isnt hard...if I need a list then I can get one, ...


No, you don't need to change the list. "knownWords" is just your list of mob names. The whole idea is that it will detect a name scrambled, because it keeps track of the count of each letter. Take an example from your original post:

Quote:

The message goes, 'You are to find and capture eharS Baer.'


OK, so we convert those two words:


print (calculateFrequencies "eharS")  --> 10001001000000000110000000
print (calculateFrequencies "Baer")   --> 11001000000000000100000000


Now we try the unscrambled words:


print (calculateFrequencies "Share")  --> 10001001000000000110000000
print (calculateFrequencies "Bear")   --> 11001000000000000100000000


The letter frequencies are the same, so they are the same words (or possibly the same, bearing in mind what I said about "dog" and "god").

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Fri 30 Sep 2016 11:27 PM (UTC)

Amended on Fri 30 Sep 2016 11:41 PM (UTC) by Nick Gammon

Message
Your trigger could look like this:


<triggers>
  <trigger
   enabled="y"
   match="You are to find and capture *."
   send_to="12"
   sequence="100"
  >
  <send>

-- return a string with a count for each occurrence of the letters A-Z
function calculateFrequencies (str)
  -- no letters have appeared yet
  local t = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
  for i = 1, #str do
    local c = str:sub (i, i):upper ()  -- get each character (in upper case)
    if c &gt;= "A" and c &lt;= "Z" then
      local val = string.byte (c) - string.byte ("A") + 1
      t [val] = t [val] + 1  -- one more occurence of this one
    end -- if alphabetic
  end -- for
  for k, v in ipairs (t) do
    if v &gt; 9 then  -- if more than 9 of one letter put an "x" there
      t [k] = "x"
    else
      t [k] = tostring (v)  -- turn into a string
    end -- if
  end -- for each one
  return table.concat (t)
end -- calculateFrequencies

-- mobs we know
knownWords = {
"Share", "Bear",
    }

-- converted into frequencies
convertedWords = { }

for k, v in ipairs (knownWords) do
   convertedWords [calculateFrequencies (v)] = v
end -- for each word

wantedMob = ""

for w in string.gmatch ("%1", "%%a+") do
  local original = convertedWords [calculateFrequencies (w)]
  if original then
    wantedMob = wantedMob .. original .. " "
  else
    wantedMob = wantedMob .. w .. " "
  end -- if
end -- for

print ("You are to search for", wantedMob)

</send>
  </trigger>
</triggers>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Testing:


MUD sends: You are to find and capture eharS Baer.
Trigger outputs: You are to search for Share Bear 


You just need to add the other known mob names to the "mobs we know" table.

It would be more efficient to put everything into a script file, rather than recalculating all the mob names every time the trigger is called.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #10 on Sat 01 Oct 2016 11:35 AM (UTC)
Message
Oh ok... Wow I totally misread that part of the code.
*bonks self* *rolls eyes*
I read it as something different lol...Go figure. I guess working on no sleep, and no coffee will do that to a person.

My Apologies, it was my fault. I get it now.
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #11 on Tue 04 Oct 2016 12:21 AM (UTC)
Message
Ok... it works flawlessly...
Now that Iam completing the dang quests, everyone wants what I did... I dont plan on giving it to them...But Iam willing to make exceptions on how they use it with me.

Personally... I wouldnt mind it if someone sent me a tell, or a reply, doesnt matter....Got both of the 'tells'
* replies to you '*'.
Or
* tells you '*'.

Now either or will be a specific trigger...of
* replies to you 'Who is *?'.
or
* tells you 'Who is *?'.

And gives the scrambled name.

Now All i will do is send a reply with:
reply The one whom you seek, far and wide is *.

Now I figured the:
"for w in string.gmatch ("%1", "%%a+") do"
would be
"for w in string.gmatch ("%2", "%%a+") do"
Changed cause of the 2nd * wildcard. Though I might be kinda off, as I am not thinking stright long day at work...But I fig that was accurate.

But the 2nd part, Which i cant seem to find in the scripting, for this client, is the send to world. aspect of sending a reply.
Normally in my world It would be the part of:
print ("You are to search for", wantedMob)
changed to
sendtoWORLD (Reply "The one whom you seek, far and wide is ", wantedMob)

But oddly that didnt work, and either i missed it in the help files you have meaning iam totally friggin blind this evening... or It really isnt there, and Iam not going nuts.
Or again maybe I am misunderstanding what I am seeing again, and I am just really tired and gonzo.

Again thank you for your help Nick... this is appreciated. People are hating me cause I wont give it up....funnt thing is most if not all have zmud, or this new one called cmud which Idk if it will even translate over. So. It prob wouldnt help them anyways.
I will NEVER goto friggin anything else... Heck to the no!
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Tue 04 Oct 2016 04:00 AM (UTC)
Message
Quote:

sendtoWORLD (Reply "The one whom you seek, far and wide is ", wantedMob)


You want Send.


Send ('Reply The one whom you seek, far and wide is ' .. wantedMob)


I'm not sure if the quotes are supposed to be there (sent to the MUD) or if that was just you trying to make it work.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #13 on Tue 04 Oct 2016 12:14 PM (UTC)
Message
heh...
Well least I had it somewhat right. It was just send instead of sendtoWORLD, go figure.

Yes, I was trying to, didnt know if that would of worked but since it wasent, and funny it wouldnt anyways cause of the send itself i wouldnt have known either way, so thank you.

Also i couldnt find the page with the commands like that maybe I over looked it or something, just so I dont have to ask these dumb questions from you guys here. So I can actually do the work, and research, and know that I completed it myself. I dont want to have to keep bothering you.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #14 on Tue 04 Oct 2016 07:53 PM (UTC)
Message
They are in the help file, and also here:

http://www.gammon.com.au/scripts/doc.php

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


4,739 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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]