Error? Bug? Screw-up on my behalf?
Christopher
22 Feb 2005, 06:02For some reason this piece of code crashes QDK when I try and look at it. However, it actually works perfectly when I run the game. I don't really need to edit it anymore or anything, but I'd like to known why it was doing this...
One other small thing, one section of code that checks the character's stats and sets them according to base stat, temp bonuses, armour and weapons is so long and repetious that Quest pauses for about 2 seconds when it runs. Is there any way to avoid this?
define procedure <equip something>
if property <#item#; body> then {
msg <#@target# equips the #@item#.>
if ( #(target):armour_body# <> none ) then show <#(target):armour_body#>
property <#target#; armour_body=#item#>
hide <#item#>
do <calculate stats>
}
if property <#item#; shield> then {
if not property <#(target):weapon#; two-handed> {
msg <#@target# equips the #@item#.>
if ( #(target):armour_shield# <> none ) then show <#(target):armour_shield#>
property <#target#; armour_shield=#item#>
hide <#item#>
do <calculate stats>
}
else msg <You can't use a shield with a two-handed weapon.>
}
if property <#item#; glove> then {
msg <#@target# equips the #@item#.>
if ( #(target):armour_glove# <> none ) then show <#(target):armour_glove#>
property <#target#; armour_glove=#item#>
hide <#item#>
do <calculate stats>
}
if property <#item#; helm> then {
msg <#@target# equips the #@item#.>
if ( #(target):armour_helm# <> none ) then show <#(target):armour_helm#>
property <#target#; armour_helm=#item#>
hide <#item#>
do <calculate stats>
}
if property <#item#; accessory> then {
msg <#@target# equips the #@item#.>
if ( #(target):armour_accessory# <> none ) then show <#(target):armour_accessory#>
property <#target#; armour_accessory=#item#>
hide <#item#>
do <calculate stats>
}
if property <#item#; weapon> then {
msg <#@target# equips the #@item#.>
if ( #(target):weapon# <> none ) then show <#(target):weapon#>
property <#target#; weapon=#item#>
hide <#item#>
do <calculate stats>
}
end define
One other small thing, one section of code that checks the character's stats and sets them according to base stat, temp bonuses, armour and weapons is so long and repetious that Quest pauses for about 2 seconds when it runs. Is there any way to avoid this?
Alex
22 Feb 2005, 09:50The problem is occurring in this line near the top:
because it's missing the word "then". Not sure how that's happened - did you edit that line by hand?
Quest probably isn't "pausing" while running your complex code - it's just spending time running it. Perhaps you can find a way of simplifying it?
if not property <#(target):weapon#; two-handed> {
because it's missing the word "then". Not sure how that's happened - did you edit that line by hand?
Quest probably isn't "pausing" while running your complex code - it's just spending time running it. Perhaps you can find a way of simplifying it?
paul_one
22 Feb 2005, 12:37I've found that If you put the simple line:
"set string <try.me[10000]; kk>"
That quest, initialises all the strings in a loop - which is what I'd expect... BUT this causes Quest to hang for a little while as there's no "do events" in that part of Quest's coding.
Perhaps you have a big array? Perhaps you even have a big "for"?
You can also simplify that code ALOT, as 99% of that is the same thing happening over and over again.
Look into the $objectproperty()$ function, which has great uses if you need the property itself to be variable... I use this to do my stats calculation!
"set string <try.me[10000]; kk>"
That quest, initialises all the strings in a loop - which is what I'd expect... BUT this causes Quest to hang for a little while as there's no "do events" in that part of Quest's coding.
Perhaps you have a big array? Perhaps you even have a big "for"?
You can also simplify that code ALOT, as 99% of that is the same thing happening over and over again.
Look into the $objectproperty()$ function, which has great uses if you need the property itself to be variable... I use this to do my stats calculation!
Christopher
23 Feb 2005, 00:43Ah, that’s it. I have been coding by hand a lot lately, mostly because it’s quicker then clicking on button after button to edit one line. Soon I might just only code by hand.