Bizarre behaviour!

Blitz3D Forums/Blitz3D Programming/Bizarre behaviour!

_33(Posted 2007) [#1]
Read a$
Print a$
WaitKey()

Data Chr$(65)


If you run this, it will want to open a blitz3D source file!

I suppose you can't put a command in a data statement. Sadly this kicks my project in the nuts as I need to put Chr$(27) in a string as data statements.

Protean accepts escape character, so I'll see how that goes there. So that's a nother reason why I can't use the Blitz3D IDE.

Yet, incidentally, this doesn't work properly in Blitz3D:
   d$ = d$ + "←[160" + Chr$(CSI_set_bkgnd_color) + "     "
   d$ = d$ + "←[161" + Chr$(CSI_set_bkgnd_color) + "      "
   d$ = d$ + "←[162" + Chr$(CSI_set_bkgnd_color) + "      "
   d$ = d$ + "←[163" + Chr$(CSI_set_bkgnd_color) + "      "
   d$ = d$ + "←[164" + Chr$(CSI_set_bkgnd_color) + "      "
   d$ = d$ + "←[165" + Chr$(CSI_set_bkgnd_color) + "      "
   d$ = d$ + "←[166" + Chr$(CSI_set_bkgnd_color) + "     "

← is supposed to be the ESC character 27!!! That's a direct copy/paste from Protean!

What is worse is that when I save the bb source file, the ESC character (or the uncanny ←) is translated back into a question mark! I found out while loadling the bb file in notepad.


b32(Posted 2007) [#2]
You can use Chr$(27) directly into your source:
ff = WriteFile("test.bb")

WriteLine ff, "Data " + Chr$(34) + Chr$(27) + "ok" + Chr$(34)

CloseFile ff

If you open the file 'test.bb', and add these lines:
Read x$

For i = 1 To Len(x$)

	Print Asc(Mid$(x$, i, 1))
	
Next

WaitKey()

End

Data "ok"

The first character of x$ is Chr$(27)
So, in order to use your Protean files in the BB IDE, I think you could convert them, replacing every "&#8592" with Chr$(27).


_33(Posted 2007) [#3]
Hmmm, a copy paste of that works! In the Blitz IDE!!! That's perfect b32. I suppose this should be the indirect but working solution, which I'll use from now on.

The idea of making a little test.bb file like this is a good way to circumvent the problem.

Note that if I copy/paste a character coded as chr$(27), it will stay in the source as a character 27. If I type it in with the keyboard (Protean or BlitzIDE), then something weird will happen. I suppose *ALL* the control codes entered by the keyboard are blocked somehow.

Thanks!