Axe Software Forums
  Quest Developer Forum
  A bit of a mystery...


Author Topic:   A bit of a mystery...
I think Im Back posted 29-03-2003 08:43 GMT     
Ok, so I already found a way around this problem, but I ran into it and thought it might be nice to know how to solive it legitimately. This is part of the Combat System Demo I'm making. No real mechanics are included as I'm still deciding on forumlas and such, but I've been setting up being able to hold weapons, wield them, etc... I came across this problem after deciding to create procedures to check for items before trying to pick them up with either hand and move them to the corresponding room(which if I didn't do it with procedures it errored quest, even with qdk generated code, so I found a way around it). The problem is this,

When using a procedure to first check if the item is in the room, then if it is 'take-able', then if it IS 'take-able' running the next procedure to check if either hand is empty and grab it with the empty one if applicable, the second procedure would always ignore that the right hand was already occupied, and just over-write the property saying it was occupied and place it in the corresponding right hand room. Now see, when using a command to take the place of the second procedure this doesn't happen, all things go off without a hitch. So my solution was to simply have the first procedure execute a command of the exact same code as the second procedure contained, but still I thought it would be interesting to see if any of you could find where the error was and what caused it...

Ok, code now follows. I'm having to re-edit in the error, so hopefully all goes well.

!!!!!!!CODE!!!!!!!

' "Combat System Demo"

define game <Quest Beta Environment>
asl-version <310>
start <arena>
game info <Version: Beta .01>
error <badcommand; I don't understand what you typed.>
error <badthing; I could not find what you were referring to.>
error <badplace; You can't go there.>
error <itemunwanted; Your offer has been declined.>
error <defaultuse; I don't understand what you typed.>
error <cantdrop; For some reason you can't drop that.>
error <noitem; I could not find what you were referring to.>
error <badexamine; What is it you would like to examine?>
error <badgo; You can't go there.>
error <baduse; I don't understand what you typed.>
error <badgive; Give to whom?>
error <badtake; You can't pick that up.>
error <baditem; I could not find what you were referring to.>
error <baddrop; You are not holding that.>
error <badpronoun; I could not find what you were referring to.>
error <defaultout; You can't go there.>
server start script
background <black>
foreground <white>
'specifies room appearance
description {
msg <[$objectproperty(#quest.currentroom#;title)$]>
msg <#quest.lookdesc#>
if not is <#quest.formatobjects#;> then msg <You see #quest.formatobjects#.>
if not is <#quest.doorways.dirs#;> then msg <Obvious exits: #quest.doorways.dirs#> else msg <Obvious exits: none>
}
define synonyms
get; grab; pick up = take
end define
server startscript

player startscript {
create room <player%userid%-r-hand>
property <player%userid%-r-hand; held=null>
create room <player%userid%-l-hand>
property <player%userid%-l-hand; held=null>
set string <name; $name(%userid%)$>
property <player%userid%; name=$capfirst(#name#)$>
property <player%userid%; race=Human>
property <player%userid%; look=You see $objectproperty(player%userid%; name)$ the $objectproperty(player%userid%; race)$.|n>
property <player%userid%; STR=$rand(20;100)$>
property <player%userid%; CON=$rand(20;100)$>
property <player%userid%; DEX=$rand(20;100)$>
property <player%userid%; INT=$rand(20;100)$>
property <player%userid%; WIS=$rand(20;100)$>
property <player%userid%; AUR=$rand(20;100)$>
property <player%userid%; CHA=$rand(20;100)$>
property <player%userid%; DIS=$rand(20;100)$>
msg <The command STATS will give you randomized new stats. The INFO command will view your current stats.|n>
}
command <look #@target-object#> do <look>
command <loo #@target-object#> do <look>
command <lo #@target-object#> do <look>
command <l #@target-object#> do <look>
command <take #@target-object#> do <take-check>
command <get #@target-object#> do <take-check>
command <grab #@target-object#> do <take-check>
command <drop #target-object#> do <drop>
command <stats> {
property <player%userid%; STR=$rand(20;100)$>
property <player%userid%; CON=$rand(20;100)$>
property <player%userid%; DEX=$rand(20;100)$>
property <player%userid%; INT=$rand(20;100)$>
property <player%userid%; WIS=$rand(20;100)$>
property <player%userid%; AUR=$rand(20;100)$>
property <player%userid%; CHA=$rand(20;100)$>
property <player%userid%; DIS=$rand(20;100)$>
msg <Your Stats are now...|n|nStrength - $objectproperty(player%userid%; STR)$|nConstitution - $objectproperty(player%userid%; CON)$|nDexterity - $objectproperty(player%userid%; DEX)$|nIntelligence - $objectproperty(player%userid%; INT)$|nWisdom - $objectproperty(player%userid%; WIS)$|nAura - $objectproperty(player%userid%; AUR)$|nCharisma - $objectproperty(player%userid%; CHA)$|nDiscipline - $objectproperty(player%userid%; DIS)$|n>
}
command <info> {
msg <Statistics|n---------------|nStrength - $objectproperty(player%userid%; STR)$|nConstitution - $objectproperty(player%userid%; CON)$|nDexterity - $objectproperty(player%userid%; DEX)$|nIntelligence - $objectproperty(player%userid%; INT)$|nWisdom - $objectproperty(player%userid%; WIS)$|nAura - $objectproperty(player%userid%; AUR)$|nCharisma - $objectproperty(player%userid%; CHA)$|nDiscipline - $objectproperty(player%userid%; DIS)$|n>
}
command <warp to #target-room#> if exists <#target-room#> then {
msg <You focus intently on your destination and begin to plane shift.|n>
goto <#target-room#>
}
else msg <You are unable to grasp an image of your destination.|n>
end define

define room <arena>
look <Massive stone walls surround you on all sides forming the octogon you stand in. The dirt beneath your feet is hard packed and riddled with traces of footsteps, all around you see remnants of skin and bones.>
properties <title=The Arena>
define object <rack>
alias <rack>
properties <look=The rusty old weapons rack is covered with chips and scratches but still stands strong. Hung on the rack you notice a sword, spear, axe and club.|n>
end define
define object <sword>
alias <sword>
properties <take; prefix=a bone pommelled; look=It appears to be an everyday sword but fitted with a bone pommel.|n>
end define
define object <club>
alias <club>
properties <take; prefix=a heavy iron; suffix=| covered with deadly spikes; look=The club appears very sturdy and quite dangerous.|n>
end define
end define

define room <storage>
look <This room contains all character sheets created in the game.>
properties <title=The Store Room>
end define

define procedure <take-check> if here <#target-object#> then {
if property <#target-object#; take> then do <take-do> else msg <You cannot take that.|n>}
else msg <I could not find what you were referring to.|n>
end define
define procedure <take-do> if ( $objectproperty(player%userid%-r-hand; held)$ = null ) then {
move <#target-object#; player%userid%-r-hand>
property <player%userid%-r-hand; held=#target-object#>
msg <You pick up the #target-object# with your right hand.|n>
}
else {
if ( $objectproperty(player%userid%-l-hand; held)$ = null ) then {
move <#target-object#; player%userid%-l-hand>
property <player%userid%-l-hand; held=#target-object#>
msg <You pick up the #target-object# with your left hand.|n>
}
else msg <Both of your hands are full.|n>
}
end define
define procedure <look> if here <$getobjectname(#target-object#)$> then {
if property <$getobjectname(#target-object#)$;look> then {
set string <look-target; $getobjectname(#target-object#)$>
msg <$objectproperty(#look-target#;look)$|n>
}
else msg <You notice nothing in particular special about the $getobjectname(#target-object#)$.|n>
}
else msg <I could not find what you were referring to.|n>
end define
define procedure <drop> if ( $objectproperty(player%userid%-r-hand; held)$ = #target-object# ) then {
move <#target-object#; #quest.currentroom#>
property <player%userid%-r-hand; held=null>
msg <You drop the #target-object# in your right hand.|n>
}
else {if ( $objectproperty(player%userid%-l-hand; held)$ = #target-object# ) then {
move <#target-object#; #quest.currentroom#>
property <player%userid%-l-hand; held=null>
msg <You drop the #target-object# in your left hand.|n>
}
else msg <You are not holding that.|n>}
end define

That's it... I'm almost a million percent positive it's exactly as it was. Now let's see if my superiors can figure out what's wrong with it.

I think Im Back posted 29-03-2003 08:48 GMT          
That certainly doesn't make my syntax look well formatted does it? Oh well.