Welcome to the Builder Academy

Question Question about context %actor.id%

More
04 Aug 2012 20:39 - 04 Aug 2012 20:40 #531 by Papaya Pete
So I'm trying to use triggers to form a one-time quest, and it worked the first time I ran it. After I shut the mud down and started it up later, and now the trigger isn't work. Not sure why. Here it is.
Code:
1) Name : Mayor's Greeting 2) Intended for : Mobiles 3) Trigger types: Act 4) Numeric Arg : 0 5) Arguments : greets you 6) Commands: context %actor.id% if %spoken_with_mayor% != 1 emote looks up from his work at %actor.name%. wait 8 say How goes the negotiations? Be careful out there. wait 8 emote looks back down at his work. else emote looks up at %actor.name%, and leans back in his chair, smiling genuinely. wait 16 say Ah, the great %actor.name%! Sir Rogan's told me how you've sent some of those goblins running. Excellent work, good work! wait 30 emote rises up from his chair, starting to slowly pace back and forth by the window. wait 30 say But... it doesn't really solve the problem. Goblins still try to cause as much havoc as they can. And what's even worse than that? They seem to be led by hobgoblins, if one of my sources is right. wait 50 say We need an end to this little war. Let's face it; we don't have much in the way of manpower. We have you and a few others who are just holding the threat back. We need a permanent solution... and as much as I hate to say this, we need to negotiate with this band of brigands. wait 50 saY Everyone else might think I'm a little crazy, but there HAS to be a reason for them attacking Wendelton, right? See if you can speak to the leader and find out what they want. If it's reasonable, then make the deal. If not... well, we'll figure out what to do from there. wait 50 emote sits back down at his desk, the butler managing to keep a straight face the entire time... except for his eyes widening a little in surprise at the plan. wait 30 emote searches for a blank piece of paper, and writes something down on it quickly before handing it to %actor.name%. wait 30 say Take this to Martin, the butcher here in town. You'll need something to offer as a token of your goodwill. Be careful, %actor.name%... %load% obj 1055 %actor% inv say And don't get yourself killed. emote returns to his work, breathing out a stressed sigh. set spoken_with_mayor 1 remote spoken_with_mayor %actor.id% end

Is there any reason why this wouldn't work?
Last edit: 04 Aug 2012 20:40 by Papaya Pete.

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

More
04 Aug 2012 21:29 #532 by Rumble
You don't need to use context if you remote the variable. Remote saves the variable to the player file. You'd use context if you were going to use a global variable that is saved to the mob/obj/room.

But that wouldn't cause the trigger not to work. It looks fine. Is it not firing at all? Whenever you have problems with a trig add an %echo% on the first line that regurgitates all variables you are trying to use to make sure it is firing. Double check nohassle, test it with a mort.

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com

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

More
04 Aug 2012 21:32 #533 by Vatiken
Code:
context %actor.id% if %spoken_with_mayor% != 1 emote looks up from his work at %actor.name%.
Should be:
Code:
if !%actor.varexists(spoken_with_mayor)% emote looks up from his work at %actor.name%.

You are currently getting global variables and remote variables mixed up. If you would like to attach a variable to a mob/obj/room that is used for only 1 character you can go about using globals:
Code:
context %actor.id% if %variable% do stuff else set variable 1 global variable end
If you want to attach a variable to the PC, so that it maybe used by other triggers both during the current boot of your MUD, and following reboots (variable is saved to pfile), then you want remote triggers.
Code:
if %actor.varexists(variable)% if %actor.variable% == 1 do stuff elseif %actor.variable% == 2 do stuff else do other stuff end rdelete variable %actor.id% else set variable 1 remote variable %actor.id% end
Globals are useful for things like repeatable quests, treasure chests, and other INSTANCED tasks. While remote variables are good for things like on-going story quests, relationships or other variables that will remain with the character for potentially his/her lifetime.

tbaMUD developer/programmer

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

More
05 Aug 2012 06:42 #536 by Papaya Pete
Oh I see, I didn't think of trying to use %actor.varexists% for remote variables. Thanks for the help, I would've been using context %actor.id% for everything! :P

But that wouldn't cause the trigger not to work. It looks fine. Is it not firing at all? Whenever you have problems with a trig add an %echo% on the first line that regurgitates all variables you are trying to use to make sure it is firing. Double check nohassle, test it with a mort.


I learned early on the need to test things out with a mort. I was getting confused by some things not working when they should have. And that's a good way to troubleshoot, I'm definitely going to try and put that into practice. :)

Thanks again for the help!

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

Time to create page: 0.178 seconds