Welcome to the Builder Academy

Question Checking every time for gender in trigger

More
30 Dec 2013 05:05 #4595 by aredcloak19
Ok, my question is that I want to have a greeting by gender. For example, males would get sir from the male mob(vnum 20600) and females would get madam from the female mob(vnum 20601). So I was trying to test all the genders(available) and is there still a netural gender in the tbamud? Also I want to check both having the global variable and not having the variable to sex and level to get those messages.

Code:
if %actor.is_pc% wait 1 sec if %actor.varexists(muggle_greeting)% if %actor.level% == 0 && %actor.level% <= 30 if %self.vnum% == 20600 && %actor.sex% == male %echo% Welcome back to the Holmgeir home, sir %actor.name%. wait 1 sec end *ends male answer if %self.vnum% == 20601 && %actor.sex% == female %echo% Welcome back to the Holgmeir home, madam %actor.name%. end *ends female answer else %echo% Welcome back to the Holgmeir home, %actor.name%. else if %self.vnum% == 20600 && %actor.sex% == male %self.name% Welcome back to the Holmgeir home, sir %actor.name%. wait 1 sec end *ends male answer if %self.vnum% == 20601 && %actor.sex% == female %echo% Welcome back to the Holgmeir home, madam %actor.name%. end *ends female answer else %echo% Welcome back to the Holgmeir home, %actor.name%. end *ends actor level check set muggle_greeting 1 remote muggle_greeting %actor.id% end *checks if muggle greeting exists. end *checks if pc

My trigger a copy of Rumble's Socrates trigger(tstat 194). I'm editing it for my use so I can have personalized messages of the players that come into that room that it is attached to. Also getting a double message when I enter the room. Any help in this is greatly appreciated. Thanks in advance for looking at this.

aredcloak19

I'm the one that people say, "How did you break this and what did you do to break it."

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

More
30 Dec 2013 14:45 #4596 by thomas
indeed, there's a neutral gender, but it's reserved for mobs, iirc. You won't have to check for it in your trigger.

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

More
31 Dec 2013 07:16 #4600 by aredcloak19
Thanks Thomas. Also Parna, said that my trigger checks for gender every other time. Is this right because I believe it to be that every time someone enters the room it will run and check the gender of the player that has entered the room. Also I'm going to change the %echo%'s to %send% because I don't want mass messages going to players that have been in room for a long time.

aredcloak19

I'm the one that people say, "How did you break this and what did you do to break it."

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

More
31 Dec 2013 12:50 #4601 by Parnassus
The most important thing after writing a trigger is to analyze what your trigger is saying and compare it to what you want it to do.

I've tried to explain this to you but I'm having some problems explaining the concepts. Maybe it'll be a bit easier here, where I can be more visual.

Analysis:
if <A>
%echo% <A> = YES
else
%echo% <A> = NO
* This is 100%, right? Either <A> is YES or ELSE <A> is NO.
else
%echo% <A> = NOT NO

Okay, so now, let's translate this:
if: level is mort, check for gender and greet.
else: level is not mort (imm), greet.
else: level is NOT imm (but not mort or it would have been caught in the if), check for gender and greet.
else: level is NOT NOT imm, greet.
end *ends actor level check

Then we come to this part:
set muggle_greeting 1
remote muggle_greeting %actor.id%
end *checks if muggle greeting exists.

Analysis:
if muggle_greeting do the trigger
set it
remote it
and then end the check.

Translation:
If it exists, set it. If it doesn't exist, end the trigger.

I'm sorry if this doesn't make sense. I can see the problem but I can't really explain it.

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

More
04 Jan 2014 02:08 - 04 Jan 2014 03:29 #4621 by krell

aredcloak19 wrote:

Code:
if %actor.is_pc% wait 1 sec if %actor.varexists(muggle_greeting)% if %actor.level% == 0 && %actor.level% <= 30 if %self.vnum% == 20600 && %actor.sex% == male %echo% Welcome back to the Holmgeir home, sir %actor.name%. wait 1 sec end *ends male answer if %self.vnum% == 20601 && %actor.sex% == female %echo% Welcome back to the Holgmeir home, madam %actor.name%. end *ends female answer else %echo% Welcome back to the Holgmeir home, %actor.name%. else if %self.vnum% == 20600 && %actor.sex% == male %self.name% Welcome back to the Holmgeir home, sir %actor.name%. wait 1 sec end *ends male answer if %self.vnum% == 20601 && %actor.sex% == female %echo% Welcome back to the Holgmeir home, madam %actor.name%. end *ends female answer else %echo% Welcome back to the Holgmeir home, %actor.name%. end *ends actor level check set muggle_greeting 1 remote muggle_greeting %actor.id% end *checks if muggle greeting exists. end *checks if pc


"else" is what happens if the preceeding conditions or conditions fail in an if statement. It's equivalent to "default" in a switch statemement.

ie:
Code:
if (a == 1) then do first option elseif (a == 2) then do second option elseif (a == 3) then do third option else printf("alert, alert! Bad option!") end

Having [strike]two[/strike]three elses for the same if might be confusing your trigger.
Last edit: 04 Jan 2014 03:29 by krell.

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

More
07 Apr 2014 04:44 #4823 by Fizban
Very old post, response may no longer be helpful, but figured it might potentially help someone other than the OP even if they never see it:
Code:
if %actor.level% == 0 && %actor.level% <= 30

is certainly not doing whatever you are intending it to do, it will only be false if their level is 0, and less than 30. 0 is always less than 30, the second check is redundant. I also doubt you intended it to only trigger for people that were level 0, I am guessing you intended that to be > 0.

Below is a script that will do what I "think" you were trying to achieve.
Code:
if %actor.is_pc% wait 1 sec if %actor.varexists(muggle_greeting)% if %actor.level% > 0 && %actor.level% <= 30 if %self.vnum% == 20600 && %actor.sex% == male %echo% Welcome back to the Holmgeir home, sir %actor.name%. wait 1 sec elseif %self.vnum% == 20601 && %actor.sex% == female %echo% Welcome back to the Holgmeir home, madam %actor.name%. else %echo% Welcome back to the Holgmeir home, %actor.name%. end end set muggle_greeting 1 remote muggle_greeting %actor.id% end end

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

Time to create page: 0.301 seconds