1
This forum is very active and we are here to help.
Click here to get back to the main website: http://4dimensions.org
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
if %obj.vnum% == 12345
* do stuff
elseif %obj.vnum% == 12346
* do more stuff
elseif %obj.vnum% = 22222
wait 1
drop %object%
wait 1 s
widee %actor%
emote exclaims, 'Oh, my God! Are you mad?
%echo% Do you have ANY idea what consequences this might lead to?'
wait 1 s
emote says, 'This is a total disaster, you moron!
%echo% He was not a man that wouldn't make some precautions either...
eval am (%actor.level%*(2000+%random.200%)))
nop %actor.exp(-50000)%
mkill %actor%
endif
Name: 'Kill Mob Function', VNum: [ 7958], RNum: [ 2982]
Trigger Intended Assignment: Mobiles
Trigger Type: FUNCTION , Numeric Arg: 100, Arg list: None
Commands:
wait 1
drop %object%
wait 1 s
widee %actor.name%
emote exclaims, 'Oh, my God! Are you mad?
%echo% Do you have ANY idea what consequences this might lead to?'
wait 1 s
emote says, 'This is a total disaster, you moron!
%echo% He was not a man that wouldn't make some precautions either...
eval am (%actor.level%*(2000+%random.200%))
nop %actor.exp(-50000)%
mkill %actor%
if %obj.vnum% == 12345
* do stuff
elseif %obj.vnum% == 12346
* do more stuff
elseif %obj.vnum% = 22222
function 7958
endif
Name: 'story', VNum: [ 2350], RNum: [ 706]
Trigger Intended Assignment: Mobiles
Trigger Type: Speech , Numeric Arg: 1, Arg list: story stories
Commands:
if %actor.is_pc%
wait 5s
%send% %actor% The mob tells a story...
* ...
* ...
* some time later
function 2356
endif
Name: 'Story Conclusion', VNum: [ 2356], RNum: [ 712]
Trigger Intended Assignment: Mobiles
Trigger Type: FUNCTION , Numeric Arg: 0, Arg list:
Commands:
emote takes a deep breath. Will he finally finish?
wait 10s
%send% %actor% blah blah blah
*...
*...
* debugger is the imm, player is the player
* pretend the quest variable is questcard200_buck
* Get the player's flag
set questcard200_buck %player.questcard200_buck%
if %questcard200_buck% == 0
%send% %debugger% %player.name% is not on this quest!
%send% %debugger% {cx
%send% %debugger% %player.name% must wait till midnight to start this quest.
elseif %questcard200_buck% == 1
%send% %debugger% %player.name% has waited till midnight.
%send% %debugger% {cx
%send% %debugger% %player.name% must type {cceavesdrop{cx to listen to Buck and Jubei.
elseif %questcard200_buck% == 2
%send% %debugger% %player.name% has eavesdropped on Buck and Jubei.
%send% %debugger% {cx
%send% %debugger% %player.name% must say {cchash table{cx to proceed.
%send% %debugger% If %player.name% says {ccsplay tree{cx, the flags will be reset and %player.heshe% must start again.
elseif %questcard200_buck% == 3
%send% %debugger% %player.name% has said {cchash table{cx to Buck.
%send% %debugger% {cx
%send% %debugger% %player.name% must say {ccyes{cx to move on.
elseif %questcard200_buck% == 4
%send% %debugger% %player.name% has been asked by Buck to get a key.
%send% %debugger% {cx
%send% %debugger% %player.name% must go to A Dark Mine (14024), and kill the bat there to get the key. Returning the key to Buck completes the quest.
endif
Lionheart has eavesdropped on Pix and Jubei.
Lionheart must say hash table to proceed.
If Lionheart says splay tree, the flags will be reset and he must start again.
Lionheart has been asked by Buck to get a key.
Lionheart must go to A Dark Mine (14024), and kill the bat there to get the key. Returning the key to Buck completes the quest.
* debugger is the imm, player is the player
* pretend the quest variable is questcard200_buck
* Get the player's flag
set questcard200_buck %player.questcard200_buck%
if %questcard200_buck% == 0
%send% %debugger% %player.name% is not on this quest!
%send% %debugger% {cx
%send% %debugger% %player.name% must eavesdrop on Buck at midnight.
elseif %questcard200_buck% == 2
%send% %debugger% %player.name% must say {cchash table.
elseif %questcard200_buck% == 4
%send% %debugger% %player.name% must get the key for Buck to complete this quest.
endif
* Trigger 59010
* waybread, potpie, grapes, lollipop, cookies and cream
set prize_vec 10 3009 6346 34080 1758
%send% %actor% You hand over some gold coins to the dealer.
nop %actor.gold(-10000)%
wait 2 s
%send% %actor% The dealer says, 'Right, let's play a game.'
wait 2 s
%send% %actor% The dealer takes out a pair of dice, and he throws them up in the air!
wait 2 s
%send% %actor% The dice come tumbling down...
wait 2 s
set d1 %random.6%
set d2 %random.6%
%send% %actor% The first die showed a {cR%d1%{cx!
wait 2 s
%send% %actor% The second die showed a {cR%d2%{cx!
eval first_roll %d1% + %d2%
wait 2 s
%send% %actor% The total sum is {cY%first_roll%{cx!
wait 2 s
if %first_roll% == 7 || %first_roll% == 11
%send% %actor% You win! YAY!
wait 2 s
%send% %actor% The dealer gives you a prize!
set pnum %random.5%
%load% obj %prize_vec.wordat(%pnum%)% %actor%
wait 2 s
%send% %actor% Do you want to play again?
elseif %first_roll% == 2 || %first_roll% == 3 || %first_roll% == 12
%send% %actor% You lose! Bummer!
wait 2 s
%send% %actor% The dealer smirks and says: Better luck next time, pal!
else
* roll until you get back your previous roll
set this_roll 0
%send% %actor% The dealer says, 'Since the sum of the dice was not a 2,3,7,11, or 12, I'll roll them again!'
wait 2 s
%send% %actor% He continues, 'You will win if I roll back a %first_roll%, and lose if I roll a 7.
wait 2 s
%send% %actor% Otherwise, I'll keep on rolling the dice.'
set counter 1
while %counter% < 2
*while (%this_roll% != 7 && %this_roll% != %first_roll%)
wait 2 s
%send% %actor% The dealer takes out a pair of dice, and he throws them up in the air!
wait 2 s
%send% %actor% The dice come tumbling down...
wait 2 s
set d1 %random.6%
set d2 %random.6%
%send% %actor% The first die showed a {cR%d1%{cx!
wait 2 s
%send% %actor% The second die showed a {cR%d2%{cx!
eval this_roll %d1% + %d2%
wait 2 s
%send% %actor% The total sum is {cY%this_roll%{cx!
wait 2s
* some weird stuff about multi arguments for while
if %this_roll% == %first_roll%
set counter 10
elseif %this_roll% == 7
set counter 10
else
%send% %actor% The dealer says, 'Gotta roll again!'
endif
done
if %this_roll% == 7
%send% %actor% You lose! Bummer!
wait 2 s
%send% %actor% The dealer smirks and says: Better luck next time, pal!
else
%send% %actor% You managed to get back the value of the first roll!
wait 2 s
%send% %actor% You win! YAY!
wait 2 s
%send% %actor% The dealer gives you a prize!
set pnum %random.5%
%load% obj %prize_vec.wordat(%pnum%)% %actor%
wait 2 s
%send% %actor% Do you want to play again?
endif
endif
if %actor.varexists(thetis2)%
%echo% You are on stage 2!
else
%echo% Good day, %actor.name%
endif
set thetis 2
remote thetis %actor.id%
because then we could just do:if %actor.varexists(thetis)%
if %actor.thetis% == 2
%echo% You are on stage 2
endif
endif
* Assume this is trigger 12345 as a function
if !%actor.varexists(questcard6_thetis)%
set questcard6_thetis 0
if %actor.varexists(thetis1)%
set questcard6_thetis 1
rdelete thetis1 %actor.id%
endif
if %actor.varexists(thetis2)%
set questcard6_thetis 2
rdelete thetis2 %actor.id%
endif
if %actor.varexists(thetis3)%
set questcard6_thetis 3
rdelete thetis3 %actor.id%
endif
* etc etc
remote questcard6_thetis %actor.id%
endif
etc all the way till thetis11. Note that while the code looks long, and would have eleven if checks (for thetis1 to thetis 11), the first if branch is only ever executed once. * Create Thetis flag, and replace questflag
function 12345
if %actor.questcard6_thetis% == 2
%echo% You are on stage 2
endif
if %actor.varexists(questcard6_thetis)%
* new function
if !%actor.varexists(questcard6_thetis)%
set questcard6_thetis 0
remote questcard6_thetis %actor.id%
endif
if %actor.varexists(thetis1)%
set questcard6_thetis 1
remote questcard6_thetis %actor.id%
rdelete thetis1 %actor.id%
endif
if %actor.varexists(thetis2)%
set questcard6_thetis 2
remote questcard6_thetis %actor.id%
rdelete thetis2 %actor.id%
endif
if %actor.varexists(thetis3)%
set questcard6_thetis 3
remote questcard6_thetis %actor.id%
rdelete thetis3 %actor.id%
endif
* etc etc
Name: 'Trigger for Generic Trade', VNum: [47300], RNum: [ 8677]
Trigger Intended Assignment: Mobiles
Trigger Type: Receive , Numeric Arg: 100, Arg list: None
Commands:
if !%actor.is_pc%
halt
endif
**** Set parameters
**** What the player sees if supposed to get multiple tradepoints
**** eg, tp_start_plural NUM TRADEPOINTS tp_end_plural
set tp_start_plural Bob hands over
set tp_end_plural tradepoints.
set tp_sing Bob hands over 1 tradepoint.
**** What the player sees if supposed to get multiple brass tokens
**** eg, brass_start_plural NUM TOKENS brass_end_plural
set brass_start_plural Bob hands over
set brass_end_plural brass tokens.
set brass_sing Bob hands over 1 brass token.
**** What the player sees if supposed to get multiple brass tokens
**** eg, bronze_start_plural NUM TOKENS bronze_end_plural
set bronze_start_plural Bob hands over
set bronze_end_plural bronze tokens.
set bronze_sing Bob hands over 1 bronze token.
* Accepted Trade items only
* ALWAYS PLACE PARTIAL ITEMS AT THE END
* Partial items - eg trade FIVE grapes for ONE wine
* You get up to FIVE messages for everything
* Unlimited items to trade (in theory)
* Total number of items traded
set max_items 5
* Non partial items, eg trade ONE item to get reward
set ordinary_items 3
* Partial items, eg trade FIVE grapes for reward
set part_items 2
* Makes it easier for questjournal in future to keep track of trades
* Trade_flag can be: trade_egypt_mobname etc etc
set trade_flag trade_thiszone_thismob
* Place the part_items at the end.
* Up to 5 messages, with delay in seconds
* If you need more messages, send a note
* Delay between mob messages
set delay 2
* Flags for items
* If none, don't need to have the flag there
* item_x : list vnums, or short desc
* type_x : Is it a vnum, or short desc?
* msg_Ax, msg_Bx, msg_Cx, msg_Dx, msg_Ex : What mob says
* reward_x : reward is in terms of XP TP BRASS BRONZE
* item_reward_x : vnum of item reward
* how_many_x : For partial items, how many to get a reward?
* reward_after_x : The reward after getting all partial items
* item_reward_after_x : The item reward after getting all partial items
* Put the three ordinary items first
* Item 1 (diamonds)
* Bob will accept one item, will have three actions
* This item gets 1000 XP * level, 10 TP, 0 brass, 0 bronze
set item_1 8465
set type_1 vnum
set msg_A1 Bob says, 'Thank you for trading this item'
set msg_B1 Bob smiles.
set msg_C1 Bob says, 'I have nothing else to say.'
* Reward is in terms of XP, TP, BRASS, BRONZE
set reward_1 1000 10 0 0
* Item 2 (logs)
* Bob will accept any item with short desc logs, will have four actions
* This item gets 5000 XP * level, 4 TP, 1 brass, 2 bronze
* This item will also get a object reward vnum 2523
set item_2 log
set type_2 short
set msg_A2 Bob says, 'Thank you for trading the log item'
set msg_B2 Bob smiles.
set msg_C2 Bob says, 'I have given you a small gift of a chair.'
set msg_D2 Bob thanks you heartily.
* Reward is in terms of XP, TP, BRASS, BRONZE
set reward_2 5000 4 1 2
set item_reward_2 2523
* Item 3 (bread)
* Bob will accept two items: 10, 9291 and has one action
* This item gets 1 TP
set item_3 10 9291
set type_3 vnum
set msg_A3 Bob says, 'I like bread.'
set reward_3 0 1 0 0
* Reminder, always put partial items last
* Item 4 (grapes)
* Bob will accept two items: 6346, 44495 and has two actions
* This item gets no reward each time
* Bob has a message to count them, eg msg_counter_before NUMGIVEN msg_counter_after
* But when all 5 are given (how_many_4 flag)
* Player gets 1000 xp * level, 5 TP, 1 brass, 0 bronze
* Player also gets object 6349
* Item 4 (grapes - trade 5 to get 1 wine)
set item_4 6346 44495
set type_4 vnum
set how_many_4 5
set msg_A4 Bob says, 'Thanks for the grapes'
set msg_B4 Bob says, 'I will store them to make wine'
set msg_counter_before_4 Bob says, 'Keep them coming,
set msg_counter_after_4 out of 5!
set reward_4 0 0 0 0
set msg_after_A4 Bob says, 'You have given me 5 grapes'
set msg_after_B4 Bob says, 'I will give you some wine'
set reward_after_4 1000 5 1 0
set item_reward_after_4 6349
* Item 5 (ear)
* Bob will accept one items: 15083
* This item gets 1 TP each time it is given
* Bob has a message to count them, eg msg_counter_before NUMGIVEN msg_counter_after
* But when all 10 are given (how_many_5 flag)
* Player gets 1000 xp * level, 10 TP, 10 brass, 10 bronze
set item_5 15083
set type_5 vnum
set how_many_5 10
set msg_A5 Bob says, 'Thanks for the wolf ear'
set msg_B5 Bob says, 'I will give you 1 TP.
set reward_5 0 1 0 0
set msg_counter_before_5 Bob says, 'Look at these ears piling up,
set msg_counter_after_5 out of 10!
set reward_after_5 1000 10 10 10
set msg_after_A5 Bob says, 'I'm going to give you a bonus!'
set msg_after_B5 Bob says, 'Tokens and stuff and more'
set msg_after_C5 Bob says, 'But no items.'
******** Rejected items
* same thing
set rej_max_items 2
* Bob rejects items 8704, 1404 with a special message
set rej_item_1 8704 1404
set rej_type_1 vnum
set rej_msg_A1 Bob says, 'I don't like gold.'
set rej_msg_B1 Bob says, 'Go away.'
* Bob rejects items with short desc flower with a special message
set rej_item_2 flower
set rej_type_2 short
set rej_msg_A2 Bob says, 'I hate flowers.'
set rej_msg_B2 Bob says, 'Go away.'
***** Default message
set rej_default_A Bob says, 'What is this crap?'
set rej_default_B Bob says, 'Go away.'
**** The magic function
function 47391
* items are what the mob accepts. For example, there's lots of wolf ears in the MUD, so you could do something like
set item1 1234 2222 5828
* if 1234, 2222, 5828 were vnums of wolf ears
* You get up to three consecutive actions the player sees in order.
* You don't need to use all three of them. So for example, you can have
set item1 52614
set speecha1 Tino says, 'Good! I can always use more hemp twine!'
* where item1 only has one line the player sees
set item2 12345
set speecha2 Gollum says, 'A ring, great!"
set speechb2 Gollum says, 'My precioussssssss'
set speechc2 Gollum caresses the ring eagerly.
* item 2 has three lines the player sees
set item3 123 6839 5824 52850
set speecha3 The player sees this.
set speechb3 and this.
* item 3 has three lines the player sees
* items / speeches are always set in consecutive order
if !%actor.is_pc%
halt
endif
* Molly, Kvetch, whoever wants to add MORE trading stuff here, follow the
* comments
*
* If you want to reduce the number of items traded, it's a bit more complex.
* Send me a note, or any of the coders.
* Ideally, we should probably write this in C instead of DG scripts.
*
* Flag: trade_crete_tino
* Currently, can trade THREE items, and mob rejects ONE item
*
*********
*********
*** The Edit Place
*************************
* Edit the below if you want to change the number of items traded
set max_items 3
*************************
* na_flag is basically THREE nas (or however max_items nas)
set na_flag na na na
*************************
* flagname - the flag for the trading
set flagname trade_crete_tino
* hemp twine
set item1 52614
set speecha1 Tino says, 'Good! I can always use more hemp twine!'
* sail cloth
set item2 52797
set speecha2 Tino says, 'Great! We were about to run out of sailcloth completely.'
* thin rope
set item3 52615
set speecha3 Tino says, 'Great, that thinrope will be enough for me to finish this batch of sails.'
* TP and EXP for each item
set tp_reward_vec 1 8 4
* This has no brass token
* set brass_reward_vec 0 0 0 1 0 0
set exp_reward_vec 1000 4000 3000
* rejected items
set rej_max_items 1
* sails
set rej1 44673 44674
set rejspeecha1 Tino says, 'Dude, I SELL sails, I don't buy them.
set rejspeechb1 So you can keep any sails you've made for yourself.'
****
* Generic rejection speech
set genreja Tino says, 'I don't trade in such things.'
*
*
* This function will fix length of questflag, eg if more items were
* added
* Required inputs: na_flag, flagname, and max_items
function 2151
* BEFORE CALLING 21627
* Make sure you have defined a prefix for the items traded
* Above it's item1, item2, item3, item4, item5, item6, so prefix is item
* Also make sure you've set max_items, which ought to be ABOVE
* For the purists: function 21627 takes in an input prefix, and max_items,
* gives an output item_in_list
set prefix item
function 21627
set traded_item %item_in_list%
if %traded_item% != 0
** The reward for great trading items
function 2152
halt
endif
* Let's do the same for rejected items for special messages
* We are calling the same function 21627 again, but with
* rejected items as input
* So max_items is now rej_max_items, and prefix is rej
set max_items %rej_max_items%
set prefix rej
function 21627
set rej_traded_item %item_in_list%
function 2153
**** END
if !%actor.is_pc%
halt
endif
* Molly, Kvetch, whoever wants to add MORE trading stuff here, follow the
* comments
*
* If you want to reduce the number of items traded, it's a bit more complex.
* Send me a note, or any of the coders.
* Ideally, we should probably write this in C instead of DG scripts.
*
* Flag: trade_winter
* Currently, can trade SIX items, and mob rejects FOUR items
*
*********
*********
*** The Edit Place
* Edit the below if you want to change the number of items traded
set max_items 6
* na_flag is basically SIX nas (or however max_items nas)
set na_flag na na na na na na
* thinrope
set item1 52615
set speecha1 Bob says, 'OK, most of the mountaneers buy a thin rope from me.'
* thickrope
set item2 52616
set speecha2 Bob says, 'Right, thinropes are in most demand of course.
set speechb2 But there are situations when the mountaineers need thicker ropes too.
set speechc2 I've seen ten of them dangle over a precipice from the same rope.'
* longrope
set item3 52617
set speecha3 Bob says, 'Thanks! Just what I wanted.
set speechb3 I need a longrope in reserve in case some of them mountaneers falls into a deep ravine.'
* ropeladder
set item4 52618
set speecha4 Bob says, 'Great! I was just out of ropeladders!'
* wool yarn
set item5 52619 52620
set speecha5 Bob says, 'Yup, wool yarn is popular around here.'
* wool cloth
set item6 52624 52625
set speecha6 Bob says, 'Mmm, wool cloth is just what we need.
set speechb6 None of the other kinds keep you warm enough.'
* TP and EXP for each item
set tp_reward_vec 5 13 28 0 3 7
set brass_reward_vec 0 0 0 1 0 0
set exp_reward_vec 3000 6000 8000 10000 1000 1000
* rejected items
set rej_max_items 3
* cotton thread
set rej1 3266 30957
set rejspeecha1 Bob says, 'No thanks, I'm really just interested in wool yarn and cloth.
set rejspeechb1 It's too cold for other materials here.'
* silk
set rej2 52651 52661
set rejspeecha2 Bob says wistfully, 'I wish I could afford it.
set rejspeechb2 But nobody around here would buy silk, And it's too cold for it anyway.'
* cloth
set rej3 3267 30958 44653
set rejspeecha3 Bob says, 'Sorry, I cannot afford silk, and neither can my customers.'
****
* Can stop here for most cases. Below is generic stuff.
*
set trade_winter %na_flag%
if !%actor.varexists(trade_winter)%
remote trade_winter %actor.id%
elseif %actor.varexists(trade_winter)%
* Check to see if we have any changes in the length if this var exists
set findnumwords %actor.trade_winter%
function 21625
* Check to see if variable max_items (set above) is equal
* to number of words in trade_winter, eg if you modified above
* flag to trade NINE items instead of SIX.
if %max_items% != %num%
* someone added more items so that's fine
set ub 0
while %ub% < %num%
eval ub %ub% + 1
*%echo% Replacing...
replace_word %findnumwords.wordat(%ub%)% %ub% trade_winter
done
remote trade_winter %actor.id%
endif
endif
set trade_winter %actor.trade_winter%
* BEFORE CALLING 21627
* Make sure you have defined a prefix for the items traded
* Above it's item1, item2, item3, item4, item5, item6, so prefix is item
* Also make sure you've set max_items, which ought to be ABOVE
* For the purists: function 21627 takes in an input prefix, and max_items,
* gives an output item_in_list
set prefix item
function 21627
set traded_item %item_in_list%
** The reward for great trading items
** Can mostly ignore this part
if %traded_item% != 0
*Great, no rejected items. Now to find which one
wait 1
mjunk %object%
* evals the correct speech corresponding to the traded item
eval tosaypartone %%speecha%traded_item%%%
eval tosayparttwo %%speechb%traded_item%%%
eval tosaypartthree %%speechc%traded_item%%%
%send% %actor% %tosaypartone%
if %tosayparttwo%
%send% %actor% %tosayparttwo%
endif
if %tosaypartthree%
%send% %actor% %tosaypartthree%
endif
wait 1
* Reward goes here, corresponding to the traded_item
set tp_reward %tp_reward_vec.wordat(%traded_item%)%
nop %actor.trade(%tp_reward%)%
if %tp_reward% == 1
emote hands over %tp_reward% tradepoint.
elseif %tp_reward% > 1
emote hands over %tp_reward% tradepoints.
endif
eval d %actor.level% * %exp_reward_vec.wordat(%traded_item%)%
nop %actor.exp(%d%)%
* tokens
set bronze_reward %brass_reward_vec.wordat(%traded_item%)%
set counter 0
while %counter% < %bronze_reward
eval counter %counter% + 1
emote hands over a brass token.
%load% obj 3300 %actor%
done
set trade_winter %actor.trade_winter%
set curr_item %trade_winter.wordat(%traded_item%)%
if %curr_item% == na
set curr_item 1
else
eval curr_item %curr_item% + 1
endif
replace_word %curr_item% %traded_item% trade_winter
remote trade_winter %actor.id%
* Halt this script if we have successfully traded!
halt
endif
* Let's do the same for rejected items for special messages
* We are calling the same function 21627 again, but with
* rejected items as input
* So max_items is now rej_max_items, and prefix is rej
set max_items %rej_max_items%
set prefix rej
function 21627
set rej_traded_item %item_in_list%
if %rej_traded_item% != 0
eval tosay1 %%rejspeecha%rej_traded_item%%%
eval tosay2 %%rejspeechb%rej_traded_item%%%
%send% %actor% %tosay1%
if %tosay2%
%send% %actor% %tosay2%
endif
halt
else
emote says, 'Sorry, I don't trade in that kind of stuff.'
endif
questcard7_viking
questcard19_riddle
tsearch all questcardxx
, example:*find triggers related to questcard 19
tsearch all questcard19
questcard19a
questcard19b
...
questcard200_myquest: noprog 0 notdone inprog 2 notdone inprog 3 done noprog 0 done
if !%actor.varexists(hanna)%
* Player doesn't have this flag
%send% %actor% You are not on this quest!
%send% %actor% I will put you on this quest!
set hanna 1
remote hanna %actor.id%
else
* Player has this flag
set hanna %actor.hanna%
if %hanna% == 1
%send% %actor% You are on step 1. Let me progress you to step 2
set hanna 2
remote hanna %actor.id%
elseif %hanna% == 2
%send% %actor% You are on step 2. Let me progress you to step 3
set hanna 2
remote hanna %actor.id%
endif
endif
* A wrong way
if !%actor.varexists(questcard200_myquest)%
%send% %actor% You are not on this quest!
%send% %actor% I will put you on this quest!
set questcard200_myquest noprog 0 notdone noprog 0 notdone inprog 1 notdone noprog 0 notdone
remote questcard200_myquest %actor.id%
endif
* Example of an object function
Name: 'Questcard200 obj function', VNum: [12345], RNum: [----]
Trigger Intended Assignment: Objects
Trigger Type: FUNCTION , Numeric Arg: 100, Arg list: None
Commands:
* Create this questflag if it doesn't exist
if !%actor.varexists(questcard200_quest)%
set questcard200_quest noprog 0 notdone noprog 0 notdone noprog 0 notdone noprog 0 notdone
remote questcard200_quest %actor.id%
* To reassure people that their old flags aren't deleted
* suppose they completed quest 1 before
if %actor.varexists(oldflag1)%
replace_word done 3 questcard200_quest
rdelete oldflag1 %actor.id%
endif
remote questcard200_quest %actor.id%
endif
* Need to check if is PC before calling any functions.
if %actor.is_pc%
*For any trigger which deals with questflags
*Call the appropriate function (room, mob or obj?)
*Pretend it's an object so call the function above
* This function sets the questflag ONCE, if it doesn't exist.
function 12345
* The below line can't bug, because we've created the flag if it didn't exist.
set questcard200_quest %actor.questcard200_quest%
* Now, proceed as normal, eg:
if %questcard200_quest.wordat(7)% == noprog
%send% %actor% You are not on this quest.
%send% %actor% I will put you on this quest
%send% %actor% I will replace the 7th word in your flag to show you are now in progress
replace_word inprog 7 questcard200_quest
%send% %actor% I will replace the 8th word by 1 to show you are now on step 1 for this quest
replace_word 1 8 questcard200_quest
remote questcard200_quest %actor.id%
else
if %questcard200_quest.wordat(8)% == 1
%send% %actor% You are on step 1
replace_word 2 8 questcard200_quest
remote questcard200_quest %actor.id%
%send% %actor% Now you are on step 2
elseif %questcard200_quest.wordat(8)% == 2
%send% %actor perfect, let's give you a reward
if %questcard200_quest.wordat(9)% == notdone
%send% %actor% You haven't done this quest before, so I'll give you a big reward!
replace_word done 9 questcard200_quest
else
%send% %actor% You've done this quest before, so a smaller reward!
endif
* Reset all other questflags for this quest so
replace_word 7 noprog questcard200_quest
replace_word 8 0 questcard200_quest
remote questcard200_quest %actor.id%
endif
endif
endif
if %actor.is_pc%
...
endif
hat_temple: noprog notdone 2
hat_temple: inprog notdone 1
hat_temple: noprog done 0
* Create this variable if it hasn't existed
function 12345
set hat_temple %actor.hat_temple%
if %hat_temple.wordat(3)% == 2
%echo% You are at step 2
endif
* Previously it would probably be something like
*if %actor.varexists(hat_temple_quest)%
* if %hat_temple_quest% == 2
* %echo% You are at step 2
* endif
*endif
* and script errors would occur if you had
* if %actor.varexists(hat_temple_quest)% && %hat_temple_quest% == 2
* if the variable didn't exist
if !%actor.varexists(hat_temple)%
set hat_temple noprog notdone 0
remote hat_temple %actor.id%
endif
if %actor.varexists(hat_temple_quest)% && %hat_temple_quest% == 2
%echo% do this
endif
and the player doesn't have the variable.