Retrogamecoding(.org) > BrowserBasic

requests

<< < (2/6) > >>

SteveOW:
@Cybermonkey

Sorry
I didnt mean to rattle anyone's cage by re-lighting the Goto Controversy
http://www.sonoma.edu/users/l/luvisi/goto/goto.pdf

I just found a solution published some time ago...
use "Come From" instead !!!
http://www.fortran.com/come_from.html ;)

cheers, SteveOW.

Guilect:
@SteveOW

How about this.
Two suggestions.

First,  use the method you just descibed.
If you want to programatically not have a section of code run
you can using BB syntax do:

If (1=2) then
    code you want to skip
    code you want to skip
    code you want to skip
    code you want to skip
endif

Or secondly, what I do if I want to skip code is to comment it out.
Even if it is a large block of code it is no problem with the editor that comes with BB
as it has a block comment feature under the edit menu.

SteveOW:
@Guilect,

Obviously I got no problem if you dont want to put GOTO & Labels into BB, its your baby.

Those two methods are obviously feasible workarounds.

[ramble]

--- Code: ---For me Goto and Labels (as found in VB6) are useful and convenient.
Unlike those two methods my Goto & Labels stick out like sore thumbs in my code.
Which is exactly what I want them to do. 
They are like duct tape or temporary traffic signs.
They say "there is something unfinished here which needs attention at some time".
Whereas those two methods blend in with lots of my stable code.
I tend to use comments to de-activate fossil code which shows how the program used to do something.
I sometimes find it useful to keep such stuff hanging around for a few years.
Whereas my goto's & labels are often only in use for a few minutes until a bug has been cornered.

--- End code ---
[/ramble]

cheers, SteveOW. :)

PS My PN.exe inserts !~ as comment instead of '.
maybe due to current scheme in PN being "Fortran 95" ?

Guilect:

--- Quote ---PS My PN.exe inserts !~ as comment instead of '.
maybe due to current scheme in PN being "Fortran 95" ?
--- End quote ---

I will look into the comment character insertion.

The lexer needs to be set to Fortran 95.
This is the built in lexer in the scintilla control.
It turns out that the fortran language is the closest to BB's regarding functions, for loops, and if-then statements.
Selecting Fortran allows the editor to (mostly) process BB code correctly for code folding of functions, if-thens, for-next loops, etc.

SteveOW:
@Guilect
Am trying to port Tomaaz's javascript prog for Langtons Ant into BrowserBasic (see BB code below).
It works alright except that BB refreshes the screen on every repeat call to the OnDraw function.

I have tried writing the image to an array and repainting the image on every step of the loop.
But this makes the prog very slow (40 minutes instead of 1 minute to complete 12000 steps).

Would it be possible to provide an option in BB that prevents the clearing of the old canvas image?

Alternatively could there be a way for a BB programmer to manipulate an image in a buffer and then onevery step to rapidly "BitBlt" the image from the buffer to the screen/canvas?

cheers, SteveOW.

PS Maybe this Topic could be renamed "Requests"?


--- Code: ---'... Global Vars

var PixelData[4] as array
var PixelDataLong as number
var steps as number
var x as number
var y as number
var Direction as number
var scaler as number

'... Initialisation
Function OnLoad()

scaler = 1
steps = 12000
x = 100*scaler
y = 100* scaler
Direction = 1

endfunction

'... Update

Function OnUpdate()
endfunction

'... Draw

Function OnDraw()

PixelDataLong = getPixel(x,y)

if PixelDataLong > 0 then '...black
setColor (0,0,0) '...white
setPixel(x,y)    '...paint pixel
''fillRect(x,y,1*scaler,1*scaler)

select Direction
case 1
Direction = 4
x=x+  scaler
break
case 2
Direction = 1
y=y+  scaler
break
case 3
Direction = 2
x=x-  scaler
break
case 4
Direction = 3
y=y-  scaler
break
endselect
else
setColor (255,255,255) '...black
setPixel(x,y)    '...paint pixel
''fillRect(x,y,1*scaler,1*scaler)

select Direction
case 1
Direction = 2
x=x-  scaler
break
case 2
Direction = 3
y=y-  scaler
break
case 3
Direction = 4
x=x+  scaler
break
case 4
Direction = 1
y=y+  scaler
break
endselect
endif
steps = steps-1

if steps= 0 then
msgbox("Finished")
endif

endfunction '...OnDraw()


--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version