Building & Scripting > Scripting Board
Trigger of the .... something
Molly:
--- Quote from: Kvetch on March 06, 2014, 07:18:06 pm ---** This would be an interesting script for an area in the Old West – if we don't already have it **
--- End quote ---
Well, we do, of course. Who said we didn't have pirates - I mean everything? :)
There is goldpanning in one of the Sutter zones, I forgot which one.
Probably set up in a different way, but still goldpanning.
Molly:
Here it is:
(There is a mob somewhere to teach the subskill softmining, of course)
Name: 'dip pan water', VNum: [30973], RNum: [ 6335]
Trigger Intended Assignment: Rooms
Trigger Type: Command, Numeric Arg: 100, Arg list: dip
Commands:
if !%actor.is_pc%
halt
end
set sa %send% %actor%
set se %echoaround% %actor%
set object %actor.inventory(30911)%
if !%object%
%sa% With What??!?
halt
end
if (!%actor.subskill(softmining)%)
%sa% You don't know how to do that!
halt
end
if %object.vnum(30911)%
if %actor.varexists(ilana_muffs)%
wait 5s
%sa% You dip a tin pan into the water, scraping it along the bottom of the bed.
wait 5s
%se% %actor.name% dips a tin pan into the water, scraping it along the bottom of the bed.
wait 5s
%sa% You begin to swish the pan as Old Jack demonstrated, slopping some water over the sides.
wait 5s
if (%actor.subskill(softmining)% >= %random.700%)
%sa% Pretty soon, all that remains is a bit of silt and a few pieces of shiny flakes on the bottom of the pan.
wait 2s
%force% %actor% whistle
%load% obj 30992 %actor%
eval am (%actor.level%*(%actor.subskill(softmining)%+1500+%random.200%))
nop %actor.exp(%am%)%
wait 1s
%sa% You've successfully collected a few flakes of an undetermined substance!
else
%sa% Pretty soon, all that remains is a bit of silt on the bottom of the pan.
wait 2s
%force% %actor% frown
wait 1s
%sa% You look and look in the bottom of the pan, but nary a fleck of gold can be seen!
wait 2s
%sa% You were unsuccessful! Try again!
end
else
%sa% You don't know what you are doing!
end
else
%sa% You can't do it with that!
end
Kvetch:
It has been a while since I posted so, here's another one. I grabbed it a little too late for Valentines day, but it would have rocked if I'd seen it earlier. Maybe next year. Hope I haven't posted this yet. I'm too lazy to go through all the old posts to see.
Name: 'Eat, look, read, candy', VNum: [ 1309], RNum: [ 382]
Trigger Intended Assignment: Objects
Trigger Type: Command , Numeric Arg: 2, Arg list: *
Commands:
if look /= %cmd.mudcommand% && heart /= %arg% && %arg% || read /= %cmd.mudcommand% && heart /= %arg% && %arg% || read /= %cmd.mudcommand% && candy /= %arg% && %arg% || look /= %cmd.mudcommand% && candy /= %arg% && %arg%
*
eval color %random.3%
set col[1] \
set col[2] \
set col[3] \
*
eval colors %%col[%color%]%%
*
eval heart %random.15%
set love[1] Be Mine
set love[2] I Love You
set love[3] I Wuv You
set love[4] Kiss Me
set love[5] Hug Me
set love[6] Be My Valentine
set love[7] Will You Be Mine
set love[8] You Are The Only One For Me
set love[9] I'm yours
set love[10] You're Special To Me
set love[11] I Really Like You
set love[12] I Luv U
set love[13] U R Mine
set love[14] With All My Heart
set love[15] Cutie Pie
eval candy %%love[%heart%]%%
*
%send% %actor% Written on the candy is:
%send% %actor% %colors% %candy% \
*
elseif eat /= %cmd.mudcommand% && heart /= %arg% && %arg% || eat /= %cmd.mudcommand% && candy /= %arg% && %arg%
*
eval message %random.10%
set word[1] It warms the cockles of your heart!
set word[2] It tastes wonderful!
set word[3] It melts in your mouth.
set word[4] It slowly disolves in your mouth.
set word[5] It tastes sweet and a little chalky.
set word[6] Mmmmm!
set word[7] You can feel the love!
set word[8] You feel warmer already!
set word[9] Mmm hearty goodness!
set word[10] Sweet like candy!
eval msg %%word[%message%]%%
*
%send% %actor% You eat %self.shortdesc%.
%echoaround% %actor% %actor.name% eats %self.shortdesc%.
%send% %actor% %msg%
%purge% self
*
else
return 0
end
Calypso:
I may snag this and work on it in bp soon so it is ready when we need it next time. Thanks for the great idea!! :)
erwin:
Trigger of the Day:
A sliding puzzle, which can be modified for any m*n grid, and for any tile description. It also has a visually impaired toggle. I think this is interesting because it:
1. shows how to extract the first and second words the player types after entering a command and
2. shows what %%var%% and %%%var%%% do
Set up: Here's (part of) what the player sees when he looks at the object.
"puzzle board" - See the current layout of the board
"puzzle move up" - Move a tile up into the empty space.
"puzzle move down" - Move a tile down into the empty space.
"puzzle move left" - Move a tile left into the empty space.
"puzzle move right" - Move a tile right into the empty space.
"puzzle rules" - See the rules of this puzzle.
"puzzle toggle" - Toggle for visually impaired.
and below is the trigger! If anyone has any suggestions on how to improve this, it's much appreciated :)
--- Code: ---Trigger Intended Assignment: Objects
Trigger Type: Command, Numeric Arg: 3, Arg list: puzzle
Commands:
extract firstphrase 1 %arg%
extract secondphrase 2 %arg%
if !%coordinatex%
set coordinatex 4
remote coordinatex %self.id%
endif
if !%coordinatey%
set coordinatey 4
remote coordinatey %self.id%
endif
if !%Cord11%
set Cord11 01
remote Cord11 %self.id%
endif
if !%Cord12%
set Cord12 02
remote Cord12 %self.id%
endif
if !%Cord13%
set Cord13 03
remote Cord13 %self.id%
endif
if !%Cord14%
set Cord14 04
remote Cord14 %self.id%
endif
if !%Cord21%
set Cord21 05
remote Cord21 %self.id%
endif
if !%Cord22%
set Cord22 06
remote Cord22 %self.id%
endif
if !%Cord23%
set Cord23 07
remote Cord23 %self.id%
endif
if !%Cord24%
set Cord24 08
remote Cord24 %self.id%
endif
if !%Cord31%
set Cord31 09
remote Cord31 %self.id%
endif
if !%Cord32%
set Cord32 10
remote Cord32 %self.id%
endif
if !%Cord33%
set Cord33 11
remote Cord33 %self.id%
endif
if !%Cord34%
set Cord34 12
remote Cord34 %self.id%
endif
if !%Cord41%
set Cord41 13
remote Cord41 %self.id%
endif
if !%Cord42%
set Cord42 14
remote Cord42 %self.id%
endif
if !%Cord43%
set Cord43 15
remote Cord43 %self.id%
endif
if !%Cord44%
set Cord44 EE
remote Cord44 %self.id%
endif
if %firstphrase% == toggle && !%secondphrase%
if !%visimp% || %visimp% == 0
set visimp 1
%send% %actor% You are toggling this puzzle to cater to the visually impaired.
remote visimp %self.id%
elseif %visimp% == 1
set visimp 0
%send% %actor% You are toggling this puzzle to cater to the non visually impaired.
remote visimp %self.id%
endif
elseif %firstphrase% == rules && !%secondphrase%
%send% %actor% This is a sliding puzzle game, and you want to get the following layout in the end.
if !%visimp% || %visimp% == 0
%send% %actor% -------------------------
%send% %actor% | | | | |
%send% %actor% | 01 | 02 | 03 | 04 |
%send% %actor% | | | | |
%send% %actor% -------------------------
%send% %actor% | | | | |
%send% %actor% | 05 | 06 | 07 | 08 |
%send% %actor% | | | | |
%send% %actor% -------------------------
%send% %actor% | | | | |
%send% %actor% | 09 | 10 | 11 | 12 |
%send% %actor% | | | | |
%send% %actor% -------------------------
%send% %actor% | | | | |
%send% %actor% | 13 | 14 | 15 | EE |
%send% %actor% | | | | |
%send% %actor% -------------------------
%send% %actor%
%send% %actor% EE denotes the empty space.
elseif %visimp% == 1
%send% %actor% 01, 02, 03, 04
%send% %actor% 05, 06, 07, 08
%send% %actor% 09, 10, 11, 12
%send% %actor% 13, 14, 15, EE
%send% %actor%
%send% %actor% EE denotes the empty space.
endif
elseif %firstphrase% == board && !%secondphrase%
%send% %actor% This is the current board layout.
if !%visimp% || %visimp% == 0
set border -------------------------
set inbet | | | | |
%send% %actor% %border%
%send% %actor% %inbet%
%send% %actor% | %Cord11% | %Cord12% | %Cord13% | %Cord14% |
%send% %actor% %inbet%
%send% %actor% %border%
%send% %actor% %inbet%
%send% %actor% | %Cord21% | %Cord22% | %Cord23% | %Cord24% |
%send% %actor% %inbet%
%send% %actor% %border%
%send% %actor% %inbet%
%send% %actor% | %Cord31% | %Cord32% | %Cord33% | %Cord34% |
%send% %actor% %inbet%
%send% %actor% %border%
%send% %actor% %inbet%
%send% %actor% | %Cord41% | %Cord42% | %Cord43% | %Cord44% |
%send% %actor% %inbet%
%send% %actor% %border%
elseif %visimp% == 1
%send% %actor% %Cord11%, %Cord12%, %Cord13%, %Cord14%
%send% %actor% %Cord21%, %Cord22%, %Cord23%, %Cord24%
%send% %actor% %Cord31%, %Cord32%, %Cord33%, %Cord34%
%send% %actor% %Cord41%, %Cord42%, %Cord43%, %Cord44%
endif
elseif %firstphrase% == move
if %secondphrase% == down
*let's check if we can move anything down into the empty square
if %coordinatex% == 1
%send% %actor% You cannot move anything down into the empty space!
else
*let's see what tile should be moved down
eval newx %coordinatex% -1
eval tiletomove Cord%newx%%coordinatey%
endif
elseif %secondphrase% == up
*let's check if we can move anything up into the empty square
if %coordinatex% == 4
%send% %actor% You cannot move anything up into the empty space!
else
eval newx %coordinatex% + 1
eval tiletomove Cord%newx%%coordinatey%
endif
elseif %secondphrase% == right
*let's check if we can move anything right into the empty square
if %coordinatey% == 1
%send% %actor% You cannot move anything right into the empty space!
else
eval newy %coordinatey% - 1
eval tiletomove Cord%coordinatex%%newy%
endif
elseif %secondphrase% == left
*let's check if we can move anything left into the empty square
if %coordinatey% == 4
%send% %actor% You cannot move anything left into the empty space!
else
eval newy %coordinatey% + 1
eval tiletomove Cord%coordinatex%%newy%
endif
else
%send% %actor% This is not a valid move command. As a reminder, the board looks like this.
endif
*Check if previously we had a valid move. Means variable %tiletomove% must exist
if %tiletomove%
eval emptytile Cord%coordinatex%%coordinatey%
eval tmp1 %%%tiletomove%%%
eval tmp2 %%tiletomove%%
eval tmp3 %%emptytile%%
*update coordinates respectively
if %newx%
set coordinatex %newx%
elseif %newy%
set coordinatey %newy%
endif
set %tmp2% EE
set %tmp3% %tmp1%
remote coordinatex %self.id%
remote coordinatey %self.id%
*Here, we are actually updating the variable cordXY
remote %tmp2% %self.id%
remote %tmp3% %self.id%
endif
if !%visimp% || %visimp% == 0
set border -------------------------
set inbet | | | | |
%send% %actor% %border%
%send% %actor% %inbet%
%send% %actor% | %Cord11% | %Cord12% | %Cord13% | %Cord14% |
%send% %actor% %inbet%
%send% %actor% %border%
%send% %actor% %inbet%
%send% %actor% | %Cord21% | %Cord22% | %Cord23% | %Cord24% |
%send% %actor% %inbet%
%send% %actor% %border%
%send% %actor% %inbet%
%send% %actor% | %Cord31% | %Cord32% | %Cord33% | %Cord34% |
%send% %actor% %inbet%
%send% %actor% %border%
%send% %actor% %inbet%
%send% %actor% | %Cord41% | %Cord42% | %Cord43% | %Cord44% |
%send% %actor% %inbet%
%send% %actor% %border%
elseif %visimp% == 1
%send% %actor% %Cord11%, %Cord12%, %Cord13%, %Cord14%
%send% %actor% %Cord21%, %Cord22%, %Cord23%, %Cord24%
%send% %actor% %Cord31%, %Cord32%, %Cord33%, %Cord34%
%send% %actor% %Cord41%, %Cord42%, %Cord43%, %Cord44%
endif
else
%send% %actor% This is not a valid puzzle command.
return 1
end
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version