Page 1 of 1

How do I see, or what is an OpenConsole

Posted: Tue Jun 30, 2020 6:14 pm
by c128/64basicyes
how do i get an openconsole(), i have been trying for days have an console appear, and have something printed on it and have NEVER had a console appear, i don't know what they are referring to, I assume that a console is a window on the screen with something printed in it!

1 If OpenConsole ()
2 EnableGraphicalConsole (1)
3
4 For i = 0 To 200
5 ConsoleLocate ( Random (79) , Random (24) )
6 Print ("*")
7 Next
8
9 ConsoleLocate (30 , 10)
10 PrintN (" Press return to exit ")
11 Input ()
12 EndIf

Re: How do I see, or what is an OpenConsole

Posted: Tue Jun 30, 2020 7:02 pm
by infratec
A console is a 'DOS-Box' like if you run cmd.

If I run your progrom in the IDE it shows a console window.
If you create an exe, you have to change the Executable-Format in Compiler Options
to Console.

You don't put the line numbers in the code :?:
And you should use the code tags to show your code like

Code: Select all

EnableExplicit

Define i.i

If OpenConsole ()
  EnableGraphicalConsole (1)
  
  For i = 0 To 200
    ConsoleLocate ( Random (79) , Random (24) )
    Print ("*")
  Next
  
  ConsoleLocate (30 , 10)
  PrintN (" Press return to exit ")
  Input ()
  
  CloseConsole()
EndIf

Re: How do I see, or what is an OpenConsole

Posted: Tue Jun 30, 2020 7:15 pm
by NicTheQuick
On Linux you always have to choose the executable format "Console" in the compiler options if you want to see a console window.

Re: How do I see, or what is an OpenConsole

Posted: Tue Jun 30, 2020 8:08 pm
by c128/64basicyes
NicTheQuick wrote:On Linux you always have to choose the executable format "Console" in the compiler options if you want to see a console window.
i am still trying to learn system, what is

Enableexplicit

define i.i

it is not in the example of code that was presented to me

I still cannot get an openconsole i don't know what i am doing wrong i don't have those compiler options or again i am doing something wrong

Re: How do I see, or what is an OpenConsole

Posted: Tue Jun 30, 2020 9:08 pm
by infratec
Do you use PureBasic :wink:

Every version of PureBasic has these compiler settings, at least since I'm using PureBasic.

So please tell us your OS and your version of PureBasic, before we only speculate about something.

Btw.:

Place the cursor on the word EnableExplicit and press F1 (in the IDE of course)

settings

Posted: Tue Jun 30, 2020 10:23 pm
by c128/64basicyes
OS is Windows 10 Pro

PureBasic version is 5.72

Re: How do I see, or what is an OpenConsole

Posted: Wed Jul 01, 2020 12:37 am
by Olli
EnableExplicit means that all the variables you create, must be created explicitly by the directive Define else an error occurs.
This prevents you to search a bug during many hours, in a big program, just because you forget to type a character.

It is very important, and I advise you to use it too !

Define just tells the compiler you create a variable.

Code: Select all

EnableExplicit ; this will tell me if I do a mistake
Define x, y, z    ; x, y and z are 3 new variables
Define a
Define b
Define c ; a, b and c are 3 new variables too
"Define" is like the old basic statement named "let".

Re: settings

Posted: Wed Jul 01, 2020 6:59 am
by infratec
c128/64basicyes wrote:OS is Windows 10 Pro
PureBasic version is 5.72
So if you press F5 the program should start and you should see the console window.

Or ... the exexutable is blocked by a VirusScanner

hooray

Posted: Wed Jul 01, 2020 8:42 pm
by c128/64basicyes
took mcafee off, reinstalled and it runs

Anything else anyone should tell me?

Re: hooray

Posted: Wed Jul 01, 2020 10:31 pm
by Kiffi
c128/64basicyes wrote:Anything else anyone should tell me?
yes: good luck and have fun! :D

Re: How do I see, or what is an OpenConsole

Posted: Thu Jul 02, 2020 1:15 am
by AMpos
You can try

DEBUG "text"

to see your program output (it will open the Debug Window with the text "text" in it)

If you are doing a Windows Program, you should openwindow() for your output.

If you are planning to do a Game, openscreen() is your friend.

If you are planning to do a program to run in the background or just for testing, openconsole() may help you, as it is very similar to old computers output. It should be used only by very begginners or very advanced programmers.