Welcome to the Builder Academy

Question Trigger of the Day - Advanced

More
18 Jun 2020 17:47 #8785 by Parnassus
I'm not understanding the problem. You didn't want to be able to to look south?

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

More
18 Jun 2020 18:32 #8787 by zi
Replied by zi on topic Trigger of the Day - Advanced
look without an argument returns WIN

it SHOULD return the room desc, etc.

now, when i type look in a direction, at an object, at a character, etc. i see that description. but look, without any argument, returns WIN

_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_

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

More
19 Jun 2020 15:20 #8789 by rhade
Replied by rhade on topic Trigger of the Day - Advanced
When %arg% is empty, then ' is still a substring of 'test, which is why your trigger is firing. Change your if condition to be:

if %cmd.mudcommand% == look && %arg% && 'test /= '%arg%

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

More
19 Jun 2020 15:32 #8790 by zi
Replied by zi on topic Trigger of the Day - Advanced
THIS works...

if %cmd.mudcommand% == look
switch %arg%
case compass
%echo% WIN!
break
default
return 0
halt
break
done
else
return 0
end



it allows a mortal to look at the object (magic compass) and get WIN, allows him to look without argument and just see the room, allows him to look at anything specific and see the description..


the IF with the %keyword.contains('%arg%)% still triggers the command (or mud command) without the argument... try this bad boy::

set compass 'compass
if %cmd.mudcommand% == look && %compass.contains('%arg%)%
%echo% WIN!
else
return 0
end


type look with your mortal and you'll get WIN! am I missing something in my if statement?

and no, i'm not using the /= %arg% logic, that stinks

_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_

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

More
20 Jun 2020 15:32 #8791 by Parnassus
Sorry, I hadn't realized that Rhade's message hadn't gone through.

But, yes, this is one that catches me every time! I love what I call "Fizban's Fix" especially since I've been in a room with a mob looking for /=king. If you tried talking in this room, the mob would talk about the king if you mentioned asking, talking, walking, killing or many other things.

However, as Rhade says, when you change "look {noarg}" to "look '{noarg}", you've now changed that noarg to an arg that matches your criteria since "look ' " is part of "look 'compass".

For more info on this matter:
Trigger of the Day - Mob Command Example
and /= .

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

More
05 Nov 2024 17:50 - 06 Nov 2024 00:59 #10433 by zi
Replied by zi on topic Trigger of the Day - Advanced
I wanted to circle back to this - here's an instance where I'd like to have responses to my BUY command trigger that cover three instances:
1 if the player types the correct argument (life or lives)
2 an incorrect argument (whatever)
3 an empty argument. 

This is what I could come up with - measuring the first word in the argument and if it's less than 1 (no text was inputted after the buy command) give that third option of "Okay, is there something you'd like to buy?" But after all of this argument logic talk I wanted to ask... is there a better (KISS) way?


Name: 'Life Saleswoman',  VNum: [  143], RNum: [  21]
Trigger Intended Assignment: Mobiles
Trigger Type: Command , Numeric Arg: 100, Arg list: buy
Commands:
*TRIGGER 143*
set cost-1000
set word %arg.car%
if %actor.is_pc%
set length %word.strlen%
  if lives == %arg% || life == %arg%
    if %actor.lives% >=30
      tell %actor.name% You already have plenty of lives. Go out there and make bad decisions!
    elseif %actor.gold% < 1000
      tell %actor.name% Sorry, but you just don't have the credits...
    else
      tell %actor.name% That will be 1,000 credits. Thank you!
      nop %actor.gold(%cost%)%
      nop %actor.lives(1)%
    end
  elseif %length% < 1
    tell %actor.name% Okay, but what would you like to buy? A life, perhaps?
  else
    tell %actor.name% You can't buy %arg% from me, only a life.
  end
end

_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Last edit: 06 Nov 2024 00:59 by zi. Reason: ...

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

Time to create page: 0.198 seconds