New scripting engine - testers wanted!
- Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: New scripting engine - testers wanted!
@SROD
INCREDIBLE, never i imagine it's a also big project
After your COMATE, i say to me, never a project can be also strong than him.
You have wonderfully explain to me, and never you believe, but i have all understand the goal
When i have say "SCRIPT", i believe it's another project like when several code send PB order in txt and the serveur execute, another PBSCRIPT what.
But no, like usually, you shoot really really more top, like the COMATE class, a SCRIPT like several professionals already use
I'm really surprising by your and Bitblazer explanations
I know they are several Script program, but i believe the script one and same part, included in the program, and not a program where after, a Script motor can to be connected
Anyway, i don't know several program have planned, like say Bitblazer to accept the connection of a Script motor if we want this function
Really, how you want that my admiration not increase in the same time you had a line to all your extraordinary projects
I wish you all the courage for terminate it, (the knowledge no need to wish something)
Thanks you in advance, and i follow you the most far possible, for not disturb you another time...
You do not need a ball more, the task is already enough hard
Again thanks for sent your precious time, again another time, for explain to me
@Bitblazer
Thanks for your explanation , after reading SROD great explanations and yours, i see it's again a giant professionnal option that SROD try to offer to PB community
Apparently, a more value also big than OLE, and i never believe it's another time possible
@KIFFY
Really thanks for recognize your unknowledge , if someone like you not understand...i had no chance to understand
@HEXOR
You are a big master of the WEB and network, i have admired several of your codes about this subject i'm not surprising it's you who begin the challenge
Even if the code is for KIFFY, thanks a lot for sharing it
INCREDIBLE, never i imagine it's a also big project
After your COMATE, i say to me, never a project can be also strong than him.
You have wonderfully explain to me, and never you believe, but i have all understand the goal
When i have say "SCRIPT", i believe it's another project like when several code send PB order in txt and the serveur execute, another PBSCRIPT what.
But no, like usually, you shoot really really more top, like the COMATE class, a SCRIPT like several professionals already use
I'm really surprising by your and Bitblazer explanations
I know they are several Script program, but i believe the script one and same part, included in the program, and not a program where after, a Script motor can to be connected
Anyway, i don't know several program have planned, like say Bitblazer to accept the connection of a Script motor if we want this function
Really, how you want that my admiration not increase in the same time you had a line to all your extraordinary projects
I wish you all the courage for terminate it, (the knowledge no need to wish something)
Thanks you in advance, and i follow you the most far possible, for not disturb you another time...
You do not need a ball more, the task is already enough hard
Again thanks for sent your precious time, again another time, for explain to me
@Bitblazer
Thanks for your explanation , after reading SROD great explanations and yours, i see it's again a giant professionnal option that SROD try to offer to PB community
Apparently, a more value also big than OLE, and i never believe it's another time possible
@KIFFY
Really thanks for recognize your unknowledge , if someone like you not understand...i had no chance to understand
@HEXOR
You are a big master of the WEB and network, i have admired several of your codes about this subject i'm not surprising it's you who begin the challenge
Even if the code is for KIFFY, thanks a lot for sharing it
The happiness is a road...
Not a destination
Not a destination
Re: New scripting engine - testers wanted!
I just had a quite annoying effect, where the exe didn't handle any scripts, while in debugging mode anything worked fine.
Needed to dive into the code and finally found this here in minScriptMAIN.pbi:
This is somewhat misplaced, no?
btw.:
How is the documentation progress going?
Needed to dive into the code and finally found this here in minScriptMAIN.pbi:
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
If InitScintilla() = 0
ProcedureReturn 1
EndIf
CompilerEndIf
btw.:
How is the documentation progress going?
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{Downloads}.:|:.{History Viewer Online}
Re: New scripting engine - testers wanted!
Ah yes I threw that in when I was about to add a Scintilla based code editor type component into the mix, but subsequently changed my mind. That needs to be removed.
Documentation... yea, about that... struggling to find the time right now.
Documentation... yea, about that... struggling to find the time right now.
I may look like a mule, but I'm not a complete ass.
Re: New scripting engine - testers wanted!
Could someone tell me how I could solve the following code with minScript:
Thanks in advanced
Code: Select all
var1 = 5
var2 = 10
var3 = 0
rel$ = InputRequester("Relation", "New relation betweeen var1 and var2 ", "AND")
;For example: the user enters "AND"
;Now I need to evaluate var3 = var1 rel$ var2, this is "var3 = var1 AND var2"
;
debug (var3) ;var3 should have the value 1
;
rel$ = InputRequester("Relation", "New relation betweeen var1 and var2 ", "+")
;now the user defines another relationship between v1 and var2, and enters "+"
;So I need to evaluate "var3 = var1 + var2"
;
debug (var3); var3 should have the value 15
QuimV
Re: New scripting engine - testers wanted!
The following lets you type in any expression of the form "result = ..." involving variables var1 and var2. Easily adapted for your uses.
This approach is probably the simplest way to pass some PB variables (by value) to a simple script. If a 'by-reference' mechanism was required then you could pass the addresses of suitable Purebasic variables and use our pointer class etc.
This approach is probably the simplest way to pass some PB variables (by value) to a simple script. If a 'by-reference' mechanism was required then you could pass the addresses of suitable Purebasic variables and use our pointer class etc.
Code: Select all
#minScript_HOME = "c:/PurebasicCode/minScript/Source/"
;Include the minScript source and check that it initialized ok.
XIncludeFile #minScript_HOME + "minScript.pbi"
If minScriptINIT <> #minScript_OKAY
Debug "minScript failed to initialize correctly."
End
EndIf
;Create a minScriptCode object and check the return value.
Define myCode.minScriptCode
myCode = minScript_NewCodeObject()
If myCode = 0 ;Typically a memory allocation issue.
Debug "Could not create a code object!"
End
EndIf
;Create variables.
var1 = 5
var2 = 10
;Return variable.
*returnVar.minScriptVariant = myCode\GetReturnVariantPtr()
;Request expression.
expression$ = InputRequester("", "Expression involving var1 and var2. Must be of the form 'result = ...'", "result = var1 + var2")
;Set up a simple script.
script$ = "DIM var1, var2, result AS INTEGER" + #CRLF$
script$ + "var1 = " + Str(var1) + #CRLF$
script$ + "var2 = " + Str(var2) + #CRLF$
script$ + expression$ + #CRLF$
script$ + "RETURN result"
result = myCode\Execute(script$)
If result <> #minScript_OKAY
Debug "Execution error info : "
Debug " Error code : " + Str(myCode\GetLastErrorCode())
Debug " Error source line number : " + Str(myCode\GetLastErrorLineNumber())
Else
var3 = *returnVar\i
Debug "Result = " + Str(var3)
EndIf
;Release the minScriptCode object.
myCode\Destroy()
I may look like a mule, but I'm not a complete ass.
Re: New scripting engine - testers wanted!
Thank You @srod
If I need decimals. How should I declare the types of the variables?
In the case of the following code, the result is always 0 (without decimals),
Why?
Regards
If I need decimals. How should I declare the types of the variables?
In the case of the following code, the result is always 0 (without decimals),
Why?
Code: Select all
DIM a as VARIANT
DIM b as VARIANT
DIM c as VARIANT
a=5
b=10
c=a/b
debug(c)
QuimV
Re: New scripting engine - testers wanted!
I wouldn't really recommend the use of variants unless you have a good reason for using them.
There are plenty of ways of doing what you want. The simplest way is to define the c variable as a REAL type (or simply define all the variables as REALs).
In this case, because c has been declared as a REAL type, the minScript compiler automatically 'promotes' the division to a 'decimal division' which will then yield the correct decimal result 0.5. This is not the case if the variable c is an INTEGER or VARIANT type.
An alternative, if you must use variants, is the use of the % type modifier operator as follows.
In this case, the use of %r (modify type to REAL) has the effect of casting a copy of the a variable to a type REAL. This then forces a decimal division and because the variable c is a VARIANT type, it can then hold the decimal value 0.5.
There is also the following use of the a similar type modifier to actually force one of the two variables to hold a REAL value (even though it is VARIANT type) :
As I say, I wouldn't recommend the use of VARIANTs when dealing with simple native types. They are really intended for holding class objects and the like.
There are plenty of ways of doing what you want. The simplest way is to define the c variable as a REAL type (or simply define all the variables as REALs).
Code: Select all
DIM a, b as INTEGER
DIM c as REAL
a=5
b=10
c=a/b
DEBUG c
An alternative, if you must use variants, is the use of the % type modifier operator as follows.
Code: Select all
DIM a, b, c as VARIANT
a=5
b=10
c=a%r/b
DEBUG c
There is also the following use of the a similar type modifier to actually force one of the two variables to hold a REAL value (even though it is VARIANT type) :
Code: Select all
DIM a, b, c as VARIANT
a=5%r ;Could use a=5.0 instead although in this case 5.0 is regarded as a CURRENCY type!
b=10
c=a/b
DEBUG c
I may look like a mule, but I'm not a complete ass.
Re: New scripting engine - testers wanted!
Thank You @srod,
Where can I find the different types of variables, INTEGER, REAL, VARIANT ... and what else? (and its abbreviations, REAL =% r)
Thanks in advanced
Where can I find the different types of variables, INTEGER, REAL, VARIANT ... and what else? (and its abbreviations, REAL =% r)
Thanks in advanced
QuimV
Re: New scripting engine - testers wanted!
All there is at the moment are some text files in the /Specifications subfolder.
The expressions.txt file gives some details on expressions although it is a little out of date.
A help manual? Well, I started one, but have no time right now to work on it as it is a very big job! There are only a couple of users of minScript right now and so the effort to create a manual is far more than I can justify right now.
NOTE that %r is NOT an abbreviation for REAL; it is a modifier. Do not confuse them.
The expressions.txt file gives some details on expressions although it is a little out of date.
A help manual? Well, I started one, but have no time right now to work on it as it is a very big job! There are only a couple of users of minScript right now and so the effort to create a manual is far more than I can justify right now.
NOTE that %r is NOT an abbreviation for REAL; it is a modifier. Do not confuse them.
I may look like a mule, but I'm not a complete ass.
Re: New scripting engine - testers wanted!
Thanks @srod for your information and for your kind help.
QuimV
Re: New scripting engine - testers wanted!
Is there at least something finished showing the coding rules?srod wrote:A help manual? Well, I started one, but have no time right now to work on it as it is a very big job! There are only a couple of users of minScript right now and so the effort to create a manual is far more than I can justify right now.
I wouldn't be interested in explanations how to integrate it into your host, but if my app goes final some day, I need some raw instructions for end customers to be able to use scripts.
If there is nothing finished and you don't think something like this will be released anytime soon, then please let me know, I have to pull something together then on my own.
I would share it of course, although my version will have some more "special" commands included.
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{Downloads}.:|:.{History Viewer Online}
Re: New scripting engine - testers wanted!
There will be a point when I need such a manual myself, but there is nothing which would be of any use right now I'm afraid. Sorry. My efforts thus far concentrated on integrating minScript into a host app.
I may look like a mule, but I'm not a complete ass.
Re: New scripting engine - testers wanted!
Seems I found a bug, the script engine dies in following script (I thought hexadecimal numbers are prefixed with $, my fault, anyway, it should never die)
Code: Select all
function main()
Dim j, k as integer
k = 2500
j = k & $0F
endfunction
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{Downloads}.:|:.{History Viewer Online}
Re: New scripting engine - testers wanted!
Fixed.
Hex numbers should be prefixed with 0x.
Hex numbers should be prefixed with 0x.
I may look like a mule, but I'm not a complete ass.
Re: New scripting engine - testers wanted!
Yes... yes... I knew this in the past, but I had to extend one of my scripts which I didn't touch for some weeks and just didn't think while extending (as usual)srod wrote:Hex numbers should be prefixed with 0x.
Thanks for the fix fix
btw.:
You still have this InitScintilla() thing in minScriptMain.pbi
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{Downloads}.:|:.{History Viewer Online}