Welcome to the Builder Academy

Question Trigger of the Day - Mob Command Example

More
16 Apr 2013 18:23 - 02 Jun 2013 21:02 #1932 by Rumble
Code:
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
rumble@tbamud.com
Last edit: 02 Jun 2013 21:02 by Rumble.

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

More
16 Apr 2013 20:54 - 02 Jun 2013 21:03 #1933 by Fizban
Code:
* 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:
Code:
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:
Code:
set orb 'orb if %cmd.mudcommand% == look && %orb.contains('%arg%)%
Last edit: 02 Jun 2013 21:03 by Rumble.

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

More
17 Apr 2013 00:45 #1935 by Rumble
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
rumble@tbamud.com

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

More
18 Apr 2013 13:09 #1951 by Fizban

Rumble wrote: 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.
Code:
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.

More
19 Apr 2013 00:46 #1960 by Rumble
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
rumble@tbamud.com

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

More
19 Apr 2013 05:00 #1961 by Fizban
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.

Time to create page: 0.229 seconds