Author Topic: Something is clearly wrong with the Scripting Console  (Read 2475 times)

KMickle

  • Guest
Something is clearly wrong with the Scripting Console
« on: November 12, 2018, 05:57:04 pm »
Greetings.

Either I don't understand the purpose of the console, but it seems to me that it is defunct. Here is what I can do:
1. Create a variable:
Code
> local a = 5;


Here is what I can't do:
1. Use some of the Squirrel built-in functions:
Code
> getconsttable()

AN ERROR HAS OCCURED [the index 'getconsttable' does not exist]

CALLSTACK
*FUNCTION [main()] ScriptConsole line [1]

LOCALS
[this] TABLE

AN ERROR HAS OCCURED [the index 'getconsttable' does not exist]

CALLSTACK
*FUNCTION [main()] ScriptConsole line [1]

LOCALS
[this] TABLE
> ::getconsttable()
2. Get returns from the other built-in functions:
Code
> this.tostring()
> this.len()
3. Use any Code::Blocks binding:
Code
> Log(_T("message"));

AN ERROR HAS OCCURED [the index 'Log' does not exist]

CALLSTACK
*FUNCTION [main()] ScriptConsole line [1]

LOCALS
[this] TABLE

AN ERROR HAS OCCURED [the index 'Log' does not exist]

CALLSTACK
*FUNCTION [main()] ScriptConsole line [1]

LOCALS
[this] TABLE
Code
> GetProjectManager()

AN ERROR HAS OCCURED [the index 'GetProjectManager' does not exist]

CALLSTACK
*FUNCTION [main()] ScriptConsole line [1]

LOCALS
[this] TABLE

AN ERROR HAS OCCURED [the index 'GetProjectManager' does not exist]

CALLSTACK
*FUNCTION [main()] ScriptConsole line [1]

LOCALS
[this] TABLE

At this state, the console is clearly useless; there is little fun in setting variables without being able to query their values, lest use them elsewhere. Am I missing something, or is it just not working. I'm using the latest official binary (17.12) @ Windows 7 x86.

Thank you in advance for any info you can provide!

Upd.: something I did in the Console disrupted the whole Code::Blocks environment: after meddling with it I'd become unable to perform script-driven actions, like adding new files (until I restarted the IDE).

Upd.:Upd.: I have probably tried to use 'clear()' to clear the console output. Instead, it must have devoid the Root Scope of all variables and rendered the whole IDE defunct. That call must have been the cuse of the malfunction. I still appreciate any useful info on working with the console, as Internet searches typically yield next to nothing on the subject.
« Last Edit: November 12, 2018, 06:35:27 pm by KMickle »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Something is clearly wrong with the Scripting Console
« Reply #1 on: November 12, 2018, 08:58:00 pm »
I too have seen this behavior from some time ago, this was not always the case...

I am really bussy this week but  i will try to look into it..

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Something is clearly wrong with the Scripting Console
« Reply #2 on: November 12, 2018, 10:16:57 pm »
Some tips from my side:
Every line entered in the console command line is "one" script. So locals won't work.
If you use the global table it will work:
Wont work:
Code
> local a = 5;               // Create local variable, valid only in this line
> Log(_T(typeof(a)))   // error, a not defined, because it is local to the top line
will work:
Code
> a <- 5;                    // create a in global table
> Log(_T(typeof(a)))  // Logs "integer" in the codeblocks log output

if you use strings like with typeof you have to use the "_T()" function to transform it in a wxString that is expected from all codeblocks functions. If the migration to sqrat would be complete this would be an automatic conversion...

I generelly use the run file button and not the console line, so i can use local variables ecc...

EDIT: strangely i can not reproduce the errors i had some time ago with the scripting console..
« Last Edit: November 12, 2018, 10:22:17 pm by BlueHazzard »