Preview game

paul_one
08 May 2007, 16:03
Right,

I'm creating a little preview which has at the moment 4 rooms and about 5 objects.

This will grow, please be aware this is a work in progress!

What I would love is if some people (the more the merrier) could download this, and give more suggestions on what is helpful.
Even if you think it's stupid - it will help out.

linky:
<invalid>

Once I am able to get a suitable amount of work done on this, then I will start on my small IF game later on in the summer, or early autumn.

Elexxorine
09 May 2007, 08:00
Link's not working...

paul_one
09 May 2007, 10:03
Yeah, the link's to my home PC - and I turned it off to sleep..

Here's the full code;
[updated below]

paul_one
09 May 2007, 10:04
=============
.. Ok, indenting *FINALLY* works now...
=============

paul_one
17 Jul 2007, 12:26
Just solved indenting..

Took me a while, but it suddenly came to me today - using |xn you can output a string with spaces, and indent a line.. So now I can proceed...
Where the hell was I with this?

Elexxorine
17 Jul 2007, 12:40
It's shaping up Tron. Good work, lolz.

paul_one
04 Aug 2007, 00:45
Ok peeps, I don't care if anyone likes indenting with directions now - I love them, and so does the guy working next to me.. That's enough for me!

Altered bottle a tiny bit too.. It used to be so if you typed one of these:

hit bottle with bottle
hit bottle with bottle, hit bottle

and selected green bottle for them - that you'd have weird things happen (green bottle hitting and breaking the green bottle :S). Works sensibly now though.

paul_one
11 Aug 2007, 09:25
This is now the current preview.asl:
' Preview to see how the system can deal with
' stuff nicely.
' Including nice default error messages, good responses, descriptions, and general level of interactivity.
' containers, surfaces, items, exits and rooms too.
' Created by Tr0n²

!include <common.qlb>

define game <Preview>
asl-version <400>
gametype singleplayer
start <start>
game version <0.15>
game author <Tr0n²>
game info <A simple IF game, previewing the interactive level.>

properties <posture=standing>

startscript {
set string <one; yes>
set string <two; yes>
set string <three; no>
}
command <t.f1> flag on <mirror_in_use>
command <t.f11> flag off <mirror_in_use>
command <t.f2> flag on <darkness>
command <t.f22> flag off <darkness>
command <t.in> debug <$indent(lets see here!|nthis should|ncome out|nas lines; 3)$>
command <t.in2> debug <$indent(this should.|ncome out even.|further out!; 20)$ >
command <t.last> msg <#quest.lastcommand#>

end define

define room <start>
alias <Wooded Glade>
prefix <a>
look <You are all alone, tree's surround you, the grass is soft under your shoes and the morning light is dripping into the hole above you.>

comand <yell;shout;cry out> {
exec <yell; normal>
msg <The surrounding bushes seem to shuffle and look at you suspiciously.>
}

define object <treestump>
alias <Treestump>
alt <stump;treest>
prefix <a>
look <The Oak Treestump looks like it is old, and many carvings are on the top.>
type <surface>

list empty exec <look at carvings>
properties <kick=You kick the Treestump in frustration, and then limp around for a few seconds.>

end define

define object <carvings>
alt <wooden carvings;enscriptions;markings>
prefix <the>
alias <Carvings>
look <Some of the carvings are so old you can't make out if they were faces or rude pictures - possibly both.. Others are more recent.|nYou see |b"I will love you always.."|xb >
parent <treestump>
properties <invisible>

end define

define object <trees>
alt <tree;woods;branches;leaves;glade>
prefix <the>
alias <trees>
look <You look at the trees surrounding you, they all appear to be more or less the same.|nThere are breaks in the circle to the north, east and south.>
properties <invisible>

end define

define object <gbottle>
alt <bottle;green b;g bottle;btl>
alias <Green Bottle>
look <An empty green bottle.>
type <bottle>

properties <gender=him>

end define

define object <rbottle>
alt <bottle;red b;rbottle;btl>
alias <Red Bottle>
look <An empty red bottle.>
type <bottle>

end define

define object <boot>
alt <boot;shoe;heel>
alias <Leather Boot>
look <A leather boot, slightly scuffed and worn - but smells of dandylions!>
type <object>

end define

define object <feather>
properties <soft>
end define

north <room3>
east <room4>
south <room2>

end define

define room <room2>
alias <Small Beaten Path>
prefix <a>
look <This small beaten path seems to wind Southwards through the trees..>

define object <beatenpath>
alias <Path>
alt <beaten path;small path;small beaten path;ground;floor;dirt;_
bracken;twigs;sticks>
prefix <the>
look <You look at the small beaten pathway between the trees. Twigs lay like green or brown worms over the lighter dirt path.>

properties <invisible>
end define

north <start>
end define

define room <room3>
alias <Dusty Road>
prefix <a>
look <The dusty road appears to drift off Northwards, deviding the fields that lay ahead into two as if some god had half heartedly started to saw through the land and just given up after marking it.>

define object <dustyroad>
alias <Road>
alt <dusty road;road;ground;floor;dirt>
prefix <the>
look <The road is quite wide, and shows some grass in patches, like mini-islands in a sea of sand. Greenery grows either side, giving the fields beyond them boundaries, presumably to stop the road from consuming the rest.>

properties <invisible>
end define

south <start>
end define

define room <room4>
alias <Cobbled Road>
prefix <a>
look <The cobbles here are small and black bubbles on the floor. It heads off Eastwards towards a small town.>

define object <cobbles>
alt <cobbles;cobble;ground;road;floor>
alias <Cobbles>
prefix <the>
look <The cobbles under your feet look at if they were a black substance poured over a collection of large marbles.. They have the effect that any coach with circular wheels travelling along it either quickly evolves webbed wheels - or develops

properties <invisible>
end define

west <start>
end define

paul_one
11 Aug 2007, 09:33
=============
Fixed some issues,
(**)
verbs using prefix looked nasty (you don't want to sit on a treestump).
(**) added sit, yell, shout, look at, climb, jump, cry, some violent stuff (which I've said "don't be so graphical"), stop, get up (from sitting down).
I'M THE BEST EVER!
with this library you can now type "kick it" and then type the name of the object afterwards, to make it do that... I'm so bloody clever!
(**) hitting bottle with bottle now works correctly. Seems like a horrible botch to me.. Wish someone would have a look at the bottle type and see if they can come up with something cleaner..
.. fixed the breaking stuff - but this is very much a WIP!! .. verbs no longer work because I've put a default rule in there.. I wish Quest handled commands nicer - perhaps put verbs FIRST.
.. and what is exec <;normal> actually used for? because as far as I can see - it's only useful if you're using a room-specific action? Is that right? Since it means verbs are still ignored.
I've jiggled things about, like an exotic dancer, and have re-invented the verb-wheel.
I think I need to work on jumping off things a tiny bit..
[*MOVED*]
=============

This is now the common library:

common.qlb
below

paul_one
29 Aug 2007, 17:31
WOW, fixed ALOT of stuff here.
putting objects on other objects broke because I used a rubbish command.
Also, Quest doesn't handle quest.command properly (I thought it was supposed to be after objects were resolved etc?).


!library
!asl-version <400>
!Common library to give room descriptions, and default answers to many commands.
!Created by Tr0n²

!addto game

startscript {
panes off
set string <directions[0]; north>
set string <directions[1]; northeast>
set string <directions[2]; northwest>
set string <directions[3]; east>
set string <directions[4]; west>
set string <directions[5]; southeast>
set string <directions[6]; south>
set string <directions[7]; southwest>
set string <directions[8]; up>
set string <directions[9]; down>

set string <desc.rnd1[0]; in what seems to be,>
set string <desc.rnd1[1]; in>
set string <desc.rnd1[2]; in, what could be called,>
set string <desc.rnd1[3]; inside, what you can only call,>
set string <desc.rnd1[4]; inside>
set string <desc.rnd1[5]; , looking around>
set string <desc.rnd1[6]; in the middle of>

set string <desc.rnd2[0]; It looks like you can go;>
set string <desc.rnd2[1]; You see that you can go;>
set string <desc.rnd2[2]; The exits surrounding you are;>
set string <desc.rnd2[3]; You may go;>
set string <desc.rnd2[4]; You're torn for choice, you can go;>

set string <desc.rnd3[0]; to>
set string <desc.rnd3[1]; toward>
set string <desc.rnd3[2]; which is>
set string <desc.rnd3[3]; into>

}

description {
set numeric <desc.rnd1; $rand(0;6)$ >
msg <You are |cg#game:posture#|cb _
#desc.rnd1[desc.rnd1]# _
#(quest.currentroom):prefix# _
|cr#(quest.currentroom):alias#|cb >

if ( $left(#quest.command#;1)$ = l) or _
not property <#quest.currentroom#; been_here> then {
msg <#quest.lookdesc#>
property <#quest.currentroom#; been_here>
if not ( #quest.formatobjects# = ) then msg <You can see #quest.formatobjects# here. >
}

set numeric <desc.rnd1; $rand(0;4)$ >
msg <#desc.rnd2[desc.rnd1]#>
for <loop.1; 0; 9> {
if not ( $objectproperty(#quest.currentroom#; #directions[loop.1]#)$ = ! ) then {
set string <direction.name; $objectproperty(#quest.currentroom#; #directions[loop.1]#)$ >
set numeric <desc.rnd1; $rand(0;3)$ >
msg <$indent(|cl#directions[loop.1]#|cb #desc.rnd3[desc.rnd1]# #(direction.name):prefix# |cr#(direction.name):alias#|cb|xn; 6)$,>
}
}
}

afterturn set string <quest.lastcommand; #quest.command#>

error <badthing; You don't see anything like that here..>
error <badcommand; $badcommand$>
error <badgo; It doesn't seem like you can go there..>
error <defaultout; It doesn't seem like you can go there..>
error <badgive; You decide that you are a deserving owner, and give to yourself.. You are pleased with your new gift.>
error <badplace; It doesn't seem like you can go there..>
error <badpronoun; $badit$>
error <badput; You put it into your own hand..>
error <badtake; You think about it, but decide that you can do without such an item..>
error <baduse; You try to use it, but can't quite figure out |ihow|xi to..>
error <defaultuse; You try to use it, but can't quite figure out |ihow|xi to..>
error <cantdrop; You can't get rid of that!>
error <cantclose; You try your best, but it just won't close..>
error <cantopen; You try your best, but it just won't open..>
error <cantremove; You try your best, but you can't remove that..>
error <cantput; You think that there are better places to put things then |ithere|xi..>
error <defaultspeak; You suddenly feel something is wrong with you speaking to that..>
error <noitem; You can't do that if you don't have it first..>
error <itemunwanted; You decide it's better to hang onto it..>

' This is taken from stdverbs.lib, for standard compatibility..
' Edited a little because the actions were blurring together
command <#cmn.command#. #cmn.command2#; _
#cmn.command#, and then #cmn.command2#; _
#cmn.command#, then #cmn.command2#; _
#cmn.command#, #cmn.command2#; _
#cmn.command# and then #cmn.command2#; _
#cmn.command# then #cmn.command2#> {
msg <|n|cg|b$symbol(gt)$ #cmn.command#|cb|xb>
exec <#cmn.command#>
pause <500>
if ( $instr(#cmn.command2#;,)$ = 0 ) and _
( $instr(#cmn.command2#;_then_)$ = 0 ) then _
msg <|n|cg|b$symbol(gt)$ #cmn.command2#|xb|cb>
exec <#cmn.command2#>
}

command <look on #@object#;look at #@object#> _
exec <look at #@object#; normal>
command <look at #@object# with #@something#;_
look at #@object# in #@something#;_
look down #@object# with #@something#;_
look in #@object# with #@something#;_
look in #@object# using #@something#> {
msg <You angle the #@something# just right, look into it, and see..>
if property < #something#; reflective > then {
flag on <mirror_in_use>
exec <look at #@object#>
flag off <mirror_in_use>
}
else _
exec <look at #@something#>
}
command <look around> _
exec <look>
command <look into #@object#> _
exec <look in #@object#>
command <look at ground> _
if here <$getobjectname(ground)$> then _
exec <look at ground; normal> _
else _
msg <You look at your feet, suddenly feeling bashful..>
command <look at sky> _
if here <$getobjectname(sky)$> then _
exec <look at sky; normal> _
else _
msg <You look up, letting your mind wander for a few moments..>
command <look #look.direction#ward;_
look #look.direction#wards;_
look #look.direction#> {
for <look.loop; 0; 9> _
if ( #look.direction# = #directions[look.loop]# ) and _
not ( $objectproperty(#quest.currentroom#; #look.direction#)$ = ! ) then _
flag on <look_direction>
if flag <look_direction> then {
set string <look.direction.name; $objectproperty(#quest.currentroom#; #look.direction#)$ >
msg <You see the #(look.direction.name):alias# ..>
flag off <look_direction>
}
else _
select case <#look.direction#> {
case <down> _
exec <look at ground>
case <up> _
exec <look at sky>
case else _
exec <look #look.direction#; normal>
}
}

command <go #direction#;_
n;north;ne;northeast;e;east;se;southeast;_
s;south;sw;southwest;w;west;nw;northwest;_
u;up;d;down> _
select case <#game:posture#> {
case <standing; crouching; crawling; limping; crying> _
exec <#quest.originalcommand#; normal>
case else _
msg <You can't do that while you're #game:posture#..>
}
command <put #@object# and #@object2# and #object3# on #@last_object#; _
put #@object#, #@object2# and #object3# on #@last_object#; _
put #@object# and #@object2# on #@last_object#> _
exec <put #@object# on #@last_object#, put #@object2# on #@last_object#, put #@object3# on #@last_object#>
command <put #@object# on #@last_object#> _
exec <put #@object# on #@last_object#; normal>

command <sit down; sit up;sit> _
debug <SIT_$posture_change(sit down;sitting;You sit down on the ground and rest..)$>
command <stand up;stand> _
debug <STAND_$posture_change(stand;standing;You stand up, brushing your legs for no real reason.)$>
command <lay down;lay;sleep> _
if ( $posture_change(lay down;laying;|xn)$ = SUCC ) then {
msg <You lay down, spread your legs out, and |xn>
if ( $rand(1;10)$ = 5 ) then _
msg <|cr`OUCH!`|cb hit your head!> _
else _
msg <lay down with your hands behind your head.>
}
command <jump> _
select case <$posture_test(laying)$> {
case <SUCC; FAIL> _
debug <JUMP_$posture_change(jump;laying;You leap into the air, spread your arms and - fall flat on your face!|nYou are now lying on the ground.)$>
case <SAME> _
exec <stand up, jump>
}

command <cry;sob> _
debug <CRY_$posture_change(cry;crying;Your vision goes blurry and there's a sparkle in your stomach as you start to cry.)$>
command <don't cry;stop crying> _
debug <STOP_CRY$posture_change(stop crying;#game:old_posture#;You dry your eyes and give a poor sniffle as you stop crying.)$>
command <stomp; stamp> _
if ( $posture_change(stamp;standing;)$ = FAIL ) then _
msg <You stomp around like a small child, waving your arms.>

command <cut throat;cut throat #stuff#;_
slit throat;slit throat #stuff#;_
maime;maime #stuff#> _
msg <You don't need to be so graphical! Try attack, hit or kick.>
command <die> _
msg <You think about jumping from a tall building for a second or two - imagining the rush of air and the sense of freedom that would come - and then snap back to reality.>
command <yell;shout;cry out> _
msg <You yell at the top of your voice..>

command <stop> _
if ( #game:posture# = crying ) then _
exec <stop crying> _
else _
msg <Stop what?>
command <get up> _
select case <#game:posture#> {
case <sitting;laying> _
exec <stand up>
case <hanging> _
exec <go up>
case else _
msg <Get up where?>
}

command <help> _
msg <Have a walk around, try out some things.|n_
Send in some suggestions about commands which would be helpful, or nice.|n_
debug commands:|n _
|cgt.f1|cb Flag 1 - set mirror flag on.|n _
|cgt.f11|cb Flag 1 - set mirror flag off.|n _
|cgt.f2|cb Flag 2 - set darkness flag on.|n _
|cgt.f22|cb Flag 2 - set darkness flag off.|n _
|cgt.in|cb Indent test.|n _
|cgt.in2|cb Indent test 2.|n_
room descriptions don't (yet?) take darkness into account.>

command <wait> _
msg <You step back and watch time roll by..>
command <xyzzy> _
msg <"|cgAZEEZEE|cb..." You cry out..|n_
"..cseezzy.. exy-zee? .. exize?"|n_
You ponder how it should be pronounced and forget why you said it in the first place..>

command <#t.command# #@object# with #@something#;_
#t.command# #@object# using #@something#;_
#t.command# #@object# on with #@something#;_
#t.command# #@object# on #@something#;_
#t.command# #@object# at #@something#;_
#t.command# #@object# into #@something#;_
#t.command# #@object# in #@something#;_
#t.command# on #@object# with #@something#;_
#t.command# on #@object#;_
#t.command# onto #@object#;_
#t.command# over #@object#;_
#t.command# up #@object#;_
#t.command# off #@object# with #@something#;_
#t.command# off #@object#;_
#t.command# #@object# on;_
#t.command# #@object# off with #@something#;_
#t.command# #@object# off;_
#t.command# #@object#> _
select case <#t.command#> {
case <break; smash; crush; stomp; stamp; climb; _
drink; sip; quaff; swig; eat; nibble; munch; _
scoff; consume; hit; jump; leap; kick; kill; _
murder; kiss; smooch; punch; pinch; sit; throw; _
turn; step> {

if action < #object#; #t.command# > then _
doaction <#object#; #t.command#> _
elseif property < #object#; #t.command# > then _
msg <$objectproperty(#object#;#t.command#)$> _
else _
select case <#t.command#> {
case <break; smash; crush; stomp; stamp> _
msg <You figure that breaking the #(quest.lastobject):alias# isn't the right thing to do.>
case <climb> _
msg <You can't climb the #(quest.lastobject):alias#>
case <drink; sip; quaff; swig> _
msg <You can't drink that.>
case <eat; nibble; munch; scoff; consume> _
msg <You don't want to eat that.>
case <hit; attack; hurt> {
msg <You decide hitting |xn>
if ( #(quest.lastobject):gender# = ! ) then _
msg <it |xn> _
else _
msg <#(quest.lastobject):gender# |xn>
msg <would be a bad choice.>
}
case <jump; leap> _
msg <You can't jump that!>
case <kick> _
msg <You don't have the courage to kick the #(quest.lastobject):alias#..>
case <kill; murder> _
if ( #(object):gender# = him ) or ( #(object):gender# = her ) then _
msg <You decide that killing #(object):gender# is the wrong thing to do..> _
else _
msg <Can you actually kill #(object):prefix# #(object):alias#!?>
case <kiss; smooch> _
msg <You stare, your eyes misted over as you play the kiss over in your mind..>
case <punch> _
msg <You imagine your fist flying through the air, and then reality snaps back into place..>
case <pinch> _
msg <You sqeeze your fingers together, but decide you look silly and immediately stop.>
case <sit> {
msg <You'd rather not sit on |xn>
if ( #(quest.lastobject):gender# = ! ) then _
msg <it.> _
else _
msg <#(quest.lastobject):gender#.>
}
case <step> _
msg <Your feet are more comfortable where they are.>
case <throw> _
msg <You position yourself carefully, but then decide you'd rather not..>
case <turn> {
msg <You try to find a way to turn the #(quest.lastobject):alias#|xn>
if ( $instr(#quest.command#;_on)$ > 0 ) then _
msg < on|xn> _
elseif ( $instr(#quest.command#;_off)$ > 0 ) then _
msg < off|xn>
msg <, but can't quite figure out how you could.>
}
}
}
case else _
exec <#quest.command# ;normal>
}


!end

define synonyms
yourself; myself; me; you = self
n = north
n, = north,
s = south
s, = south,
e = east
e, = east,
w = west
w, = west,
ne = northeast
ne, = notheast,
nw = northwest
nw, = northwest,
se = southeast
se, = southeast,
sw = southwest
sw, = southwest,
l = look
l, = look,
i; inv = inventory
i,; inv, = inventory,
end define

define type <surface>
container
surface
add
remove

action <list> {
msg <On the #@object# you see |xn>
set string <t.cont.list; >
set numeric <t.cont.count; 0>
for each object in <#quest.currentroom#> {
if ( #(quest.thing):parent# = #object# ) and _
not property <#quest.thing#; invisible> then {
set string <t.cont.list; #t.cont.list# #(quest.thing):prefix# |b#(quest.thing):alias#|xb,>
set string <t.cont.last; #(quest.thing):prefix# |b#(quest.thing):alias#|xb>
inc <t.cont.count>
}
}
if ( %t.cont.count% > 1 ) then {
set numeric <t.cont.pos; $instr(#t.cont.list#;, #t.cont.last#)$ - 1>
set string <t.cont.list; $left(#t.cont.list#;%t.cont.pos%)$ and #t.cont.last#.>
}
else {
set numeric <t.cont.pos; $lengthof(#t.cont.list#)$ - 1>
set string <t.cont.list; $left(#t.cont.list#;%t.cont.pos%)$.>
}
msg <#t.cont.list#>
}
end define

define type <object>
gender=it
prefix=a
take

end define

define type <bottle>
type <object>

action <hit> doaction <$thisobject$; break>
action <smash> doaction <$thisobject$; break>
action <break> {
set string <thisobject; $thisobject$>
if property < #thisobject#; broken > or ( #something# = #object# ) then _
msg <You can't break it twice!> _
elseif property < #something#; soft > then _
msg <That wouldn't break the #@thisobject#!> _
else {
if ( #something# = #thisobject# ) then _
msg <The #@thisobject# also smashes..> _
elseif ( #something# = ) then _
msg <You smash the #@thisobject# on the ground and break the bottom off.. It is now sharp where it is broken.> _
else {
msg <You smash the #@object# using the #@something#, and see the it break.>
debug <#something#>
}
property <$thisobject$; alias=Broken #(thisobject):alias#; look=It used to be:|n |i#(thisobject):look#|xi|nIt is now broken, and has sharp edges.;broken>
if property < #something#; fragile > and _
not ( $thisobject$ = #something# ) and _
not property < #something#; broken > then _
doaction < #something#; break >
}
set string <something; >
}

properties <fragile>

end define

define room <inventory>

define object <self>
look {
select case <$look_desc$> {
case <0> _
msg <You look down at your body, and see that you haven't changed too much since you last looked. You look well built and you feel comfortable in the jeans and t-shirt you're wearing.>
case <1> _
msg <You pull some funny faces and wink in the mirror, pulling a quick smirk from your bag of facial expressions. After some serious thought, you adjust a few strands of hair, and smile..|nYou feel quite comfortable with your looks.>
case <2> _
msg <You stare in the darkness down at yourself.>
case <3> _
msg <You stare in the darkness at #@something#.. You can't even see it, let alone yourself!>
}
}
properties <invisible>
end define

end define

define function <look_desc>
set numeric <t.look.return; 0>
if flag <mirror_in_use> then inc <t.look.return>
if flag <darkness> then inc <t.look.return; 2>

return <%t.look.return%>
end define

define function <badcommand>
if not ( $instr(#quest.lastcommand#;_it)$ = 0 ) and _
flag <t.badit> then _
exec <#t.badit.first# #quest.command#> _
else _
msg <You try, but realise you don't know how!>
flag off <t.badit>

end define

define function <badit>
set numeric <t.badit.pos; $instr(#quest.originalcommand#;_it)$ >
set string <t.badit.first; $left(#quest.originalcommand#;%t.badit.pos%)$ >
flag on <t.badit>

return <#t.badit.first# what?>
end define

define function <posture_change>
' $posture_change(description_for_action; posture_to_change_to; message_to_print_to_screen)$
' Return = SUCC | SAME | FAIL

set string <t.pos.action; $parameter(1)$>
set string <t.pos.posture; $parameter(2)$>
set string <t.pos.message; $parameter(3)$>
set string <t.pos.return; $posture_test(#t.pos.posture#)$>

select case <#t.pos.return#> {
case <FAIL> _
msg <You can't #t.pos.action# while you're #game:posture#.>
case <SAME> _
msg <You are already #game:posture#.>
case <SUCC> {
msg <#t.pos.message#>
property <game; old_posture=#game:posture#; posture=#t.pos.posture#>
}
}

return <#t.pos.return#>

' select case <#game:posture#> {
' case <stuck;trapped;caught> _
' msg <You can't #t.pos.action# while you're #game:posture#.>
' case <#t.pos.posture#> _
' msg <You are already #game:posture#>
' case <crying> _
' if ( #t.pos.posture# = #game:old_posture# ) then _
' set string <t.pos.return; SUCC> _
' else _
' msg <You're crying too hard to do that..>
' case else _
' set string <t.pos.return; SUCC>
' }

' if ( #t.pos.return# = SUCC ) then {
' msg <#t.pos.message#>
' property <game; old_posture=#game:posture#; posture=#t.pos.posture#>
' }

return <#t.pos.return#>

end define

define function <posture_test>
' $posture_test(posture_to_change_to)$
' Return = SUCC | SAME | FAIL

set string <t.postst.return; FAIL>
set string <t.postst.same; $parameter(1)$>
select case <#game:posture#> {
case <stuck;trapped;caught> _
msg <|xn>
case <#t.postst.same#> _
set string <t.postst.return; SAME>
case <crying> _
if ( $parameter(1)$ = #game:old_posture# ) then _
set string <t.postst.return; SUCC>
case else _
set string <t.postst.return; SUCC>
}
return <#t.postst.return#>

end define

define function <indent>
' Pass string, and indent value.. $indent(#string#, %value%)$
' Returns indented string.

set string <indent.output; BLANK>
set string <indent.string; $parameter(1)$ >
set numeric <indent.depth; $parameter(2)$ >
set numeric <indent.loop; 1>

repeat while ( %indent.loop% < $lengthof(#indent.string#)$ ) {
if ( $mid(#indent.string#;%indent.loop%;2)$ = |n ) then {
dec <indent.loop>
set string <indent.output; $left(#indent.string#;%indent.loop%)$>
inc <indent.loop; 3>
set string <indent.string; $mid(#indent.string#; %indent.loop%)$>
set numeric <indent.loop; 0>
}
if ( (%indent.loop%+1) = $lengthof(#indent.string#)$ ) then {
set string <indent.output; #indent.string#>
}
if not ( #indent.output# = BLANK ) then {
for <indent.loop2; 1; %indent.depth%> _
msg < |xn>
msg <#indent.output#>
set string <indent.output; BLANK>
}
inc <indent.loop>
}

end define

Elexxorine
29 Oct 2007, 14:21
Meep....... just meep....

paul_one
30 Oct 2007, 17:54
Yeah, no more added to this yet..

Won't be until I get bored enough to get back to it - I'm keeping myself busy with other stuff which is actually rewarding.

Freak
20 Jan 2008, 21:41
I played briefly, but discovered that "TAKE BOTTLE" will show the disambiguation prompt twice. Following that up with "DROP BOTTLE" will have a prompt, even though it is unnecessary.

paul_one
21 Jan 2008, 10:02
Yes, I really hate those.
I'll hate to re-examine what my code's going.

paul_one
22 Jan 2008, 13:28
Thanks Freak.

I did a little digging and changed my code a little for4 the common.qlb:
Executing take object will only ask once now - although I still don't like the way I've had to deal with re-inventing verbs.

Dropping the bottle isn't fixed yet - I'll hard-code that later.
Maybe also hard-code take (because surely you don't want to identify a bottle which you don't have over a bottle you DO have).

!library
!asl-version <400>
!Common library to give room descriptions, and default answers to many commands.
!Created by Tr0n²

!addto game

startscript {
panes off
set string <directions[0]; north>
set string <directions[1]; northeast>
set string <directions[2]; northwest>
set string <directions[3]; east>
set string <directions[4]; west>
set string <directions[5]; southeast>
set string <directions[6]; south>
set string <directions[7]; southwest>
set string <directions[8]; up>
set string <directions[9]; down>

set string <desc.rnd1[0]; in what seems to be,>
set string <desc.rnd1[1]; in>
set string <desc.rnd1[2]; in, what could be called,>
set string <desc.rnd1[3]; inside, what you can only call,>
set string <desc.rnd1[4]; inside>
set string <desc.rnd1[5]; , looking around>
set string <desc.rnd1[6]; in the middle of>

set string <desc.rnd2[0]; It looks like you can go;>
set string <desc.rnd2[1]; You see that you can go;>
set string <desc.rnd2[2]; The exits surrounding you are;>
set string <desc.rnd2[3]; You may go;>
set string <desc.rnd2[4]; You're torn for choice, you can go;>

set string <desc.rnd3[0]; to>
set string <desc.rnd3[1]; toward>
set string <desc.rnd3[2]; which is>
set string <desc.rnd3[3]; into>

}

description {
set numeric <desc.rnd1; $rand(0;6)$ >
msg <You are |cg#game:posture#|cb _
#desc.rnd1[desc.rnd1]# _
#(quest.currentroom):prefix# _
|cr#(quest.currentroom):alias#|cb >

if ( $left(#quest.command#;1)$ = l) or _
not property <#quest.currentroom#; been_here> then {
msg <#quest.lookdesc#>
property <#quest.currentroom#; been_here>
if not ( #quest.formatobjects# = ) then msg <You can see #quest.formatobjects# here. >
}

set numeric <desc.rnd1; $rand(0;4)$ >
msg <#desc.rnd2[desc.rnd1]#>
for <loop.1; 0; 9> {
if not ( $objectproperty(#quest.currentroom#; #directions[loop.1]#)$ = ! ) then {
set string <direction.name; $objectproperty(#quest.currentroom#; #directions[loop.1]#)$ >
set numeric <desc.rnd1; $rand(0;3)$ >
msg < |cl#directions[loop.1]#|cb #desc.rnd3[desc.rnd1]# #(direction.name):prefix# |cr#(direction.name):alias#|cb,>
}
}
}

afterturn {
set string <quest.lastcommand; #quest.command#>
set string <object; >
}

error <badthing; You don't see anything like that here..>
error <badcommand; $badcommand$>
error <badgo; It doesn't seem like you can go there..>
error <defaultout; It doesn't seem like you can go there..>
error <badgive; You decide that you are a deserving owner, and give to yourself.. You are pleased with your new gift.>
error <badplace; It doesn't seem like you can go there..>
error <badpronoun; $badit$>
error <badput; You put it into your own hand..>
error <badtake; You think about it, but decide that you can do without such an item..>
error <baduse; You try to use it, but can't quite figure out |ihow|xi to..>
error <defaultuse; You try to use it, but can't quite figure out |ihow|xi to..>
error <cantdrop; You can't get rid of that!>
error <cantclose; You try your best, but it just won't close..>
error <cantopen; You try your best, but it just won't open..>
error <cantremove; You try your best, but you can't remove that..>
error <cantput; You think that there are better places to put things then |ithere|xi..>
error <defaultspeak; You suddenly feel something is wrong with you speaking to that..>
error <noitem; You can't do that if you don't have it first..>
error <itemunwanted; You decide it's better to hang onto it..>

' This is taken from stdverbs.lib, for standard compatibility..
' Edited a little because the actions were blurring together
command <#cmn.command#. #cmn.command2#; _
#cmn.command#, and then #cmn.command2#; _
#cmn.command#, then #cmn.command2#; _
#cmn.command#, #cmn.command2#; _
#cmn.command# and then #cmn.command2#; _
#cmn.command# then #cmn.command2#> {
msg <|n|cg|b$symbol(gt)$ #cmn.command#|cb|xb>
exec <#cmn.command#>
pause <500>
if ( $instr(#cmn.command2#;,)$ = 0 ) and _
( $instr(#cmn.command2#;_then_)$ = 0 ) then _
msg <|n|cg|b$symbol(gt)$ #cmn.command2#|xb|cb>
exec <#cmn.command2#>
}

command <look around> _
exec <look>
command <look into #@object#> _
exec <look in #@object#>
command <look at ground> _
if here <$getobjectname(ground)$> then _
exec <look at ground; normal> _
else _
msg <You look at your feet, suddenly feeling bashful..>
command <look at sky> _
if here <$getobjectname(sky)$> then _
exec <look at sky; normal> _
else _
msg <You look up, letting your mind wander for a few moments..>
command <look on #@object#;look at #@object#> _
exec <look at #@object#; normal>
command <look at #@object# with #@something#;_
look at #@object# in #@something#;_
look down #@object# with #@something#;_
look in #@object# with #@something#;_
look in #@object# using #@something#> {
msg <You angle the #@something# just right, look into it, and see..>
if property < #something#; reflective > then {
flag on <mirror_in_use>
exec <look at #@object#>
flag off <mirror_in_use>
}
else _
exec <look at #@something#>
}
command <look #look.direction#ward;_
look #look.direction#wards;_
look #look.direction#> {
for <look.loop; 0; 9> _
if ( #look.direction# = #directions[look.loop]# ) and _
not ( $objectproperty(#quest.currentroom#; #look.direction#)$ = ! ) then _
flag on <look_direction>
if flag <look_direction> then {
set string <look.direction.name; $objectproperty(#quest.currentroom#; #look.direction#)$ >
msg <You see the #(look.direction.name):alias# ..>
flag off <look_direction>
}
else _
select case <#look.direction#> {
case <down> _
exec <look at ground>
case <up> _
exec <look at sky>
case else _
exec <look #look.direction#; normal>
}
}

command <go #direction#;_
n;north;ne;northeast;e;east;se;southeast;_
s;south;sw;southwest;w;west;nw;northwest;_
u;up;d;down> _
select case <#game:posture#> {
case <standing; crouching; crawling; limping; crying> _
exec <#quest.originalcommand#; normal>
case else _
msg <You can't do that while you're #game:posture#..>
}
command <put #@object# and #@object2# and #object3# on #@last_object#; _
put #@object#, #@object2# and #object3# on #@last_object#; _
put #@object# and #@object2# on #@last_object#> _
exec <put #@object# on #@last_object#, put #@object2# on #@last_object#, put #@object3# on #@last_object#>
command <put #@object# on #@last_object#> _
exec <put #@object# on #@last_object#; normal>

command <sit down; sit up;sit> _
debug <SIT_$posture_change(sit down;sitting;You sit down on the ground and rest..)$>
command <stand up;stand> _
debug <STAND_$posture_change(stand;standing;You stand up, brushing your legs for no real reason.)$>
command <lay down;lay;sleep> _
if ( $posture_change(lay down;laying;|xn)$ = SUCC ) then {
msg <You lay down, spread your legs out, and |xn>
if ( $rand(1;10)$ = 5 ) then _
msg <|cr`OUCH!`|cb hit your head!> _
else _
msg <lay down with your hands behind your head.>
}
command <jump> _
select case <$posture_test(laying)$> {
case <SUCC; FAIL> _
debug <JUMP_$posture_change(jump;laying;You leap into the air, spread your arms and - fall flat on your face!|nYou are now lying on the ground.)$>
case <SAME> _
exec <stand up, jump>
}

command <cry;sob> _
debug <CRY_$posture_change(cry;crying;Your vision goes blurry and there's a sparkle in your stomach as you start to cry.)$>
command <don't cry;stop crying> _
debug <STOP_CRY$posture_change(stop crying;#game:old_posture#;You dry your eyes and give a poor sniffle as you stop crying.)$>
command <stomp; stamp> _
if ( $posture_change(stamp;standing;)$ = FAIL ) then _
msg <You stomp around like a small child, waving your arms.>

command <cut throat;cut throat #stuff#;_
slit throat;slit throat #stuff#;_
maime;maime #stuff#> _
msg <You don't need to be so graphical! Try attack, hit or kick.>
command <die> _
msg <You think about jumping from a tall building for a second or two - imagining the rush of air and the sense of freedom that would come - and then snap back to reality.>
command <yell;shout;cry out> _
msg <You yell at the top of your voice..>

command <stop> _
if ( #game:posture# = crying ) then _
exec <stop crying> _
else _
msg <Stop what?>
command <get up> _
select case <#game:posture#> {
case <sitting;laying> _
exec <stand up>
case <hanging> _
exec <go up>
case else _
msg <Get up where?>
}

command <help> _
msg <Have a walk around, try out some things.|n_
Send in some suggestions about commands which would be helpful, or nice.|n_
debug commands:|n _
|cgt.f1|cb Flag 1 - set mirror flag on.|n _
|cgt.f11|cb Flag 1 - set mirror flag off.|n _
|cgt.f2|cb Flag 2 - set darkness flag on.|n _
|cgt.f22|cb Flag 2 - set darkness flag off.|n _
|cgt.in|cb Indent test.|n _
|cgt.in2|cb Indent test 2.|n_
room descriptions don't (yet?) take darkness into account.|n|n_
Commands known about:|n _
break; smash; crush; stomp; stamp; climb; _
drink; sip; quaff; swig; eat; nibble; munch; _
scoff; consume; hit; jump; leap; kick; kill; _
murder; kiss; smooch; punch; pinch; sit; throw; _
turn; step>

command <wait> _
msg <You step back and watch time roll by..>
command <xyzzy> _
msg <"|cgAZEEZEE|cb..." You cry out..|n_
"..cseezzy.. exy-zee? .. exize?"|n_
You ponder how it should be pronounced and forget why you said it in the first place..>

command <#t.command# #@object# with #@something#;_
#t.command# #@object# using #@something#;_
#t.command# #@object# on with #@something#;_
#t.command# #@object# on #@something#;_
#t.command# #@object# at #@something#;_
#t.command# #@object# into #@something#;_
#t.command# #@object# in #@something#;_
#t.command# on #@object# with #@something#;_
#t.command# on #@object#;_
#t.command# onto #@object#;_
#t.command# over #@object#;_
#t.command# up #@object#;_
#t.command# off #@object# with #@something#;_
#t.command# off #@object#;_
#t.command# #@object# on;_
#t.command# #@object# off with #@something#;_
#t.command# #@object# off;_
#t.command# #@object#;_
#t.command#> _
select case <#t.command#> {
case <break; smash; crush; stomp; stamp; climb; _
drink; sip; quaff; swig; eat; nibble; munch; _
scoff; consume; hit; jump; leap; kick; kill; _
murder; kiss; smooch; punch; pinch; sit; throw; _
turn; step> {

if action < #object#; #t.command# > then _
doaction <#object#; #t.command#> _
elseif property < #object#; #t.command# > then _
msg <$objectproperty(#object#;#t.command#)$> _
elseif ( #object# = ) then _
msg <#t.command# what?> _
else _
select case <#t.command#> {
case <break; smash; crush; stomp; stamp> _
msg <You figure that breaking the #(quest.lastobject):alias# isn't the right thing to do.>
case <climb> _
msg <You can't climb the #(quest.lastobject):alias#>
case <drink; sip; quaff; swig> _
msg <You can't drink that.>
case <eat; nibble; munch; scoff; consume> _
msg <You don't want to eat that.>
case <hit; attack; hurt> {
msg <You decide hitting |xn>
if ( #(quest.lastobject):gender# = ! ) then _
msg <it |xn> _
else _
msg <#(quest.lastobject):gender# |xn>
msg <would be a bad choice.>
}
case <jump; leap> _
msg <You can't jump that!>
case <kick> _
msg <You don't have the courage to kick the #(quest.lastobject):alias#..>
case <kill; murder> _
if ( #(object):gender# = him ) or ( #(object):gender# = her ) then _
msg <You decide that killing #(object):gender# is the wrong thing to do..> _
else _
msg <Can you actually kill #(object):prefix# #(object):alias#!?>
case <kiss; smooch> _
msg <You stare, your eyes misted over as you play the kiss over in your mind..>
case <punch> _
msg <You imagine your fist flying through the air, and then reality snaps back into place..>
case <pinch> _
msg <You sqeeze your fingers together, but decide you look silly and immediately stop.>
case <sit> {
msg <You'd rather not sit on |xn>
if ( #(quest.lastobject):gender# = ! ) then _
msg <it.> _
else _
msg <#(quest.lastobject):gender#.>
}
case <step> _
msg <Your feet are more comfortable where they are.>
case <throw> _
msg <You position yourself carefully, but then decide you'd rather not..>
case <turn> {
msg <You try to find a way to turn the #(quest.lastobject):alias#|xn>
if ( $instr(#quest.command#;_on)$ > 0 ) then _
msg < on|xn> _
elseif ( $instr(#quest.command#;_off)$ > 0 ) then _
msg < off|xn>
msg <, but can't quite figure out how you could.>
}
}
}
case else _
exec <#t.command# #@object#; normal>
}

' command <#t.command# ;#t.command#> select case <#t.command#> {
' case <break; smash; crush; stomp; stamp; climb; _
' drink; sip; quaff; swig; eat; nibble; munch; _
' scoff; consume; hit; jump; leap; kick; kill; _
' murder; kiss; smooch; punch; pinch; sit; throw; _
' turn; step> _
' msg <#t.command# what?>
' case else _
' exec <#quest.command#; normal>
' }



!end

define synonyms
yourself; myself; me; you = self
n = north
n, = north,
s = south
s, = south,
e = east
e, = east,
w = west
w, = west,
ne = northeast
ne, = notheast,
nw = northwest
nw, = northwest,
se = southeast
se, = southeast,
sw = southwest
sw, = southwest,
l = look
l, = look,
i; inv = inventory
i,; inv, = inventory,
end define

define type <surface>
container
surface
add
remove

action <list> {
msg <On the #@object# you see |xn>
set string <t.cont.list; >
set numeric <t.cont.count; 0>
for each object in <#quest.currentroom#> {
if ( #(quest.thing):parent# = #object# ) and _
not property <#quest.thing#; invisible> then {
set string <t.cont.list; #t.cont.list# #(quest.thing):prefix# |b#(quest.thing):alias#|xb,>
set string <t.cont.last; #(quest.thing):prefix# |b#(quest.thing):alias#|xb>
inc <t.cont.count>
}
}
if ( %t.cont.count% > 1 ) then {
set numeric <t.cont.pos; $instr(#t.cont.list#;, #t.cont.last#)$ - 1>
set string <t.cont.list; $left(#t.cont.list#;%t.cont.pos%)$ and #t.cont.last#.>
}
else {
set numeric <t.cont.pos; $lengthof(#t.cont.list#)$ - 1>
set string <t.cont.list; $left(#t.cont.list#;%t.cont.pos%)$.>
}
msg <#t.cont.list#>
}
end define

define type <object>
gender=it
prefix=a
take

end define

define type <bottle>
type <object>

action <hit> doaction <$thisobject$; break>
action <smash> doaction <$thisobject$; break>
action <break> {
set string <thisobject; $thisobject$>
if property < #thisobject#; broken > or ( #something# = #object# ) then _
msg <You can't break it twice!> _
elseif property < #something#; soft > then _
msg <That wouldn't break the #@thisobject#!> _
else {
if ( #something# = #thisobject# ) then _
msg <The #@thisobject# also smashes..> _
elseif ( #something# = ) then _
msg <You smash the #@thisobject# on the ground and break the bottom off.. It is now sharp where it is broken.> _
else {
msg <You smash the #@object# using the #@something#, and see the it break.>
debug <#something#>
}
property <$thisobject$; alias=Broken #(thisobject):alias#; look=It used to be:|n |i#(thisobject):look#|xi|nIt is now broken, and has sharp edges.;broken>
if property < #something#; fragile > and _
not ( $thisobject$ = #something# ) and _
not property < #something#; broken > then _
doaction < #something#; break >
}
set string <something; >
}

properties <fragile>

end define

define room <inventory>

define object <self>
look {
select case <$look_desc$> {
case <0> _
msg <You look down at your body, and see that you haven't changed too much since you last looked. You look well built and you feel comfortable in the jeans and t-shirt you're wearing.>
case <1> _
msg <You pull some funny faces and wink in the mirror, pulling a quick smirk from your bag of facial expressions. After some serious thought, you adjust a few strands of hair, and smile..|nYou feel quite comfortable with your looks.>
case <2> _
msg <You stare in the darkness down at yourself.>
case <3> _
msg <You stare in the darkness at #@something#.. You can't even see it, let alone yourself!>
}
}
properties <invisible>
end define

end define

define function <look_desc>
set numeric <t.look.return; 0>
if flag <mirror_in_use> then inc <t.look.return>
if flag <darkness> then inc <t.look.return; 2>

return <%t.look.return%>
end define

define function <badcommand>
if not ( $instr(#quest.lastcommand#;_it)$ = 0 ) and _
flag <t.badit> then _
exec <#t.badit.first# #quest.command#> _
else _
msg <You try, but realise you don't know how!|xn>
flag off <t.badit>

end define

define function <badit>
set numeric <t.badit.pos; $instr(#quest.originalcommand#;_it)$ >
set string <t.badit.first; $left(#quest.originalcommand#;%t.badit.pos%)$ >
flag on <t.badit>

return <#t.badit.first# what?>
end define

define function <posture_change>
' $posture_change(description_for_action; posture_to_change_to; message_to_print_to_screen)$
' Return = SUCC | SAME | FAIL

set string <t.pos.action; $parameter(1)$>
set string <t.pos.posture; $parameter(2)$>
set string <t.pos.message; $parameter(3)$>
set string <t.pos.return; $posture_test(#t.pos.posture#)$>

select case <#t.pos.return#> {
case <FAIL> _
msg <You can't #t.pos.action# while you're #game:posture#.>
case <SAME> _
msg <You are already #game:posture#.>
case <SUCC> {
msg <#t.pos.message#>
property <game; old_posture=#game:posture#; posture=#t.pos.posture#>
}
}

return <#t.pos.return#>

' select case <#game:posture#> {
' case <stuck;trapped;caught> _
' msg <You can't #t.pos.action# while you're #game:posture#.>
' case <#t.pos.posture#> _
' msg <You are already #game:posture#>
' case <crying> _
' if ( #t.pos.posture# = #game:old_posture# ) then _
' set string <t.pos.return; SUCC> _
' else _
' msg <You're crying too hard to do that..>
' case else _
' set string <t.pos.return; SUCC>
' }

' if ( #t.pos.return# = SUCC ) then {
' msg <#t.pos.message#>
' property <game; old_posture=#game:posture#; posture=#t.pos.posture#>
' }

return <#t.pos.return#>

end define

define function <posture_test>
' $posture_test(posture_to_change_to)$
' Return = SUCC | SAME | FAIL

set string <t.postst.return; FAIL>
set string <t.postst.same; $parameter(1)$>
select case <#game:posture#> {
case <stuck;trapped;caught> _
msg <|xn>
case <#t.postst.same#> _
set string <t.postst.return; SAME>
case <crying> _
if ( $parameter(1)$ = #game:old_posture# ) then _
set string <t.postst.return; SUCC>
case else _
set string <t.postst.return; SUCC>
}
return <#t.postst.return#>

end define

steve the gaming guy
22 Jan 2008, 20:00
Wow, you ARE bloody clever..and I don't normally use the adjective, bloody!
Is this part of the code changing the property of the room as "been_here" so when you come back to the room, you get a different room description? If so, that's awesome!

if ( $left(#quest.command#;1)$ = l) or _
not property <#quest.currentroom#; been_here> then {
msg <#quest.lookdesc#>
property <#quest.currentroom#; been_here>
if not ( #quest.formatobjects# = ) then msg <You can see #quest.formatobjects# here. >

paul_one
23 Jan 2008, 16:39
Haha, cheers steve.

Yes, Quest has a slight defect in the way it handles it's own property of 'visited' (it's really set as soon as you set-foot in there, so even if it's a NEW place, your code always thinks you've been here before!).

So I put in a been_here property.

The description gets kicked off everytime you type "look" (of course the first character (left(;1)) is 'l'..) and it doesn't really matter if the property get's set again.
I thought the objects being printed out all the time were a good thing to do.

Next time you come in it doesn't print out too much of the description - but yes, I think I'll change that to print out a short description... If I remember, the classical IF's don't print out everything unless verbosity is set.