News:

Welcome to RetroCoders Community

Main Menu

Annoyed

Started by johnno56, May 04, 2023, 10:07 PM

Previous topic - Next topic

johnno56

I have just had my browser (Google Chrome) crash on me again. It only happens, thankfully only 'once in a blue moon', and to today was a full blue moon... I started working on a simple sprite editor and almost had it finished when the browser decided to take its bat and ball and go home!

As a rule, I do not normally save a browser session... (who does, right?) But it looks like I will have to. I will try to use another browser in the hopes that it is just a Google Chrome/Linux thing. Hang it. I will just use a text editor and copy and paste. At least doing it this way I will always have a recent 'backup'...

I am not blaming the author of BAM. I am just extremely annoyed. I had been working on it for the last 4 hours and all that work is gone... grrr... Thankfully, I still have the text version of the Editor (minus the 4 hours of work) that I can use. But NOT today! I might try again tomorrow... I think I will take out my annoyance on a game of Doom2...

Rant finished... *sigh*
May your journey be free of incident.  Live long and prosper.

CharlieJV

#1
Silly questions: do you an instance of BAM saved to your computer, and when you program, do you not re-save BAM (either overwriting the previous version on your hard drive, or saving a new copy at regular intervals?

The same as when I'm working on any document, I save BAM every time whenever I've done a significant amount or writing/programming/whatever that I would hate losing.

If you've never saved an instance of BAM to your local drive for offline programming, remember that a "save" is really a "download" of the whole single-page-application, and that download works much like "Save As" in Word or whatever.

All of that aside, I feel your pain.  Been there, don't that, and it sucks.

johnno56

Therein lies part of my problem... I just cut and paste a document, unless starting from scratch, and do not always think to 'backup' mainly because, I do not, as a habit, make a backup of a browser page... time to learn a new habit, huh? lol

I have decided to give Doom2 a miss, have some munchies, then get back into the Editor before I forget what I did this morning... *sigh*  This should be an interesting exercise in "now where did I stash those memories?" lol
May your journey be free of incident.  Live long and prosper.

CharlieJV

#3
Quote from: johnno56 on May 05, 2023, 12:47 AMTherein lies part of my problem... I just cut and paste a document, unless starting from scratch, and do not always think to 'backup' mainly because, I do not, as a habit, make a backup of a browser page... time to learn a new habit, huh? lol

I have decided to give Doom2 a miss, have some munchies, then get back into the Editor before I forget what I did this morning... *sigh*  This should be an interesting exercise in "now where did I stash those memories?" lol

Probably won't help any, but I'll throw it out there anyway: don't think of BAM as a browser/web page.  Think of it as a browser application, or a single-page web app, or a "quine".

johnno56

#4
Here is what I have reconstructed from memory. It is VERY basic (no pun intended) with a limited palette. Use is simple. Left mouse button, within the palette grid, to select the current colour. Left mouse button, within the main grid, to draw with the current colour. Normally, I assign the right mouse button, to erase. But, the browser has already assigned that button. To erase, hover the mouse within the main grid, then press SPACE. ESC to quit.

As the program is only geared to cater for 8x8 sprites, adding various drawing options, seemed a bit like overkill... Pixels only... Moo Ha Ha Ha...

I still have to add saving and loading. That will take a little more research. As BAM does not seem to support loading and saving sprites yet, I am going to guess that it may write to a text file? If so, then there may be a chance that the sprite made can be converted to a series of data statements, that can be either read by a program or further converted to produce lines of text for the LETCHR$() command. I know... wishful thinking... but I have to start with something, right?

If you discover any 'random features' or if you have any suggested improvements, let me know and I will do my best to fix it...

Screen 7: Cls

gridCol = 7
fillCol = 15
EraseCol = 0
currentColour = 7
gridSize = 8

'
'		Main Grid
'
Dim GridA(8, 8)
Dim GridB(8, 8)
posX = 0
posY = 0
remove = 0

'		Draw Main Grid
'
for x = 0 to 160 step 20
	for y = 0 to 160 step 20
		line(x, y)-step(20, 20), GridCol, b
	next
next

'		Draw Sample Grid
'
for imageX = 0 to 7
	for imageY = 0 to 7
		Line(224 + (imagex*4),16 + (imagey*4))-step(4,4),GridCol,b
	next
next

'		Draw Current Colour Box
line(234,60)-step(12, 12), GridCol, b

'		Draw Colour Palette
'
for x = 1 to 5: line(190 + ((x - 1) * 20), 80)-step(20, 20), x, bf: next
for x = 1 to 5: line(190 + ((x - 1) * 20), 100)-step(20, 20), x + 5, bf: next
for x = 1 to 5: line(190 + ((x - 1) * 20), 120)-step(20, 20), x + 10, bf: next

'		Draw Palette Grid
'
for x = 0 to 4
	for y = 0 to 2
		line(190 + (x * 20), 80 + (y * 20))-step(20, 20), GridCol, b
	next
next

do while inkey$ <> chr$(27)

	'		Assign mouse functions
	'
	mb = _mousebutton
	mx = _mousex
	my = _mousey
	
	'locate 1,1:print using "MX: ###";mx
	'locate 2,1:print using "MY: ###";my
	'locate 3,1:print using "MB: ###";mb
	'locate 4,1:print using "COL ###";currentColour

  '   PLACE CURRENT COLOUR ON MAIN GRID
  '
	if mb = 1 and mx > 0 and mx < 160 and my > 0 and my < 160 then
		paint(mx, my), currentColour, GridCol
	end if

	'		DISPLAY CURRENT COLOUR
	'
	if mb = 1 and mx > 190 and mx < 290 and my > 80 and my < 140 then
		currentColour = point(mx, my)
		line(234,60)-step(12, 12), currentColour, bf
	end if
	line(234,60)-step(12, 12), GridCol, b
	
	'
	'   UPDATE SPRITE
	'
	for imageX = 0 to 7
		for imageY = 0 to 7
			GridB(posx,posy) = point(10 + (imagex * 20), 10 + (imagey * 20))
			Line(224 + (imagex*4),16 + (imagey*4))-step(4,4),GridB(posx,posy),bf
			Line(224 + (imagex*4),16 + (imagey*4))-step(4,4),GridCol,b
		next
	next		

	'		ERASE MAIN GRID CELL UNDER MOUSE POINTER
	'
	if inkey$ = " " and mx > 0 and mx < 160 and my > 0 and my < 160 and point(mx, my) <> GridCol then
		paint(mx, my), EraseCol, GridCol
	end if	
loop

May your journey be free of incident.  Live long and prosper.

CharlieJV

Quote from: johnno56 on May 05, 2023, 04:40 AMHere is what I have reconstructed from memory. It is VERY basic (no pun intended) with a limited palette. Use is simple. Left mouse button, within the palette grid, to select the current colour. Left mouse button, within the main grid, to draw with the current colour. Normally, I assign the right mouse button, to erase. But, the browser has already assigned that button. To erase, hover the mouse within the main grid, then press SPACE. ESC to quit.

As the program is only geared to cater for 8x8 sprites, adding various drawing options, seemed a bit like overkill... Pixels only... Moo Ha Ha Ha...

I still have to add saving and loading. That will take a little more research. As BAM does not seem to support loading and saving sprites yet, I am going to guess that it may write to a text file? If so, then there may be a chance that the sprite made can be converted to a series of data statements, that can be either read by a program or further converted to produce lines of text for the LETCHR$() command. I know... wishful thinking... but I have to start with something, right?

If you discover any 'random features' or if you have any suggested improvements, let me know and I will do my best to fix it...

Screen 7: Cls

gridCol = 7
fillCol = 15
EraseCol = 0
currentColour = 7
gridSize = 8

'
'        Main Grid
'
Dim GridA(8, 8)
Dim GridB(8, 8)
posX = 0
posY = 0
remove = 0

'        Draw Main Grid
'
for x = 0 to 160 step 20
    for y = 0 to 160 step 20
        line(x, y)-step(20, 20), GridCol, b
    next
next

'        Draw Sample Grid
'
for imageX = 0 to 7
    for imageY = 0 to 7
        Line(224 + (imagex*4),16 + (imagey*4))-step(4,4),GridCol,b
    next
next

'        Draw Current Colour Box
line(234,60)-step(12, 12), GridCol, b

'        Draw Colour Palette
'
for x = 1 to 5: line(190 + ((x - 1) * 20), 80)-step(20, 20), x, bf: next
for x = 1 to 5: line(190 + ((x - 1) * 20), 100)-step(20, 20), x + 5, bf: next
for x = 1 to 5: line(190 + ((x - 1) * 20), 120)-step(20, 20), x + 10, bf: next

'        Draw Palette Grid
'
for x = 0 to 4
    for y = 0 to 2
        line(190 + (x * 20), 80 + (y * 20))-step(20, 20), GridCol, b
    next
next

do while inkey$ <> chr$(27)

    '        Assign mouse functions
    '
    mb = _mousebutton
    mx = _mousex
    my = _mousey
    
    'locate 1,1:print using "MX: ###";mx
    'locate 2,1:print using "MY: ###";my
    'locate 3,1:print using "MB: ###";mb
    'locate 4,1:print using "COL ###";currentColour

  '  PLACE CURRENT COLOUR ON MAIN GRID
  '
    if mb = 1 and mx > 0 and mx < 160 and my > 0 and my < 160 then
        paint(mx, my), currentColour, GridCol
    end if

    '        DISPLAY CURRENT COLOUR
    '
    if mb = 1 and mx > 190 and mx < 290 and my > 80 and my < 140 then
        currentColour = point(mx, my)
        line(234,60)-step(12, 12), currentColour, bf
    end if
    line(234,60)-step(12, 12), GridCol, b
    
    '
    '  UPDATE SPRITE
    '
    for imageX = 0 to 7
        for imageY = 0 to 7
            GridB(posx,posy) = point(10 + (imagex * 20), 10 + (imagey * 20))
            Line(224 + (imagex*4),16 + (imagey*4))-step(4,4),GridB(posx,posy),bf
            Line(224 + (imagex*4),16 + (imagey*4))-step(4,4),GridCol,b
        next
    next        

    '        ERASE MAIN GRID CELL UNDER MOUSE POINTER
    '
    if inkey$ = " " and mx > 0 and mx < 160 and my > 0 and my < 160 and point(mx, my) <> GridCol then
        paint(mx, my), EraseCol, GridCol
    end if    
loop



Hey, that's really good.

BAM doesn't have "save to" (really download) and "read" from (really upload) features for files.

However, saving to and reading from browser's local storage, that might work well enough (keeping in mind the risks of losing those stored items when clearing browser cookies etc.)

Take a look at SetLocalStorageItem and GetLocalStorageItem.

Keep in mind that this is local storage related to the BAM URL.  Every program running in BAM at that URL has access to the same browser storage area.

So good for the key names to have a little something to distinguish those keys to keys for other programs.  Something to maybe consider at some point.

As a backup of work stored in browser local storage, LPRINT (alone or combined with _STARTSPOOL and _ENDSPOOL) can be used to put together a file for download.