Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Print Loop Doesn't Work

Author
Message
Uechi
18
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 17th Apr 2009 17:13
The print loop should print 40 times, but prints only 4 times - it prints px,1 thru px,4 but only for py,10 -- any idea what is wrong? I have other loops similar which work fine. I appreciate any help.
[/code]
rem the following is just to verify player card values are correct
function Display_Player_Cards()
for px = 1 to 4 step 1
for py = 1 to 10 step 1
set cursor 0,0
print "px ",px
print "py ",py
print PlayerCards(px,py)
sync
next py
wait key
next px
endfunction
[code]
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 18th Apr 2009 05:23
You seem to have put your code tags in the wrong order - the one with the slash goes last.

Anyway, your SET CURSOR command seems to be the problem. During the PY loop, it resets the cursor to 0,0 each time, so the new result overwrites the old one on the screen. Thus, you only see the last result (py=10)



Uechi
18
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 18th Apr 2009 06:08
I moved the cursor command to the top and got the same result. Any other ideas? I got the result I wanted by changing the code to print each value for x such as (x,1),(x,2) to (x,10) and the the results I wanted but I don't know why the for y loop doesn't give me the correct results.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 18th Apr 2009 06:18
Where exactly did you move the cursor command? Can you post the new code?



Dream And Death
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: The circus! Juggling job, kids and DBPro
Posted: 18th Apr 2009 13:01
Rather than use print, why not use the text command?

You could use:


"You get what everyone gets, you get a lifetime!" - Death, The Sandman Library

First you Dream, then you ... - Neil Gaiman, 2001
Uechi
18
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 18th Apr 2009 16:57
I found it. I set the wait key command after the py loop so I only got to see every tenth one. Thank you all for your help.

Login to post a reply

Server time is: 2024-11-24 08:57:15
Your offset time is: 2024-11-24 08:57:15