Welcome to the Builder Academy

Question Trigger of the Day - Look card

More
02 Oct 2013 02:49 #4370 by Parnassus
Background to this is, you look at the tarot card to see the meaning. If the card is reversed, the meaning changes. The trigger verifies if the card is rightsideup or upsidedown and gives the meaning of the card. I've expanded it a bit to use LOOK CARD or EXAMINE CARD.
Code:
Name: 'Look Card', VNum: [21102], RNum: [ 2582] Trigger Intended Assignment: Rooms Trigger Type: Command , Numeric Arg: 100, Arg list: * Commands: * Look Trigger Written by Fizban - June 06 2013 * This trigger changes the meaning of the card for reverse. * If there is no argument, just look. if !%arg% return 0 halt else * The ~ anchors the comparison to the front of the word. * rd /= card but ~rd is not a part of ~card while ~c is. set arg ~%arg% if ~card /= %arg% if %cmd.mudcommand% == look || %cmd.mudcommand% == examine * Check for the reverser. If it is in the room, give * one meaning. If it is not, give the other. eval rev %%findobj.%self.vnum%(21199)%% if %rev% < 1 %force% %actor% look card else %force% %actor% look reverse end end * to allow laughing or other l commands else return 0 end end

This uses the look trigger that Fizban wrote for me and has tried to use his argument anchor. The anchor works in that LOOK ARD and LOOK RD don't fire. LOOK C will always default to LOOK CARD even if you want to LOOK CANDLE but LOOK CAN works for that.

However, I think I've gotten something wrong because it forces look to become look ~ and considers it part of look ~card. This forces a return 0 in two places. How do I fix this, please? I could actually switch to full name only (look card) but that's not as much fun :).

Please point out any errors or inefficiencies.

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

More
02 Oct 2013 13:59 #4371 by rudeboyrave
eval rev %%findobj.%self.vnum%(21199)%%

in my experience, you dont ever double up the %'s


try
eval rev %findobj.self.vnum(21199)%

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.

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

More
02 Oct 2013 15:08 #4372 by Parnassus
A copy and paste of that line gives me the error:
[ findobj.vnum(ovnum) - illegal syntax ]

I think the double% is called double parsing. Here's Fizban's info on it:

Fizban wrote: Variables inside of variables only require double parsing when they aren't inside a subfield.

ie.

%%actor.inventory%random.3%%% < Tis requires double parsing

%actor.inventory(%random.3%)% < This does not

www.tbamud.com/forum/3-building/1731-tri...disappearing-eq#2175

So, I then tried placing brackets like so:
eval rev %findobj.(%self.vnum%)(21199)%
which didn't work. I was so disappointed but Rave tells me that it would in cases other than things like findobj that are already using ().

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

More
02 Oct 2013 15:20 #4373 by rudeboyrave
oi! you're the man :)

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.

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

Time to create page: 0.179 seconds