Trigger of the Day - Mob Command Example

  • Rumble
  • Rumble's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
More
8 years 7 months ago - 8 years 6 months ago #1932 by Rumble
Name: 'Mob Command Example',  VNum: [   62], RNum: [   62]
Trigger Intended Assignment: Mobiles
Trigger Type: Command , Numeric Arg: 100, Arg list: l
Commands:
* By Rumble of The Builder Academy    tbamud.com 9091
* does not work for level 32 and above.
* Make sure the command is look, check for any abbrev of orb
if %cmd.mudcommand% == look && orb /= %arg%
  %send% %actor% As you look at the orb a feeling of peace and serenity comes over you.
  %echoround% %actor% %actor.name% stares at the orb.
  return 0
else
  * If it doesn't match let the command continue.
  return 0
end
If this was helpful please vote or leave a review for TBA.

Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.
Last edit: 8 years 6 months ago by Rumble.

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago - 8 years 6 months ago #1933 by Fizban
Replied by Fizban on topic Trigger of the Day - Mob Command Example
* By Rumble of The Builder Academy    tbamud.com 9091
* does not work for level 32 and above.
* Make sure the command is look, check for any abbrev of orb
if %cmd.mudcommand% == look && %arg% /= orb

That's a personal pet peeve of mine.

The helpfiles are misleading as well.

Most people think that:
if %cmd.mudcommand% == look && %arg% /= orb

accounts for:

look o
look or
look orb

They're right, the problem is, it also accounts for:

look r
look rb
look b

To not make all substrings pass as true, and only those that are an actual abbreviation the following workaround is necessary:
set orb 'orb
if %cmd.mudcommand% == look && %orb.contains('%arg%)%
Last edit: 8 years 6 months ago by Rumble.

Please Log in or Create an account to join the conversation.

  • Rumble
  • Rumble's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
More
8 years 7 months ago #1935 by Rumble
Replied by Rumble on topic Trigger of the Day - Mob Command Example
Works fine as far as I can tell, mob 215 on TBA.

> l orb
As you look at the orb a feeling of peace and serenity comes over you.
> l rb
You do not see that here.
> l b
You do not see that here.


Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #1951 by Fizban
Replied by Fizban on topic Trigger of the Day - Mob Command Example

Works fine as far as I can tell, mob 215 on TBA.

> l orb
As you look at the orb a feeling of peace and serenity comes over you.
> l rb
You do not see that here.
> l b
You do not see that here.


I glanced at it it too quickly, it does what I mentioned, but backwards.
if %cmd.mudcommand% == look && %arg% /= orb

the %arg% should be the second argument being compared to have the results I originally mentioned.

As is it actually has this result:

> look o
You do not see that here.

> look or
You do not see that here.

> look orb
As you look at the orb a feeling of peace and serenity comes over you.

> look orbistrblah
As you look at the orb a feeling of peace and serenity comes over you.

Please Log in or Create an account to join the conversation.

  • Rumble
  • Rumble's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
More
8 years 7 months ago #1960 by Rumble
Replied by Rumble on topic Trigger of the Day - Mob Command Example
So I swapped the =/ variables to the correct order: orb /= %arg%

Still not ideal, but it does the abbrev properly now. But, it also matches any single letter.

> l orb
As you look at the orb a feeling of peace and serenity comes over you.
> l or
As you look at the orb a feeling of peace and serenity comes over you.
> l o
As you look at the orb a feeling of peace and serenity comes over you.
> l orbihetuso
You do not see that here.
> l blorb
You do not see that here.
> l rb
As you look at the orb a feeling of peace and serenity comes over you.
> l b
As you look at the orb a feeling of peace and serenity comes over you.
> l o
As you look at the orb a feeling of peace and serenity comes over you.


Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #1961 by Fizban
Replied by Fizban on topic Trigger of the Day - Mob Command Example
Yeah, the /= just runs a strstr check, it's why I usually use .contains, and use a unique character of some sort (typically a ' mark) to force the comparison to start at the beginning of the word.

The helpfile doesn't say so, but in reality:

if a /= %b%
if %b.contains(a)%

Those do exactly the same thing.

Please Log in or Create an account to join the conversation.

  • Rumble
  • Rumble's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
More
8 years 7 months ago #1963 by Rumble
Replied by Rumble on topic Trigger of the Day - Mob Command Example
I agree. But it makes it far too confusing for new builders. Could we add a better contains check or parsing of arg to do this properly?

Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.139 seconds