Really running into illogical stumbling blocks

MerryCo
in the following ASL code:

enter <yesno>
if (#yesno# = Y) then {
inc <counter>
msg <You pressed Y.>
}
else {
msg <You did not press Y.>
}

inc <counter>; msg <You pressed Y> will always fire, no matter the value of #yesno#. According to the help file, the syntax appears correct. Any ideas?

MaDbRiT
Hi Merry

Don't know what you're doing wrong - but this works for me!

Try this code...


' "Game Name"
' Created with QDK Pro 4.0 Beta 2

define game <Game Name>
asl-version <391>
gametype singleplayer
start <Limbo>
game author <Your Name>
game version <1.0>
game copyright <© 2006 ...>
game info <Enter any additional information about this game here.>


end define

define options
debug on
panes on
end define

define room <Limbo>

script {
msg <Want to increment the counter? (Y/N)>
enter <yesno>
if (#yesno# = Y) then {
inc <counter>
msg <You pressed Y.>
}
else {
msg <You did not press Y.>
}
}

end define

define text <intro>
Enter intro text here
end define

define text <win>
Enter win text here
end define

define text <lose>
Enter lose text here
end define



Just run this little demo and you'll find it works as you expect...

Al

MerryCo
The code was being set up as a command, and it's also embedded in a library. I'll paste the entire thing below. It does not work.


command <!objsetprop #object# #prop# #value#> {
if exists <#object#> then {
if property <#object#; #prop#> then {
property <#object#; #prop#=#value#>
msg <|n[GC] Property |b#prop#|xb in object |b#object#|xb set.>
}
else {
msg <|n[GC] Warning: |b#object#|xb property '|b#prop#|xb' does not exist. Create it (Y/N)?>
enter <yesno>
' if (#yesno# = Y) then {
property <#object#; #prop#=#value#>
msg <[GC] Property |b#prop#|xb in object |b#object#|xb set.>
' }
else {
msg <[GC] Property not created.>
}
}
}
else {
msg <|n[GC] Error: |b#object#|xb does not exist.>
}
}

MaDbRiT
Hi Merry

In the code you posted you've actually commented out the 'if - then' line and it's terminating brace - so as it stands the test won't be performed.

Did you do that deliberately for testing? Or is this the whole problem!

Al

MerryCo
*shifts eyes and grabs more coffee*

Thanks, MaDbRiT.

MerryCo
Now I see. I commented those out when trying to debug.

If I uncomment those lines, just the opposite is true. No matter what is typed, it will bypass inc <counter>; msg <You pressed Y.>

MaDbRiT
Hi Merry

Not got time to do any more code splatting regarding the yes/no logic right now - but I can tell you that

command <!objsetprop #object# #prop# #value#>



is going to cause you grief!

basically if your player types

>!objsetprop widget heavy 250

Your #object# variable will most likely contain "widget heavy 250" and the other two will be blank...

You need to specify a seperator so that quest knows when one variable starts and another ends...

try something like

command <!objsetprop #object#, #prop#, #value#>



The player will need to type in

>!objsetprop widget, heavy, 250

but your variables will then get populated with the right values.

I'll look at the yes/no issue for you when I get home from work...

Al

Alex
Are you using v4.0 Beta 2? I've kind of broken string comparison... MaDbRiT actually has an updated QUEST.EXE (and of course the issue will be fixed in Beta 3) - please drop me an email if you'd like a copy.

Otherwise your code should work properly in v3.53 as far as I can see.

MaDbRiT
Alex wrote

~MaDbRiT actually has an updated QUEST.EXE



I'd completely forgotten about this rather significant fact... :oops:

Al

MerryCo
Alex,

Yup, using B2. I didn't try to port this back to 3.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums