Ooops
October 28, 2021, 18:00:13

Author Topic: What is documentation saying about esc codes?  (Read 367 times)

Offline twgonder

  • Jr. Member
  • **
  • Posts: 29
What is documentation saying about esc codes?
« on: July 08, 2021, 19:37:02 »
I don't understand the documentation on escape codes.

At the top of the list is \a for beep. What does the "\" mean? How does one ring the bell?
(I used to print chr(7) in my old mini-based BASIC)

For the escape codes there is a sample snip below. I just don't get the purpose of "\e" based on the sample code.

Can someone please explain?
I would be willing to help clean-up the helps (when I refer to them) if someone would give me an intro in how to edit them properly.
« Last Edit: July 08, 2021, 20:00:44 by twgonder »

Offline bplus

  • Full Member
  • ***
  • Posts: 229
Re: What is documentation saying about esc codes?
« Reply #1 on: July 09, 2021, 12:56:49 »
ASC(escape) = 27 try CHR(27)

I dont use escape codes but CHR(27) + the other chars should do it.

This quick little example works for me:
Code: [Select]
escCodeUnderline = chr(27) + "[4m"

? escCodeUnderline + "This sentence better be underlined.
« Last Edit: July 09, 2021, 13:06:14 by bplus »

Offline chrisws

  • Full Member
  • ***
  • Posts: 117
    • SmallBASIC
Re: What is documentation saying about esc codes?
« Reply #2 on: July 13, 2021, 09:30:17 »
In a recent update I made a change where you can do away with needing to use chr(27)

Here's an except from one of the tests

if (asc("\a") !=  7) then throw "err1"
if (asc("\b") !=  8) then throw "err2"
if (asc("\e") != 27) then throw "err3"
if (asc("\f") != 12) then throw "err4"
if (asc("\n") != 10) then throw "err5"
if (asc("\r") != 13) then throw "err6"
if (asc("\t") !=  9) then throw "err7"
if (asc("\v") != 11) then throw "err8"

 s="Hello\033There"
if (27 != asc(mid(s, 6, 1))) then throw "err"

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal