ok, I cooked this up in about half an hour. I was hoping that some amatuer to experienced coders could take a gander over it and see if I'm going in the right driection.
`come on!!!
`dah=duh!! dDA ~DUH!! DA HUUUHHH!!! DOOM DOOM DOOM DOOM!!!
set display mode 640,480,16
sync on
start:
print "How many points would you like to use?"
input ":",pzki
if pzki<=0 : print "How do you expect to draw a curve with" : print ""+str$(pzki)+" points you idiot?" : goto start : endif
dim p(pzki,pzki)
print "You have selected "+str$(pzki)+" points."
gosub draw_graph_paper
wait 100 : cls 0
print "Would you like to plot your points with the mouse or would you prefer"
print "to use the keyboard for your input?"
print "Hit keys to type"
print "or click mouse"
repeat
`for sel=0 to 9
if mouseclick()>=1
mouse=1
keys=0
exit
endif
keys=1
mouse=0
sync
`next sel
s$="."
print s$+s$;
until scancode()>=1
if keys=0 and mouse=1 then sel$=" mouse it is"
if keys=1 and mouse=0 then sel$=" keys it shall be"
print "ok"+sel$
wait 500 : cls 0
gosub draw_graph_paper
`..Im guessing the do-loop would hover around here...
`pointf(1,0,0)
`pointf(2,50,10)
`n=pointf(3,600,300)
`gosub name_points
`Y travels towards the floor.
`X travels across the floor.
suspend for key
UNDIM P(pzki) : wait 1000 : print "Finished!"
end
name_points:
for a=0 to n
text p(a,0)-10,460-p(a,1),""+str$(p(a,0))+","+str$(p(a,1))+""
next a
return
draw_graph_paper:
wait 2000 : cls 0
ink rgb(255,255,255),0
line 0,0,0,4479
line 1,479,640,479
for xp=10 to 640 step 10 : line xp,479,xp,475 : next xp
for yp=0 to 470 step 10 : line 0,yp,4,yp : next yp
sync
return
`Y travels towards the floor.
`X travels across the floor.
function pointf(n,x,y)
if x=0 then x=1 : if y=0 then y=1
circle x,480-y,1
`p gets 0,1 = 0
p(n,0)=x
`p gets 1,0 = 0
p(n,1)=y
endfunction n
Some things I'm asking are,
My naming conventions
General agreement on or acceptance of certain practices or attitudes
Code structure? (place of dim functions and gosub routines
My KEYS or MOUSE repeat checker and any ways an 'abnormal event' could ever happen
How I could get the s$="." to move slower (I tried the for loop, but the
exit command caused some trouble).
I suppose that is all I can throw at you for the time being. I can understand if anyone mentions some bad things about the goto start label, or "remove the waits, you don't need them".. but I'm getting alittle interested in older machines which need to take time to calculate stuff.
Good practice or is it not BIG ENOUGH YET?! as it is!! I know I can get confused with only 100 lines of code.
Thank you. Danke. Merci.