It is currently Wed Jul 18, 2018 10:56 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 132 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9
Author Message
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Wed Feb 14, 2018 12:46 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4190
Location: Lyon - France
@SROD
INCREDIBLE, never i imagine it's a also big project :shock:
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, :shock: but i have all understand the goal 8)

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 :shock:

I'm really surprising by your and Bitblazer explanations :shock:
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 :shock:
Anyway, i don't know several program have planned, like say Bitblazer :wink: to accept the connection of a Script motor if we want this function :shock:

Really, how you want that my admiration not increase in the same time you had a line to all your extraordinary projects 8)
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 :oops:

Image

Again thanks for sent your precious time, again another time, for explain to me :oops:

@Bitblazer
Thanks for your explanation 8) , after reading SROD great explanations and yours, i see it's again a giant professionnal option that SROD try to offer to PB community 8)
Apparently, a more value also big than OLE, and i never believe it's another time possible :shock:

@KIFFY
Really thanks for recognize your unknowledge 8) , if someone like you not understand...i had no chance to understand 8)

@HEXOR
You are a big master of the WEB and network, i have admired several of your codes about this subject 8) i'm not surprising it's you who begin the challenge 8)
Even if the code is for KIFFY, thanks a lot for sharing it 8)

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Thu Apr 19, 2018 10:38 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 468
Location: Hell
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:
Code:
CompilerIf  #PB_Compiler_OS = #PB_OS_Windows
  If InitScintilla() = 0
    ProcedureReturn 1
  EndIf
CompilerEndIf

This is somewhat misplaced, no?

btw.:
How is the documentation progress going?

_________________
Link dead?
Change h3x0r.ath.cx into hex0rs.coderbu.de and all will be fine.


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Fri Apr 20, 2018 8:24 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10413
Location: Beyond the pale...
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.

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Thu Jun 21, 2018 7:43 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 325
Location: BARCELONA - SPAIN
Could someone tell me how I could solve the following code with minScript:

Code:
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


:D Thanks in advanced

_________________
QuimV


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Sat Jun 23, 2018 11:52 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10413
Location: Beyond the pale...
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.

Code:
#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.


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Sat Jun 23, 2018 4:33 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 325
Location: BARCELONA - SPAIN
:D 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?
Code:
DIM a as VARIANT
DIM b as VARIANT
DIM c as VARIANT
a=5
b=10
c=a/b
debug(c)

Regards

_________________
QuimV


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Sun Jun 24, 2018 11:01 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10413
Location: Beyond the pale...
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).
Code:
DIM a, b as INTEGER
DIM c as REAL
a=5
b=10
c=a/b
DEBUG c

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.
Code:
DIM a, b, c as VARIANT
a=5
b=10
c=a%r/b
DEBUG c

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) :
Code:
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


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.

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Mon Jun 25, 2018 12:38 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 325
Location: BARCELONA - SPAIN
:D 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

_________________
QuimV


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Mon Jun 25, 2018 5:20 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10413
Location: Beyond the pale...
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.

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Mon Jun 25, 2018 5:46 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 325
Location: BARCELONA - SPAIN
:D Thanks @srod for your information and for your kind help.

_________________
QuimV


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Thu Jul 05, 2018 10:09 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 468
Location: Hell
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. :)

Is there at least something finished showing the coding rules?
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.

_________________
Link dead?
Change h3x0r.ath.cx into hex0rs.coderbu.de and all will be fine.


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Fri Jul 06, 2018 8:08 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10413
Location: Beyond the pale...
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 132 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye