Author Topic: Trigger of the .... something  (Read 58862 times)

0 Members and 1 Guest are viewing this topic.

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #15 on: August 19, 2011, 07:10:59 pm »
I thought I'd go have a bit of fun when checking out the scripts I had my sweaty little building paws on and came across this little tidbit.  Not exactly sure who created it, but I am pretty sure I took it off TBAmud.
Code: [Select]
Name: 'water balloon sploosh!',  VNum: [57196], RNum: [ 4101]
Trigger Intended Assignment: Objects
Trigger Type: Drop , Numeric Arg: 100, Arg list: None
Commands:
set room_var %actor.room%
wait 1 s
* Send a message when the bomb goes off.
%echo% The water balloon breaks open and water sprays everywhere!
* Target the first char.
set target_char %room_var.people%
* Now loop through everyone in the room and hurt them.
while %target_char%
  * Set the next target before this one perhaps dies.
  set tmp_target %target_char.next_in_room%
  * This is where the 'magic' happens
  %echoaround% %target_char% gets hit with water!
  %send% %target_char% You get hit with water!
  * Set the next target.
  set target_char %tmp_target%
  * Loop back.
done
* After we go through everyone get rid of the water balloon.
%purge% %self%

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #16 on: October 18, 2011, 05:24:13 pm »
This is Mord's OLC style journal
Code: [Select]

Name: 'Journal - OLC style',  VNum: [ 4499], RNum: [  437]
Trigger Intended Assignment: Objects
Trigger Type: Command, Numeric Arg: 1, Arg list: *
Commands:
if %actor.fighting%
return 0
unset edit
halt
end
set sa %send% %actor%
set ea %echoaround% %actor%
set pageheight 30
set pagewidth 80
if !%top_line%
set top_line 0
global top_line
end
if !%state%
switch %cmd%
case edit
if %arg.car%==journal
%sa% You start editing the journal.
%ea% %actor.name% starts editing %actor.hisher% journal.
set state edit
global state
else
return 0
end
break
case l
case look
if %arg.contains(journal)%
%sa% To add or edit a journal entry type:
%sa%    edit journal
%sa% To read the journal type:
%sa%     read journal
%sa% WHILE IN THE EDITOR:
%sa% To save a journal entry, and exit the editor type:
%sa%    :s
%sa% --
%sa% To clear all lines on this page of the journal type:
%sa% :c
%sa% --
%sa% To delete a single existing line on this page of the journal type:
%sa%    :d <line number>
%sa% --
%sa% To edit a single existing line on this page of the journal type:
%sa%    :e <line number> <new line text>
%sa% --
%sa% To view the current lines on this page of the journal type:
%sa%    :l
%sa% --
%sa% NOTE: The maximum lines per page is %pageheight%
else
return 0
end
break
case read
case examine
if %arg.contains(journal)%
if %top_line%==0
%sa% Sorry, but there is nothing yet to read.
halt
end
%sa% You read the page of the journal.
%sa% ---------------------------------------------
set li 0
while %li% < %top_line%
eval show %%line[%li%]%%
%sa% %show%
eval li %li%+1
done
%sa% ---------------------------------------------
%sa% Total lines: %top_line%
else
return 0
end
break
default
return 0
break
done
elseif %state% == edit
if %cmd% == :
set command %arg.car%
set arg %arg.cdr%
switch %command%
case s
case save
set state
unset state
%sa% You save the journal entry and exit the editor.
%ea% %actor.name% saves %actor.hisher% journal entry, and stops editing.
break
case c
set li 0
while %li% < %top_line%
unset line[%li%]
eval li %li%+1
done
unset top_line
%sa% All lines from page %page% cleared.
break
case l
if %top_line%==0
%sa% No lines to see.
halt
end
set li 0
while %li% < %top_line%
eval show %%line[%li%]%%
%sa% %li%] %show%
eval li %li%+1
done
break
case d
if %top_line% == 0
%sa% There are no lines to delete!
halt
end
eval del %arg%/1
%sa% Line %del% deleted.
set li %del%
while %li% < %top_line%
eval nxt %li%+1
set nxt_lne %%line[%nxt%]%%
eval line[%li%] %nxt_lne%
eval li %li%+1
done
eval top_line %top_line%-1
break
case e
if %top_line% == 0
%sa% There are no lines to edit/update!
halt
end
eval ed %arg.car%/1
if %ed% > %top_line% || %ed% < 0
%sa% Sorry but '%ed%' isn't a valid line.
%sa% You can only edit lines 0 through to %top_line%
halt
end
%sa% Line %ed% changed.
eval line[%ed%] %arg.cdr%
break
case f
*Format needs more while loops than the mud allows to complete
if %top_line% == 0
%sa% There are no lines to format!
halt
end
set li 0
while %li% < %top_line%
eval text %text% %%line[%li%]%%
*clear the variable
set line[%li%]
*remove the global
unset line[%li%]
eval li %li%+1
done
eval top_line 0
while %text.cdr%
eval cur_line %%line[%top_line%]%%
eval len %cur_line.strlen%
eval next_len %len% + %text.car.len%
if %next_len% > %pagewidth%
eval top_line %top_line%+1
end
*if a single word is longer than the limit, just save as is
if %text.car.len% > %pagewidth%
set line[%top_line%] %text.car%
eval top_line %top_line%+1
else
set line[%top_line%] %text.car%
end
global line
done
global top_line
break
default
%sa% That (%cmd%%arg.car%) is not a valid in-editor command :s :e :d :l
break
done
else
if %top_line% >= %pageheight%
%sa% Sorry, you can't add any more lines, you already have the maximum of %pageheight%.
%sa% To write any more, save what you have and start a new page.
halt
end
set line %cmd% %arg%
if %line.strlen% > %pagewidth%
%sa% Sorry, but you can't have lines longer than %pagewidth% characters.
%sa% %line% (%line.strlen%)
halt
end
set line[%top_line%] %line%
global line[%top_line%]
%sa% %top_line%] %line%
eval top_line %top_line%+1
global top_line
end
else
return 0
end
« Last Edit: October 18, 2011, 06:39:40 pm by Kvetch »

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #17 on: October 18, 2011, 06:44:08 pm »
You have to hold the journal to be able to do anything with it (took me a while to figure that out - it's been years), but after you hold it, when you look at it you get this:
To add or edit a journal entry type:
Edit journal
To read the journal type:
Read journal
WHILE IN THE EDITOR:
To save a journal entry, and exit the editor type:
:s
--
To clear all lines on this page of the journal type:
:c
--
To delete a single existing line on this page of the journal type:
:d <line number>
--
To edit a single existing line on this page of the journal type:
:e <line number> <new line text>
--
To view the current lines on this page of the journal type:
:l
--
NOTE: The maximum lines per page is 30

I tested this out and ended up with this as a test for the journal:

You read the page of the journal.
---------------------------------------------
This is to test the journal.  This is the first line.
I am continuing to test the journal.  This is the second line.
This is the final line in the journal test.
---------------------------------------------
Total lines: 3

Offline Molly

  • Administrator
  • Hero Member
  • *****
  • Posts: 691
    • View Profile
Re: Trigger of the .... something
« Reply #18 on: October 19, 2011, 02:07:37 am »
I don't think that you guys have fully understood the problems with setting up a quest journal.

To give a hint, I'll post a list of the questflags I get when I check a couple of our older players, who happen to be on line right now, Tamyrlin and Tor.
Each of them have 5-6 pagelengths of different questflags, and the lists keep changing, because the last quest is always on top.

Also notice the varying numbers after some of the flags. It means that there are several different flags that needs to be checked for that quest, for instance we've got several 10 step quests.

Do you feel like setting up a script for all those flags, plus possibly about 50 more, since even oldbies like Tamyrlin  haven't done every single quest in the game?

I don't.

I honestly think that even trying would be a waste of time.
For a quest journal to work, you probably should have had a totally different - and consistent - system for the quests right from the start, code-run instead of script-run.
As it is, every builder has their own system for how the flags are set, and it even changes over the years for the same builder, after they figured out a better way of doing it.

This is another case of 4D being too old and too big to be turned around with a reasonable amount of work.

The lists are too long for the buffer here too, so I'll put them in a separate post.

Offline Molly

  • Administrator
  • Hero Member
  • *****
  • Posts: 691
    • View Profile
Re: Trigger of the .... something
« Reply #19 on: October 19, 2011, 02:09:49 am »
Here is the examples of questflag lists for Tamyrlin, I'll have to move Tor to a separate post:

Global Variables for Tamyrlin:
                                    levitate:                     1
                                     eleusis:                     3
                                         i11:                     1
                           kito_house_access:                     1
                                     countup:                     0
                                          fd:                     0
                                          fo:                     3
                                          fm:                     3
                                   gar_anger:                     1
                                  stealthmod:                     1
                               special_bonus:                     1
                                   damagemod:                     1
                                    speedmod:                    10
                                shadowdagger:                     1
                                   reformers:                     3
                                       grail:                     1
                                  amunpriest:                     2
                      hween2009billiardsdone:                     1
                             freepirateslave:                     1
                                 portal_exit:                  1701
                                     wreaths:                     1
                        freepiratevikingdone:                     1
                                     pillage:                    10
                                    rapunzel:                     1
                                      virgin:                     1
                                  spacecadet:                     1
                     mirkheim_heartquest_ask:                      
                                     marielf:                     1
                                 unknownpoet:                     1
                                       slate:                     4
                                      lapith:                    2
                                        syme:                     1
                                    damiskos:                     1
                                    iphinone:                     1
                                    disabled:                     1
                                     wabeeto:                     2
                                    overseer:                     1

[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (1/6) ]

                                      anaphe:                     2
                                anaphehealer:                     1
                                      eunuch:                     4
                                     anchusa:                     1
                                  haremwomen:                     8
                                      slunch:                     6
                                   lovenbroy:                     2
                                      heart1:                     1
                                     tombnum:                    12
                                 tombcounter:                   121
                                  thasoswife:                     1
                                      spiros:                     3
                                          ka:                     1
                                       josua:                     5
                                      priest:                     1
                                        boba:                     1
                                       adia1:                     1
                                         i10:                     1
                                          i8:                     1
                                 done_slunch:                     1
                                          i5:                     1
                                          i1:                     1
                                    heracles:                    10
                                    poonbomb:                     1
                                     yudore1:                     1
                                   esmeralda:                     2
                                 changedring:                     1
                            pirateparrotdone:                     1
                               nafula_rescue:                     1
                                     darkpit:                     1
                                      nimue1:                     1
                                     player1:                     1
                                          i4:                     1
                              duq8_completed:                     1
                              duq6_completed:                     1
                            angelicblessings:                     1
                                robindagdone:                     1
                                   robinhood:                

[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (2/6) ]

     1
                                      marion:                  2431
                               isis_complete:                     1
                                   teldomash:                     1
                                     donegan:                     1
                                         666:                     1
                                 bullcatcher:                     4
                                   greencoat:                     1
                                 dragonscale:                     1
                                      dopey1:                     1
                                   paulonote:                     1
                                     ricardo:                     1
                                       elena:                     1
                                    ricardo1:                     1
                                  cristianna:                     1
                                          77:                     5
                                          66:                     1
                                          55:                     6
                                    gameshow:                     1
                                       gift6:                     1
                                  zeddletter:                     1
                                   boneplate:                     1
                                   doneboxes:                     1
                                      kahlan:                     1
                                        jack:                     1
                                  greenhorne:                     1
                                  riddlebook:                     1
                                frenchknight:                     1
                                      claire:                     1
                                     marquis:                     1
                                    bashful1:                     1
                                        zera:                     1
                                       pris1:                     1
                               quest_academy:                     1
                                 mollyremote:                     1
                                     viagros:                     1
                                     unicorn:                     1
                                   bettygolf:                     1

[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (3/6) ]

                                     orsini5:                     1
                                    baronkey:                     9
                                azizi_rescue:                     1
                             bamboo_bracelet:                     1
                                   bellehelp:                     1
                          midlands_greenglow:                     1
                                 kahlan_zedd:                     1
                                 kahlan_adie:                     1
                                      toff_2:                     1
                                      nexits:                     0
                                      sexits:                     0
                                      eexits:                     3
                                      wexits:                     9
                                    imunbug1:                     1
                            done_birds_tasks:                     1
                                  wear_paint:                     1
                                     mulmoki:                     1
                                summerville2:                     1
                                     tobias1:                     1
                          percyshelley1_done:                     1
                        jekyll_antidote_done:                     1
                                 jekyll_hyde:                     1
                        burkeandhare_corpses:                     0
                                  millicent1:                     1
                                amelia_done1:                     1
                                 ripper_done:                     1
                                 reflection1:                     1
                                  reflection:                     1
                                       curly:                     1
                                circus_quest:                     1
                                     gold001:                     1
                                     lowell1:                     1
                             lowell1_rocking:                     0
                                   duq9_help:                     1
                                 q7_boyscene:                     1
                                   q13sketch:                     1
                              duq2_completed:                     1
                                  slotcredit:                

[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (4/6) ]

     0
                                     elysean:                     3
                                   odysseus1:                     1
                                       ajax2:                     1
                                    personal:                     1
                                      hades6:                     1
                                 q11killserp:                     1
                                    q7nugget:                     1
                                     deadred:                     1
                                q11skingiven:                     1
                             duq11_completed:                     1
                                       aswan:                    4
                                       cache:                     1
                                angelaletter:                     1
                                      augias:                     4
                                     gicave3:                     1
                            cardinal_absolve:                     2
                                  enter_quay:                     1
                               kermapolitics:                     1
                                      dundee:                     1
                                   meatballa:                     1
                             smithnailpolish:                     1
                                    imhotep2:                     1
                                     elftoys:                     1
                                          i6:                     1
                                       botta:                     1
                                       harem:                     1
                                    lysander:                     1
                               vikingjacktar:                     1
                                  frogstatue:                     1
                           midlandsfairyring:                     1
                                     liqueur:                     1
                                  athosabbot:                     1
                                   centaurea:                     1
                                  anitabobby:                     1
                           failed_apple_bite:                     2
                                  bit_apples:                    10
                                    appleexp:                180000

[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (5/6) ]

                                 apple_count:                    49
                               hween2009soul:                      
                                     hween09:                     1
                               hweendoll2009:                     1
                        hween2009kidsrescued:                     1
                                  oriondeath:                     1
                                 gojiradeath:                     1
                                   golem_num:                     1
                                      gtierr:                     4
                                     gevolve:                  1930
                                       gtier:                     4
                                       moria:                     1
                                      asking:                     1
                                  baby_steal:                     3
                             calydnosspinner:                     1
                                  cat_follow:                     1
                                      avalon:                     7
                              done_reformers:                     1
                               bridget_spoon:                     1
« Last Edit: February 23, 2014, 04:47:58 pm by Molly »

Offline Molly

  • Administrator
  • Hero Member
  • *****
  • Posts: 691
    • View Profile
Re: Trigger of the .... something
« Reply #20 on: October 19, 2011, 02:10:27 am »
And here are Tor's flags:

-------------------------------------------------------------------------------
Global Variables for Tor:
                                 warelephant:                     1
                                       aswan:                    1
                               kermapolitics:                     1
                                    hunterba:                     4
                                   skincount:                     2
                                      arthur:                     6
                                   reformers:                     6
                                     hween09:                     1
                                 apple_count:                    46
                               hween2009soul:                      
                         hween2009billiards3:                     1
                                     lowell1:                     1
                             millicent1_done:                     1
                                     mother1:                     1
                                          89:                     4
                                killedabbess:                     1
                                      clock1:                     1
                            pirateparrotdone:                     1
                                  orsini_yes:                     1
                                     orsini1:                     1
                                     wreaths:                     2
                                       lycon:                     3
                                     islands:  MollyAndMordecaiRule
                                       hades:                     5
                                  poked_hook:                     1
                                   gorget144:                     1
                                   golem_num:                     1
                                 sabatons144:                     1
                                    rapunzel:                     1
                                     orsini2:                     1
                                     donegan:                     1
                                       curly:                     1
                                       shave:                     1
                                       josua:                     4
                                   streaking:                     1
                                  fisherbaby:                     1
                                   centaurea:                     1

[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (1/5) ]

                                  piratemap3:                     1
                                bunny_killer:                     1
                                     marielf:                     1
                                   paulonote:                     1
                                 rrbluebells:                     1
                             sheriff_legend2:                     1
                             sheriff_legend1:                     1
                                     golfkey:                     1
                                   ali_money:                     8
                                       pris1:                     1
                                       brskn:                     1
                                      claire:                     1
                                   gar_anger:                     1
                                     marquis:                     1
                                  greenhorne:                     1
                                        jack:                     1
                             arch_apprentice:                     1
                                     robbies:                     1
                                   hannadone:                     1
                                     wolfies:                     1
                              wolf_ear_count:                     4
                            robber_ear_count:                     1
                                       joje1:                     1
                           sheriff_drygulch1:                     1
                               quest_academy:                     1
                                     hintnum:                    69
                                       gordy:                     2
                                  traveller2:                     1
                                  traveller1:                     1
                             smithnailpolish:                     1
                                        zera:                     1
                                gerardquest1:                      
                                gerardquest2:                      
                            royal_wolfhunter:                     1
                                          55:                     1
                                          66:                     1
                                          77:                     1
                                      earnum:                

[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (2/5) ]

     2
                                     player1:                     1
                                 mudschooltp:                     1
                                 appointment:                     1
                                 koboldkills:                    23
                                   koboldrep:                   961
                                   goblinrep:                   967
                                 goblinkills:                    13
                                frenchknight:                     1
                                    petstats:  goldie 92 79 0 0 7 9 0 1 1
                                  fritztask1:                     1
                                      marion:                 21034
                                 dragonscale:                     1
                                   greencoat:                     1
                                   robinhood:                     1
                                robindagdone:                     1
                                          40:                     1
                                          41:                     0
                                          42:                     0
                                          43:                     1
                                          44:                     0
                                          45:                     0
                                       adia2:                     1
                                   mountain1:                     1
                                 bullcatcher:                     1
                                summerville2:                     1
                                summerville1:                     1
                                 saberskill1:                     1
                                  yodataught:                     1
                                 saberskill2:                     1
                                        urnc:                     1
                                  riddlebook:                     1
                                  slotcredit:                     0
                                       count:                     1
                                      augias:                     1
                                       moria:                     1
                                     viagros:                     1
                                     wabeeto:                     1

[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (3/5) ]

                                    overseer:                     1
                                      spiros:                     1
                             calydnosspinner:                     1
                              calydnosweaver:                     1
                                  samothrace:                     1
                                    damiskos:                     1
                                      eunuch:                     4
                                      anaphe:                     1
                                 chiossultan:                     1
                                        syme:                     1
                                  frogstatue:                     1
                                     liqueur:                     1
                                  athosabbot:                     1
                                      nimue1:                     1
                                     bandana:                      
                             lowell1_rocking:                     0
                               prisonerbroth:                     1
                                       bravo:                     9
                                   odysseus1:                     1
                                       ajax2:                     1
                                          99:                     5
                                 gauntlet144:                     1
                                azizi_rescue:                     1
                                      asking:                     1
                                       book1:                     1
                                  baronchest:                     2
                                    anne_yes:                     1
                            child_shoes_done:                      
                        burkeandhare_corpses:                     4
                           lion_house_access:                     1
                                  easter_egg:                     1
                               hween2009four:                     1
                               hween2009five:                     1
                                hween2009two:                     1
                                hween2009cue:                     1
                                hween2009one:                     1
                         hween2009billiards2:                     1
                           failed_apple_bite:                 14

[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (4/5) ]

  
                                  bit_apples:                    43
                                    appleexp:               1296000
                                generalteeth:                     1
                                  enter_quay:                     1
                                    amunplot:                     2

« Last Edit: February 23, 2014, 04:48:52 pm by Molly »

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #21 on: October 19, 2011, 09:26:39 pm »
I completely understand the problem with all the questflags, as I stated, I've got lists of my own that look a lot like those.  But, if we gave people a journal so they could write down what they know, we wouldn't have to deal with the questflags.  At least that's my thought and at least it's some way for them to keep track of things on the game instead of papers that they're constantly losing.  Or maybe that's only me.

Offline Molly

  • Administrator
  • Hero Member
  • *****
  • Posts: 691
    • View Profile
Re: Trigger of the .... something
« Reply #22 on: October 20, 2011, 01:15:24 am »
OK, to be a bit more constructive, here's an idea for how a scripted journal could actually work - at least for the Quests that have a questcard.

Since each Quest would need a unique identity, it would be simplest to just use the number of the Questcard for that.
It would take a bit of an effort on the player's side, to find the number of the quest they got stuck on from a long list, but from the player's point of view that would still be relatively easy.

It would however also take a lot of research to ferret out all the correct flags from the various script files and a lot of scripting to set up the scripts, but at least it is doable.

Step 1
We'd make an object called Quest Journal, which the player can get in the Questor's Office.
The journal itself would be similar for all players, but it has a number of scripts placed on it to check for the correct questflag of whoever is using it, and provide some guidance based on that.

The command 'look journal' would provide the following info:

This journal contains a list of all the Questcards.
First you need to find the number of the quest you are looking for.
Since there are over 100 Questcards, the journal has 7 pages,
and there are 15 quests on each page.
Type 'look Index' to view the Quest numbers on each page.
Type 'look #' (for instance 'look 4') to view the Quests on each page.
*
To find out your status on a certain Quest, you need to first HOLD the Journal.
Then you have to SAY the number of the Quest.
(for instance type 'SAY 5' to check your status on The Enchanted Frogs).


The command 'look index' would give the following list:
INDEX
Page 1. Card 1-15
Page 2. Card 16-30
Page 3. Card 31-45
Page 4. Card 46-60
Page 5. Card 61-75
Page 6. Card 76-90
Page 7. Card 91-105


Then 'look 1' would produce the following result:
1.   Wanted Poster I
2.   Wanted Poster II
3.   Cyrene's lover
4.   Robber Baron's prisoners
5.   The enchanted frogs
6.   Thetis' lover
7.   The Viking Quarrel
8.   The Lady in the Lake
9.   Nimue's quest
10.  The Tower of Rapunzel
11.  The bereaved woman
12.  Chief Arapahoola's Snake Elixir     
13.  The Secret Sword
14.  Llano Estacado
15.  Exoliath's armor

They would still have to look at the actual questcards to get the detailed info on each Quest.

Step 2.

Now we need to make a script - or several scripts - for the journal, based on the questflags that the quests set on the players.

Many of the easier quests just provide some limited stats item, and don't set any questflag. They are fully repeatable, meaning that you can do them over and over again, without any restrictions at all.
And this is also the info you'd get from saying the number of these quests.

However, if they also provide tokens and/or exp, they have a flag check to give a smaller reward after the first time.
The script would check for that flag, and dependant on the result you'd get the following info:
'You haven't completed this Quest yet.'    or
'You've already done this quest, but you can repeat it for a smaller reward.'

Yet others have a check on the item you get, to stop people who haven't done the quest from using the item. But otherwise they are similar to the former category. You can repeat them to get the item, but any exp and or tokens will be a lot less after the first time, so the message should be similar to the above category.

This gives us the beginning of the script:
*
if %arg%|= 1
 if !%actor.varexists(curly)%
  %send% %actor% You haven't completed this Quest yet.
 else
  %send% %actor% You have already done this Quest, but you can repeat it for a smaller reward.
 endif
elseif %arg%|= 2
 if !%actor.varexists(donegan)%
  %send% %actor% You haven't completed this Quest yet.
 else
  %send% %actor% You have already done this Quest, but you can repeat it for a smaller reward.
 endif
elseif (%arg%|= 3) || (%arg%|= 5) || (%arg%|= 6) || (%arg%|= 7)|| (%arg%|= 8 )
  %send% %actor% You can do this Quest as many times as you like.
etc. etc.

*
Then we get to the first problem:
Some of the Questcards have more than one Quest on them.
That is the case with for instance 5. The enchanted frogs and 14. Llano Estacado.
(Llano even has 6 different quests, but 3 of them, 'The legend of the deamon' and the two 'Wanted Posters' have their own questcards).

Anyhow, this problem could be handled by adding subheadings for each Quest on the Questbook, (and possibly also on the actual Questcard, which means additional build work). So the entry for Card 14 in the Questbook would then look like this:

14. Llano Estacado
-   14A The dying man
-   14B The lost medicine pouch
-   14C Jeff and Joe

In this case you'd need to say 14A to get info on that first quest.

Also the script on the journal will obviously be very long, which means that we have to work either with function scripts, or make several different journals, possibly both.

But then we come to the real problem; The multi-step quests. Usually, but not always, these use the same flags throughout the quest.

Let's take Quest 103 'Rebellion against Arthur' as an example. It is a multi step quest that you initiate by talking to the Captain of the Guards. This sets the flag rebellion, which then will increase or decrease dependant on which mobs you talk to.
Dependent on the number on the flag, the mobs will also give different responses.

When the rebellion number reaches 10 it is replaced by the flag reformers, which in turn increases one step for each task you perform.

When the reformers flag reaches 8, you are presented a choice to help either the Rebels or the Captain, by giving an item to either of them.  Choosing the Captain sets the flag reformers 9, while choosing the Rebels sets reformers 10, and in each case you get one last task to perform.

When the last task is done, reformers flag is replaced by the flag done_reformers, which allows you to redo the quest for a smaller reward.

So here is what the script for this single quest would have to look like:


if %arg%|=103
 if %actor.varexists(done_reformers)%
  %send% %actor% You have already completed this quest, but you can repeat it for a smaller reward.
 endif
 if %actor.varexists(rebellion)%
   %send% %actor% You need to talk to more more people to collect more info about the rebellion.
 endif
 if %actor.varexists(reformers)%
  if %actor.reformers% == 1
   %send% %actor% You should go and talk to the Silk Merchant about an assignment.
  elseif %actor.reformers% == 2
   %send% %actor% The Silk Merchant is expecting you to deliver an item to incriminate Morgan le Fay.
  elseif %actor.reformers% == 3
   %send% %actor% The Silk Merchant is expecting you to bring Nicolo Orsini to him.
   %send% %actor% If you've lost the letter, talk to the merchant who'll give you a new one.
  * and so on, until we get to reformers 10
  endif
 endif
endif


And this is just one of a large number of multi-step quests...

One more thing:

Quite often the questflags of a complex Quest get messed up beyond all help. This is sometimes caused by buggy scripts, but more often by players trying to take shortcuts. Another common reason is forgetting where they were in the quest, and starting it from scratch again, which then results in double flags, that make the questmobs refuse to interact with them.

Usually the only feasible way to fix this is to just remove all the flags for that particular quest from the player file. It means they have to start all over from the beginning again, but that's usually not a big problem.

However, rather than having to ask an imm to assist with this - (which is also frustrating for the imm, who has to sift through several pages of flags to find the right one) - we could make the script do it.
The command would be 'reset #', (for instance 'reset 103'), which would make the script check for all but the end flag and then remove them.
Using the Rebellion against Arthur example, the script would be like this:


if (%speech.contains(reset)% && %speech.contains(103)%
 if %actor.varexists(rebellion)%
  rdelete rebellion %actor.id%
 endif
 if %actor.varexists(reformers)%
  rdelete reformers %actor.id%
 endif
endif

 




Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #23 on: December 28, 2011, 12:57:41 pm »
A new trigger!!  Let's shake that magical eightball.  Yeah, I stole it from The Builder's Academy, but Rumble makes such neat triggers.
This one is very well documented on what it does and how, I just thought it had to be here.

Name: 'Obj Command Magic Eight Ball - O47',  VNum: [    6], RNum: [    6]
Trigger Intended Assignment: Objects
Trigger Type: Command , Numeric Arg: 2, Arg list: shake
Commands:
* By Rumble of The Builder Academy    tbamud.com 9091
* Numeric Arg: 2 means in character's carried inventory.
* Command trigs do not work for level 33 and above.
* There are 20 possible answers that the Magic Eight Ball can give.
* Of these, nine are full positive, two are full negative, one is
* mostly positive, three are mostly negative, and five are abstentions.
*
* Check arguments if they match. /= checks abbreviations.
if ball /= %arg% || eightball /= %arg%
  * Echo text to everyone else in the room and the actor.
  %echoaround% %actor% %actor.name% shakes %self.shortdesc% vigorously.
  %send% %actor% You shake %self.shortdesc% vigorously.
  * Use a switch to choose a random response (1-20).
  switch %random.20%
    * Send the answer! %self% is the 8ball, or whatever the trig is attached to.
    * Only the actor sees the answer.
* Case is what we are trying to match. Does %random.20% == 1?
    case 1
      %send% %actor% %self.shortdesc% reveals the answer: Outlook Good
      * We are done with this case so check the next one.
    break
    case 2
      %send% %actor% %self.shortdesc% reveals the answer: Outlook Not So Good
    break
    case 3
      %send% %actor% %self.shortdesc% reveals the answer: My Reply Is No
    break
    case 4
      %send% %actor% %self.shortdesc% reveals the answer: Don't Count On It
    break
    case 5
      %send% %actor% %self.shortdesc% reveals the answer: You May Rely On It
    break
    case 6
      %send% %actor% %self.shortdesc% reveals the answer: Ask Again Later
    break
case 7
      %send% %actor% %self.shortdesc% reveals the answer: Most Likely
    break
    case 8
      %send% %actor% %self.shortdesc% reveals the answer: Cannot Predict Now
    break
    case 9
      %send% %actor% %self.shortdesc% reveals the answer: Yes
    break
    case 10
      %send% %actor% %self.shortdesc% reveals the answer: Yes, definitely
    break
    case 11
      %send% %actor% %self.shortdesc% reveals the answer: Better Not Tell You Now
    break
    case 12
      %send% %actor% %self.shortdesc% reveals the answer: It Is Certain
    break
    case 13
%send% %actor% %self.shortdesc% reveals the answer: Very Doubtful
    break
    case 14
      %send% %actor% %self.shortdesc% reveals the answer: It Is Decidedly So
    break
    case 15
      %send% %actor% %self.shortdesc% reveals the answer: Concentrate And Ask Again
    break
    case 16
      %send% %actor% %self.shortdesc% reveals the answer: Signs Point To Yes
    break
    case 17
      %send% %actor% %self.shortdesc% reveals the answer: My Sources Say No
    break
    case 18
      %send% %actor% %self.shortdesc% reveals the answer: Without A Doubt
    break
    case 19
      %send% %actor% %self.shortdesc% reveals the answer: Reply Hazy, Try Again
break
    case 20
      %send% %actor% %self.shortdesc% reveals the answer: As I See It, Yes
    break
    * Every switch should have a default. A catch-all if the cases do not match.
    default
      %send% %actor% %self.shortdesc% explodes since your question is unanswerable.
    break
    * Every switch must have a done! Just like every if needs an end!
  done
  * The actor didn't use the command shake with arg ball or eightball.
else
  * Return 0 allows the command to continue through to the MUD. The player will
  * get the Huh!?! response or the shake social if you have one.
  return 0
end


Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #24 on: February 18, 2014, 12:07:35 pm »
Trying to get this back up and going again - which means I need to visit TBA mud more often.  I've not checked this trigger to make sure it works in 4Dimensions, but I believe it will - I have something similar to it when I have dragon's fighting.

Name: 'dg_cast fireball',  VNum: [  104], RNum: [  104]
Trigger Intended Assignment: Mobiles
Trigger Type: Fight , Numeric Arg: 100, Arg list: None
Commands:
* By Rumble of The Builder Academy    tbamud.com 9091
* Only cast the spell every 30 seconds.
if %already_cast%
  wait 30 s
  unset already_cast
else
  dg_cast 'fireball' %actor.name%
  set already_cast 1
  * By globalling the variable it can be accessed by other triggers or when
  * this trigger fires a second time.
  global already_cast
end

I do love the fact that Rumble comments everything he does and makes it a whole lot simpler to follow.  Basically, the first time the mob casts the fireball, it sets the variable on the mob already_cast, then it will wait 30 seconds before it is able to cast it again.  If I remember right, dg_cast doesn't give any action lines when the fireball is cast so you can input what you want it to say - whether it's "The great mage Xander casts a fireball at your face" or "The big red dragon breathes a cone of fire in your direction".  I could be wrong on that though so, if using this script - or creating one like it for other spells - you should check it out and see.

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #25 on: February 18, 2014, 12:24:44 pm »
Trying to make up for the fact I hadn't had any of the scripts on here for a while, so here's a second one:

Name: 'Room Entry - sneak check',  VNum: [  306], RNum: [  227]
Trigger Intended Assignment: Rooms
Trigger Type: Enter , Numeric Arg: 25, Arg list: None
Commands:
* By Rumble of The Builder Academy    tbamud.com 9091
if %actor.is_pc%
  if %actor.skill(sneak)% > 50
    %send% %actor% You walk into the room, not waking any of the clerics.
  else
    %send% %actor% Your entry into the room wakes a few of the clerics.
    %load% mob 340
  end
end

Basically any player that's practiced their sneak skill above 50 will be able to walk into the room without waking the clerics.  If your sneak skill isn't that good, well, good luck fighting them off.

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #26 on: February 19, 2014, 06:15:24 pm »
Name: 'Room Drop - Dg_cast for dropping objects by cost',  VNum: [  332], RNum: [  253]
Trigger Intended Assignment: Rooms
Trigger Type: Drop , Numeric Arg: 100, Arg list: None
Commands:
%%send%% %actor% As you drop the %object.shortdesc%, a loud humming starts to come from the walls.
wait 1
eval worth %object.cost% / 100
switch %worth%
  case 0
    %send% %actor% Your offering was NOT sufficient.
    dg_cast 'magic missile' %actor%
    break
  case 1
    %send% %actor% Your offering was just sufficient.
    dg_cast 'cure light' %actor%
    dg_cast 'clot minor' %actor%
    %purge% %object%
    break
    case 2
    %send% %actor% Your offering was sufficient.
    dg_cast 'refresh' %actor%
    %purge% %object%
    break
  default
    %send% %actor% Your offering was as it must be.
    dg_cast 'invisibility' %actor%
    %purge% %object%
    break
done

** An interesting script that allows you to drop objects and the cost of the object decides what spells you'll get cast on you.  If the object doesn't have sufficient cost then you could even be harmed. **

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #27 on: February 20, 2014, 04:11:39 pm »
Name: 'Mob Command - spellcasting test',  VNum: [  312], RNum: [  233]
Trigger Intended Assignment: Mobiles
Trigger Type: Command , Numeric Arg: 100, Arg list: kill
Commands:
* This command trigger will disallow anyone from trying to
* use the kill command, and will toss a magic missile at them
* for trying.
dg_cast 'magic missile' %actor%
return 0

***Interesting idea for a !kill room***

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #28 on: February 22, 2014, 09:02:57 am »
Name: 'Room Command - Anti-quit',  VNum: [  314], RNum: [  235]
Trigger Intended Assignment: Rooms
Trigger Type: Command , Numeric Arg: 100, Arg list: quit
Commands:
   %send% %actor% Powerful forces keep you here.

Name: 'Obj Command - No quit',  VNum: [  315], RNum: [  236]
Trigger Intended Assignment: Objects
Trigger Type: Command , Numeric Arg: 3, Arg list: q
Commands:
if %cmd.mudcommand% == quit
  %send% %actor% Divine forces prevent you from doing that.
else
  return 0
end

**The previous 2 scripts basically do the same thing – don't let the player quit.  One is on the room and one is on an object.  Either way, evil. **

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigger of the .... something
« Reply #29 on: February 23, 2014, 09:58:10 am »
My main reason for putting this next trigger in is to show what to do when the command you want to use is something that is already a basic command in the game.  Things like pull, push, open, throw, or, as in this script, look. 

Name: 'Room Command - Look at Painting',  VNum: [  304], RNum: [  225]
Trigger Intended Assignment: Rooms
Trigger Type: Command , Numeric Arg: 100, Arg list: l
Commands:
* By Rumble of The Builder Academy    tbamud.com 9091
if %cmd.mudcommand% == look && painting /= %arg%
  %send% %actor% As you stare at the painting the figures seem to start moving and acting out the scenes they portray.
  %echoaround% %actor% %actor.name% stares at one of the paintings. A strange look coming over %actor.hisher% face.
else
  * If it doesn't match let the command continue. Without a return 0 a player
  * will not be able to "look" at anything else.
  return 0
end


The reason to put l in the arg list instead of just * is to limit the times this script will trigger.  If you put * in the arg list, it will trigger on any word put in as a command - which is useful if you have more than one command in a script.  If you put l in the arg list, then it'll only trigger when something that starts with l is used as a command: like look, listen, etc.

The return 0 is very important at the end because otherwise the player can't look at anything else - or even just look to refresh the room description.