varexists is used to check remote variables that are written to a pfile. Global variables are fine if you don't care about losing them over reboot/copyover.
Code:
Name: 'Lieutenant Door Bribe - M23608', VNum: [23612], RNum: [ 2657]
Trigger Intended Assignment: Mobiles
Trigger Type: Bribe , Numeric Arg: 1, Arg list: None
Commands:
* By Welcor of The Builder Academy tbamud.com 9091
wait 1
* The price is 400 coins to pass. Player must 'give 400 coin leader.'
if %amount% < 400
say Did you really think I was that cheap, %actor.name%.
snarl
else
* Context saves the global with the players ID so multiple players can bribe.
context %actor.id%
* Set the variable to a value, 1 for YES.
set has_bribed_guard 1
* Global it! You can now 'stat leader' and see it listed.
global has_bribed_guard
whisper %actor.name% Enter when you're ready. I'll lock the door behind you.
unlock door
end
> tstat 23613
Name: 'Lieutenant Door Bribe 2 - M23608', VNum: [23613], RNum: [ 2658]
Trigger Intended Assignment: Mobiles
Trigger Type: Door , Numeric Arg: 100, Arg list: None
Commands:
* By Welcor of The Builder Academy tbamud.com 9091
* Allows more than one instance of this trigger to run.
context %actor.id%
* Checks a global variable to see if this mob has been bribed. TSTAT 23612.
if %has_bribed_guard%
* Let the player through, he's paid.
return 1
* Don't bother continuing the trig, just stop it.
halt
end
* If the player tries to pick the lock catch him!
if %cmd% == pick
* Stop them! Return 0 prevents the command from going through.
return 0
wait 1
say No way, you don't fool me, %actor.name%.
* If mob can see the player, kill him!
if %actor.canbeseen%
mkill %actor%
end
end