Building & Scripting > Scripting Board
Trigger of the .... something
Kvetch:
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: ---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%
--- End code ---
Kvetch:
This is Mord's OLC style journal
--- Code: ---
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
--- End code ---
Kvetch:
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
Molly:
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.
Molly:
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
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version