Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 6-Sep-2019 11:06:35

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Addsourcecode

Hello! Could someone please provide some examples of how to use addsourcecode plugit?
In a form of OpenSpace3D project file.
I try to make it print Hello World from Scol manual when attached to a button click but nothing happens..(


My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

#2 6-Sep-2019 11:10:58

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,821
Website

Re: Addsourcecode

Hello,

can you gives the code you entered in the plugit ?

Offline

#3 6-Sep-2019 11:18:42

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Re: Addsourcecode

Something like this (played a lot changing format - no result):


fun printHello (string)=
	_fooS strcat "Hello " string
	;;
	
fun test ()=
	_showconsole;
	printHello "Scol Community !";
	0;;

And setting "test" as name of main function.
And a logic / links like this:

logic
logic screenshot


My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

#4 6-Sep-2019 11:43:58

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Re: Addsourcecode

Plugit log window gives this when I click button to run code:

> Event : Scene.Button inst.LeftClick with param : NIL
> Action : Scene.addsourcecode inst.Run with param : NIL and reply param : NIL

And pop up this window with some errors:

https://www.screencast.com/t/0eBFgpa8k10

If I close it editor crashes.

Last edited by Coder108 (6-Sep-2019 11:44:35)


My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

#5 6-Sep-2019 11:44:11

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,821
Website

Re: Addsourcecode

sample : http://www.arkeon.be/scol/os3d/addsourcecode.xos

you need to add a plugit to run the code and set the main function name in the plugit

Offline

#6 6-Sep-2019 11:46:30

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,821
Website

Re: Addsourcecode

Yes it means that your code works ^^
_showconsole open the main scol console.
closing it close the scol machine, so all OS3D editor also, it's not a crash

Offline

#7 6-Sep-2019 11:50:00

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Re: Addsourcecode

Thank you arkeon, but when I load your code nothing happens. How can I practically use this addsource plugit? I thought it would let me develop my own plugits from scratch and editable it OS3D editor.
Could you give me some simple example with a button triggering a messagebox from addsoursecode plugit?

Last edited by Coder108 (6-Sep-2019 11:52:23)


My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

#8 6-Sep-2019 11:58:54

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,821
Website

Re: Addsourcecode

just resize the log view of the OS3D interface
https://www.openspace3d.com/documentati … rface.html (6)

you will see the hello world in the OS3D console

Offline

#9 6-Sep-2019 12:01:48

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,821
Website

Re: Addsourcecode

addsoursecode is not intended to make plugITs, just to use some scol code in your project or learn.

you can also make some code in links parameters with [code ] [/ code]
if you want to make your own plugit start here : https://redmine.scolring.org/projects/s … ate_plugIT
and here https://redmine.scolring.org/projects/o … dules.html

also open existing simple plugits code to learn

Offline

#10 6-Sep-2019 12:02:10

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Re: Addsourcecode

Already did it. Here's all that is in my log:

> Init default scene.
> Init default scene.
> Loading OpenSpace3D scene file : examples/addsourcecode.xos
> Number of plugIT instances in project: 2
> Number of links in project: 1
> examples/addsourcecode.xos loaded.

screen

No hello..

Last edited by Coder108 (6-Sep-2019 12:05:54)


My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

#11 6-Sep-2019 12:03:55

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Re: Addsourcecode

arkeon wrote:

addsoursecode is not intended to make plugITs, just to use some scol code in your project or learn.

you can also make some code in links parameters with
if you want to make your own plugit start here : https://redmine.scolring.org/projects/s … ate_plugIT
and here https://redmine.scolring.org/projects/o … dules.html

also open existing simple plugits code to learn

I see, thank you..


My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

#12 6-Sep-2019 12:05:38

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,821
Website

Re: Addsourcecode

did you hit the play button ?
try to redownload it in case I forgot to hit save before upload ^^

what I have

> Init default scene.
> Loading OpenSpace3D scene file : examples/addsourcecode.xos
> Number of plugIT instances in project: 2
> Number of links in project: 1
> examples/addsourcecode.xos loaded.
> Hello Scol Community !

Offline

#13 6-Sep-2019 12:10:03

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Re: Addsourcecode

You are righ, my fault( I hit play and "> Hello Scol Community !" appeared. Thank you.


My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

#14 6-Sep-2019 12:13:14

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Re: Addsourcecode

So it seems not every Scol code can be run in this plugit. Your code:

fun printHello (string)=
                  //addLogMessage show messages in OS3D logs window
	addLogMessage strcat "Hello " string
	;;
	
fun testMainfunction ()=
	printHello "Scol Community !";
	0;;

My (wrong) code copy-pasted from manual:

fun printHello (string)=
	_fooS strcat "Hello " string
	;;
	
fun test ()=
	_showconsole;
	printHello "Scol Community !";
	0;;

My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

#15 6-Sep-2019 12:18:24

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Re: Addsourcecode

Also I've found that main function should be placed at the very end of plugit editor. Otherwise it does not trigger function.


My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

#16 6-Sep-2019 12:43:43

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,821
Website

Re: Addsourcecode

yes scol compile the code in order, so a function must exist before another call it. so the order in file is important but you can use proto myfun = [paramtypes] return type;;
to declare a function so it can be anywhere after in code

Offline

#17 6-Sep-2019 23:23:48

Coder108
Member
From: Moscow
Registered: 6-Sep-2019
Posts: 14

Re: Addsourcecode

Thank you! I have to explore it more.


My programming background is HiAsm and MQL4, PHP, JavaScript.

Offline

Board footer

Powered by FluxBB