Axe Software Forums
  Quest Developer Forum
  Some wrong code!?


Author Topic:   Some wrong code!?
Computer Whizz posted 08-08-2001 01:08 GMT     
OK.... anyone who can spot the error which make's Quest come up with a run-time error '6' is a better man then me !!

if (%hours% = 12) then {
'if you want a 24 hour clock then set the number to 24, and take out the whole if that is BELOW!!

if (#MorA# = PM) then {
set <days; %days% + 1>
set <MorA; AM>} else {
set <MorA; PM>}
set <hours; = 0>}

now this might turn out weird since I copied it right out of textpad!! But try to spot the errors...... I can't. I know that the if statement might be a bit wrong....
If anyone wants the ASL file, just post it here and I'll get it to you!

Computer Whizz

MaDbRiT posted 08-08-2001 07:02 GMT          
Hi CW

Here's a time clock based on yours that doesn't generate an error! cut and paste the lot to prove it works, then use the relevant bits in your game - if you still get an error it's time to look elsewhere for it!

quote:
define game <Demo of time routine>
asl-version <284>
game version <1.0>
game author <Enter your name here>
game copyright <� 2001 DaMaDbRiT>
game info <Test time routine>
start <start>
startscript {
set numeric <hours; 10>
set string <MorA; PM>
set numeric <days; 1>
}
beforeturn do <time>
end define

define room <start>
look <Enter room description here>
command <time> {
msg <It is %hours% #MorA# - you have been adventuring __
for %days% days.>
}
end define

define procedure <time>
if (%hours% = 12) then {
if (#MorA# = PM) then {
set <days; %days% + 1>
set <MorA; AM>
}
else {
set <MorA; PM>
}
set <hours; 1>
}
else {
set <hours; %hours% +1>
}
end define

define text <intro>
Just type 'time' repeatedly, and observe - each move consumes an hour ;-)
end define

define text <win>
Enter win text here
end define

define text <lose>
Enter lose text here
end define


Hope that helps

Al

Computer Whizz posted 08-08-2001 10:34 GMT          
UUmmmm......
I KNOW that it is that code that give's me the run-time '6' error.... because I went through the code, deleting bit's from it till the run-time disappeared!

Now I also have an error in my define procedure block which Quest tells me that I have the wrong type of variable, and conveniently shut's down! Then without a word, writes NOTHING to the log file!!

Anyway, you have the code almost identical to me.... all you have done is put in an else.... I'll send you my ASL when I get home tonight, then you can fine-tune it :)

Computer Whizz

MaDbRiT posted 08-08-2001 11:27 GMT          
quote:

Anyway, you have the code almost identical to me.... all you have done is put in an else.... I'll send you my ASL when I get home tonight, then you can fine-tune it :)

Given your code generates an error 6 and mine works, I'd suggest there's something fundamentally wrong with the way your code is set up. :-)

If you mail me the ASL (and any library it calls - it might be something in that) I'll give it a quick look..

Al