Welcome to the Builder Academy

Question /=

More
25 May 2014 00:06 #4912 by Parnassus
/= was created by Parnassus
I've always had some problems with what Fizban says here:
www.tbamud.com/forum/2-general/1674-trig...-mob-command-example

Fizban wrote: 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%)%


I totally agree with him, I just have problems implementing it. It seems easy enough but it takes me a lot of poking and prodding to make it work. And even after all that poking and prodding, I never seem to understand how I actually made it work anyway.

But now things are getting worse for me. I'm thinking of changing my trigger from ifs to switches. Is there a way of, okay, just thinking about this makes me so dizzy I can't describe it! But here's an example:
Code:
switch %arg% case orb do_whatever break default do_whatever_else break done

Is there a way to make that "%orb.contains('%arg%)%" in a switch situation? Yes, I realize that I could do it like so:
Code:
case orb case o case or do_whatever break
but that's just silly, isn't it? And it really only works because orb is such a short word. So what I guess I'm looking for is (if possible), the syntax to compare an abbreviation to the required word.

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

More
26 May 2014 20:07 #4913 by thomas
Replied by thomas on topic /=
Switches are for simple "is it x?, is it y? is it z?" situations.

if-elseif-else-blocks are for any other kind of situation. Including "contains".

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

More
04 Jun 2014 02:33 #4916 by Parnassus
Replied by Parnassus on topic /=
I think it needs to be done in two parts:
Code:
set orb 'orb if %orb.contains('%arg%)% set term orb switch %term% case orb do_whatever break default do_whatever_else break done

However, there's probably not a really good reason to do this. On the upside, while I was ripping my trigger apart to see if this would make it work better, I found some of the weaknesses that were making my trigger not work the way I wanted it. So I guess the thing is, if your trigger isn't working, try changing the format to see if anything pops out. :)

In fact, it worked so well that I think Valen Park is almost ready to be asking for testers!

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

Time to create page: 0.188 seconds