!library
!asl-version <400>
'parameter1 = MasterObject name
'parameter2 = Location to create it
define procedure <CloneObject>
set string <pn1; $parameter(1)$>
set string <pn2; >
set string <pn3; $parameter(2)$>
set numeric <pn1; 0>
set numeric <pn2; 0>
repeat until ( %pn2% = 1 ) {
inc <pn1>
set string <pn2; #pn1#_%pn1%>
if not real <#pn2#> then {
inc <pn2>
if type <#pn1#; Item> then clone <#pn1#; #pn2#; #pn3#> else clone <#pn1#; #pn2#; #quest.currentroom#>
}
else {
if ( $locationof(#pn2#)$ = scrapyard ) then {
inc <pn2>
do <RepairObject(#pn2#)>
msg < Object found in scrapyard (#pn2#).>
if type <#pn2#; Item> then move <#pn2#; #pn3#> else move <#pn2#; #quest.currentroom#>
}
}
}
end define
'parameter1 = object to repair
define procedure <RepairObject>
' execute all repairs here, such as object condition and inherited types, etc.
' would be great if there were a 'for each property on <#object#>' or 'for each action on <#object#>'
'IE
'
'set string <object; $parameter(1)$>
'set string <master; #(object):master#>
'
'for each property on <#object#> {
'
' if property <#master#; #quest.property#> then property <#object#; #quest.property# = $objectproperty(#master#; #quest.property#)$> else property <#object#; not #quest.property#>
'
'}
'
'for each property on <#master#> {
'
' property <#object#; #quest.property# = $objectproperty(#master#' #quest.property#)$>
'}
'
'same for actions, with a #quest.action# built-in string
'same for types, with a #quest.type# built-in string
end define
define room <scrapyard>
end define startscript {
set string <props[1]; hp>
set string <props[2]; mp>
set string <props[3]; fire>
set string <props[4]; effect>
...
}set string <obj1; deafult_obj_1>
set string <obj2; scrapped_obj_1>
for <iter;1;$ubound(props)$> {
property <#obj2#; #props[iter]#=$objectproperty(#obj1#:#props[iter]#)$>
}for <iter;1;$ubound(props)$> {
set string <property.value; $objectproperty(#obj1#;#props[iter]#)$>
if ( #property.value# = ! ) then {
if property <#obj1#;#props[iter]#> then _
property <#obj2#; #props[iter]#>
}
else property <#obj2#; #props[iter]#=$objectproperty(#obj1#:#props[iter]#)$>
}...as I'm sure you can imagine.
Right... First off, how have you done properties such as "flammable" (I'd guess "poison" or "slow" are also effects/properties like these).
if property <#obj1#;#props[iter]#> then _
property <#obj2#; #props[iter]#> _
else _
property <#obj2#; not #props[iter]#>From Linus Torvalds.. I actually think it's quite right.I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships.