It is currently Sat Dec 14, 2019 10:28 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 136 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10  Next
Author Message
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Tue Feb 13, 2018 1:22 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 10, 2017 6:17 pm
Posts: 302
Location: Germany
And you are on a successfull road Kwai, as more intelligent people like Thomas Edison said

What it boils down to is one per cent inspiration and ninety-nine per cent perspiration.

Also i like your gifs ;)

_________________
webpage


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Tue Feb 13, 2018 1:44 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4548
Location: Lyon - France
Thanks a lot at you two for your kinds words my friends 8) 8)

Bitblazer wrote:
Also i like your gifs ;)
Again thanks, i'm so happy to know someone else of me like this merveillous little numerical movies :D

Fangbeast wrote:
I never understand srod either
All the codes of SROD, is like amazing OYSTERS, i know they are a good thing to eat inside, and again better... know, they are obviously splendids pearls inside too :shock:
But like all the oysters, so hard, it's impossible to open, without break it :|
It's the reason why, never i open the SROD include file, or just one second for see the paradise and be affraid

Image

So i'm not sad because i don't understand the code, but this time it's worst....i not understand how use the code :shock:

Image

Imagine....working with SROD code, it's a little bit if FERRARI offer for zero euros several most beautiful cars at several members, show big demonstrations and explain how use it in front of me

Image

Everybody hyper happy, run, take a car, and leave with it in controlled skid 8)

And me.... alone behind my screen...

Image

I have not understand where enter the ignition key !!!!

Image

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


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Tue Feb 13, 2018 2:09 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jul 23, 2011 1:13 am
Posts: 221
Location: Germany
Kwai chang caine wrote:
Image

:mrgreen: :lol: :lol: :lol:


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Tue Feb 13, 2018 3:28 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4548
Location: Lyon - France
:lol:
Yes !!!! it's me, but only when i'm very very ......sad !!!! :mrgreen:

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


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Tue Feb 13, 2018 5:31 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10527
Location: Beyond the pale...
Kwai, the qdMin test editor is simply a test program of mine which, first and foremost, allows me to track down any bugs in minScript and fix them. It is just a convenient way of running simple minScript scripts. Nothing more.

The fact that you used qdMin to run one of my test scripts is good, but that is just the tip of the minScript iceberg! :) If you wanted to learn how to code in minScript then studying these test scripts would be a good starting point.

If you've ever used LUA in an application or programmed with Java/Javascript/VBScript then you have used a script engine before and minScript is no different. It is intended primarily (though it has a lot of other potential uses) for those developers who are working on an application of their own and wish to embed a script language within their app.

Have you ever used MS Access and created VBA (Visual Basic for Applications) code modules? There you are. MS Access is an application which has been built with a scripting engine embedded within it. This script engine allows users of MS Access (MS Access developers) to create code modules which can perform all sorts of tasks. I used to code VBA modules to create dynamic reports in MS Access.

You can do the same thing with minScript. That is, you can create an application and embed minScript within it. This would allow your application's users to perhaps create scripts which your app would then compile and run (using minScript) to perform any kind of task you see fit to allow.

Perhaps you want to write your own web browser, but instead of embedding Google's Javascript engine within it (for example, if you didn't want to write your own) you instead choose to embed minScript within! This would then mean that your browser would run, not Javascript scripts, but minScript ones. Of course abandoning Javascript would probably be a monumental mistake for a new browser! :)

So far, only HexOR has been brave enough to integrate minScript into one of his applications before I've even finished the minScript user manual. Actually, he started the integration before I had even started the user manual! :D Integrating minScript is not particularly difficult, though, like anything, there is a learning curve to negotiate.

If you're not really sure what a scripting engine is KCC, then you are probably not in need of one. :)

_________________
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: Tue Feb 13, 2018 7:21 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 1034
Location: Amphibios 9
Hello srod,

i declare my solidarity with kcc. I don't know either how such an integration should take place. :oops:

So it would be very nice if you could post a small Hello-World example how to use minScript from PB.

Image

Thanks in advance & Greetings ... Peter

_________________
Can't decide if i need a hug, an XXL coffee, 6 shots of vodka or 2 weeks of sleep.


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Tue Feb 13, 2018 7:39 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 10, 2017 6:17 pm
Posts: 302
Location: Germany
@kwai
I have written partition/disk imaging software in the past and could consider MinScript a usefull addition for that. It could automate a few special work tasks that the general user wouldnt need or the software developer of the imaging software didnt think of.

For example if you create a partition image, it is crucial to have a coherent static saving state and imagine a live database is running on that system. you cant just make a partition backup with the database in use or it could lead to a corrupted backup (worst case, a file is stored while its beeing changed). A simple way to fix that would be to stop the database, force it to flush all buffers to disk and probably even unload it - then backup the system which is now in a static coherent state and afterwards you re-enable the database again.

minscript would make these custom little tasks easily possible if the backup software allows to run a scipt before backup and after backup. An end user could automate this or cleanup tasks to enhance a third party software in a custom way. This is just one example and i fully intent to use minscript in the future for other projects :)

Another example would be a drawing/graphics program which allows to call filters - with minscript you could implement a special group of filters that you usually need to execute on your pictures (like desaturating the background, outlining foreground objects, use a pixelate/unsharpen effect on the background, enhance the foreground brightness and saturation a bit, compose the final image from the changed background and foreground buffers - minscript could automize these daily tasks and the enduser just presses a button to achieve a complex custom image manipulation.

For experienced users, these scripting interfaces are awesome and can make the difference if you use one tool or another.

ps: as i just got a tank game advertising after posting this, i thought "OH YEA, a script engine for a tank game to enhance the AI of a single tank or a group, would be very useful too" - imagine creating your own AI which helps you with tasks like "hold this bridge. If you are getting overrun - call help. if more important tanks call you to help - go and help them but send an alert to your chief, that you leave your bridge unguarded due to a backup call". The end user (player) could use these little AI enhancements to win in tournaments and playing with AI scripts could give a player a serious advantage (who can really control an army of 250 units of 30 types alone and be effective, i would place my bet on the guy who has scripted their AI well to offload micromanagement tasks.

pps: imagine automating the lookup of gif images to enhance forum posts ;) like ::cry:: opens a popup list of gif animations tagged with "cry / crying / tears" and offer to insert the one you choose - you could probably post twice as fast and with more animations even - now THAT example must make sense to you and make your eyes sparkle with joy ;)

_________________
webpage


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Tue Feb 13, 2018 8:10 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10527
Location: Beyond the pale...
Kiffi wrote:
Hello srod,

i declare my solidarity with kcc. I don't know either how such an integration should take place. :oops:

So it would be very nice if you could post a small Hello-World example how to use minScript from PB.

Image

Thanks in advance & Greetings ... Peter


In the 'Demos' folder there are a couple of .pb test programs (IntegerArithmetic.pb is one such) amongst all of the test scripts (text files) that show how to call a simple script. The qdMin test editor is a more involved example of integrating minScript - though one with a somewhat limited 'brief'.

Integrating minScript into a 'proper' application generally requires a whole bunch of steps which I cannot possibly outline in a simple "HelloWorld" type example (adding run-time functions, user-defined types and the like). That requires some studying and... a user manual - which is coming!

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


Last edited by srod on Tue Feb 13, 2018 10:30 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Tue Feb 13, 2018 9:50 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 1034
Location: Amphibios 9
srod wrote:
In the 'Demos' folder there are a couple of .pb test programs (AddIntegers.pb is one such) amongst all of the test scripts (text files) that show how to call a simple script.

My bad, I completely overlooked the PB files. 8) I think I'm gonna be okay on my own now. :D

Thanks and Greetings ... Peter

_________________
Can't decide if i need a hug, an XXL coffee, 6 shots of vodka or 2 weeks of sleep.


Top
 Profile  
Reply with quote  
 Post subject: Re: New scripting engine - testers wanted!
PostPosted: Tue Feb 13, 2018 10:19 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10527
Location: Beyond the pale...
In the specifications folder there are some text files which outline minScript's API etc. The file "ConstantsAndStandardRuntime.txt" contains a list of all global constants, standard run-time functions and user-defined types (e.g. arrays, classes...) defined by minScript itself for use by any script.

In terms of adding your own run-time functions and the like, you need to delve into the minScript source to see how that is done. At least until the user manual is complete that is. I will include a copy of the manual in whatever incomplete state it might be in, the next time I upload a version of minScript. An incomplete manual is better than no manual! :)

_________________
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: Tue Feb 13, 2018 11:05 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 519
Location: Hell
For anyone who wants to dive a little deeper into minscript.

I've created this small example for Kiffi, this should help to get you started until we are waiting for the documentation:
Code:
#minScript_HOME = "E:\User\HeX0R\Documents\Sources\PureBasic\minScript\Source\" ;<- change!
XIncludeFile #minScript_HOME + "minScript.pbi"
;the init is already running there, so we'll check if it went smoothly
If minScriptINIT <> #minScript_OKAY
   Debug "something went wron..."
   End
EndIf

Structure _MyCodeObject_
   myCode.minScriptCode        ;<- Code Objekt
   *returnVar.minScriptVariant   ;<- return pointer, if you call a minScript function with PB, the return value is written in it
EndStructure

Global mS._MyCodeObject_


;Host function, called by minscript
Procedure mystrd(codeObject.minScriptCode, fnID.l, numParamsPassed, *params.minScriptVariantParameters, *ret.minScriptVariant)
   Protected i, Var.s, *Sp.STRING, d.d, result = #minScript_OKAY
   
   ;codeObject is here the same as mS\myCode
   ;fnID is a unique index describing the function, you define it when loading.
   ;numParamsPassed is the number of parameters you get.
   ;You can react here to completely different number of parameters accordingly.
   ;params is an array with the parameters that the function got
   ;you can use *ret to send something back to the script.
   If numParamsPassed = 1 ;
      ;to be on the safe side, we'll make sure we have a string.
      If minScript_VarChangeType(*Params\index[0], #minScript_String) = #minScript_OKAY
         *Sp  = *params\index[0]
         Var  = *Sp\s
      EndIf
     
      d = ValD(Var)
      ;now we set the return value for the script
      ;In contrast to LUA, you can only use a maximum of ONE return value!
      minScript_VarSetReal(*ret, d)
   Else
      result = #minScript_INCORRECTNUMBEROFPARAMETERS
   EndIf
   
   ProcedureReturn result
EndProcedure

;Initialize our mS structure
mS\myCode = minScript_NewCodeObject()
If mS\myCode = 0
   Debug "can't create aCodeObject!"
   End
EndIf
;and get us the global return pointer
mS\returnVar = mS\myCode\GetReturnVariantPtr()

;now we introduce the script with our host function
;important! They must be created BEFORE the code is loaded!
minScript_AddRuntimeFunction("mystrd", 1, @mystrd())  ;<-Runtime functions are valid for all modules!
                                                                                    ;If you don't want to do this, you must initialize a new CodeObject.
                                                                                    ;Then everything is encapsulated
                                                                                    ;The 1 is a numeric number that describes this function uniquely and is also passed in the host application (as fnID)
                                                                                    ;So the next one would have a 2,3, or even 10,30,....

;o.k., we're ready!
;You can load whole scripts with the PB file-commands, put the whole thing together to a big string and then load it, we'll make it easier and use a string.

SCRIPT.s = "function multi(a as real, b as real)" + #CRLF$ +
           "   Dim result as real ;no need for a local variable, but we use it here!" + #CRLF$ +
           "   result = a * b" + #CRLF$ +
           "   return result" + #CRLF$ +
           "endfunction" + #CRLF$
           ;in the next function we use a host (PB) function (minscript doesn't know mystrd())
SCRIPT +   "function bla()" + #CRLF$ +
           "   Dim result as real" + #CRLF$ +
           "   result = mystrd(" + #DQUOTE$ + "1.25E-3" + #DQUOTE$ + ")" + #CRLF$ +
           "   return result" + #CRLF$ +
           "endfunction"


;Now let's load this into a module, you can load several modules, call the calls by module name:FunctionName() to explicitly use the function of a module.
If mS\myCode\AddModule("HansWurst", @SCRIPT) <> #minScript_OKAY
   ;we got some mistakes in there, let's take a look at them:
   Debug "  Error code : " + Str(mS\myCode\GetLastErrorCode())
   Debug "  Error line number : " + Str(mS\myCode\GetLastErrorLineNumber())
   Debug "  Source line : " + mS\myCode\GetLastCompilationErrorLine()
   End
EndIf
;All right, this thing's loaded now.


;Now we're ready.
;First test, we let minScript calculate for us.
If mS\myCode\Execute("return HansWurst:multi(3, 5)") <> #minScript_OKAY
   ;oha, another mistake, check it out
   Debug "  Error code : " + Str(mS\myCode\GetLastErrorCode())
   Debug "  Error source line number : " + Str(mS\myCode\GetLastErrorLineNumber())
   Debug "  Error function name : " + mS\myCode\GetLastExecutionErrorFunctionName()
   Debug "  (If 'Error function name' is NULL then the error occurred within the \Execute() method call.)"
Else
   ;has worked out, let's have a look at the result, we just want a real one anyway, so
   If minScript_VarChangeType(mS\returnVar, #minScript_REAL) = #minScript_Okay
      Debug minScript_VarGetReal(mS\returnVar)
   EndIf
EndIf

;Second part, we call our PB function
If mS\myCode\Execute("return HansWurst:bla()") <> #minScript_OKAY
   ;oha, another mistake, check it out
   Debug "  Error code : " + Str(mS\myCode\GetLastErrorCode())
   Debug "  Error source line number : " + Str(mS\myCode\GetLastErrorLineNumber())
   Debug "  Error function name : " + mS\myCode\GetLastExecutionErrorFunctionName()
   Debug "  (If 'Error function name' is NULL then the error occurred within the \Execute() method call.)"
Else
   ;anything fine, let's have a look at the result, we have a real one again.
   ;(minScript uses variants, if you are sure that you got a real one, you can give yourself a lot of stuff here and access mS\returnVar\r directly)
   If minScript_VarChangeType(mS\returnVar, #minScript_REAL) = #minScript_Okay
      Debug minScript_VarGetReal(mS\returnVar)
   EndIf
EndIf


Tipp:
I would scan minScript.pbi, minScriptVariants.pbi and minScriptMAIN.pbi to be able to use auto complete functionality of the IDE. (@Stephen: didn't you say you will change this? :twisted:)

[Edit]
I think my remark regarding minScript_AddRuntimeFunction is wrong. As long as there is no possibility to send a codeobject to the function, the runtime functions will still be global, even across different codeobjects.
Or am I wrong?

_________________
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: Tue Feb 13, 2018 11:51 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10527
Location: Beyond the pale...
If anyone downloaded version 1.0.7 of minScript before the time recorded against this post, then please download again. There was a bug with class destructors which I just fixed. Stopped one of the demos working.

HeX0R wrote:
Tipp:
I would scan minScript.pbi, minScriptVariants.pbi and minScriptMAIN.pbi to be able to use auto complete functionality of the IDE. (@Stephen: didn't you say you will change this? :twisted:)


No. :wink:

HeX0R wrote:
I think my remark regarding minScript_AddRuntimeFunction is wrong. As long as there is no possibility to send a codeobject to the function, the runtime functions will still be global, even across different codeobjects.
Or am I wrong?


All run-time functions are global in that any module in any code object within the host application has access to each and every function. You can't hide 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: Wed Feb 14, 2018 12:04 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 519
Location: Hell
srod wrote:
All run-time functions are global in that any module in any code object within the host application has access to each and every function. You can't hide them!

O.k., I thought I'd read that this has changed (/improved?).
No problem, I'm fine with that, you know the trick I'm using already :lol:

btw. here is a minscript.ini you could use for PSPad editor.
Not complete I guess, but this beast is improving faster than I can edit this ini ;)
Code:
;PSPad user HighLighter definition file
[Settings]
Name=minScript
HTMLGroup=0
Vectors=0
Label=1
FileType=*.script,*.tscript
CommentString=
BasComment=1
IndentChar=
UnIndentChar=
TabWidth=0
DoubleQuote=1
EscString=1
EscChar=\
KeyWordChars=_
CodeExplorer=ftUnknown
DocComment=
[KeyWords]
and=
as=
case=
currency=
debug=
default=
dim=
integer=
let=
method=
or=
private=
property=
real=
return=
step=
string=
stringbuilder=
variant=
xor=
[ReservedWords]
break=
else=
elseif=
class=
endclass=
endfunction=
endif=
endmethod=
endselect=
for=
function=
if=
next=
repeat=
select=
until=
wend=
while=
[KeyWords2]
and=
array=
as=
debug=
integer=
real=
string=
table=
tocurrency=
tointeger=
toreal=
tostring=
[KeyWords3]
allocatememory=
asc=
chr=
freememory=
isclass=
isfunction=
isobject=
isruntimefunction=
lcase=
left=
len=
mid=
nothing=
peekb=
peekc=
peekcurrency=
peekf=
peeki=
peekl=
peekr=
peeks=
peekw=
pokeb=
pokec=
pokecurrency=
pokef=
pokei=
pokel=
poker=
pokes=
pokew=
reallocatememory=
right=
sizeof=
space=
str=
strfix=
stringbytelength=
throwerror=
trim=
truncate=
typeof=
typeof2string=
ucase=
stringfield=

_________________
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: Wed Feb 14, 2018 12:19 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10527
Location: Beyond the pale...
Yea there just comes a point where things get too complex and too muddled. Adding module-level run-time functions would just muddy the waters too much and, honestly, I don't think there would be a great demand for them. I can certainly not envisage a use for that facility myself.

What I could do is provide a means through which a run-time function can determine which module invoked it. Considering you can pass as many parameters as you wish to such a function anyhow means that, in effect, you can override any such function as many times as you wish. This, when combined with the means of determining which module invoked it, means that the function can adapt to individual modules.

I could add this without complicating things for other users of minScript. Would this help?

_________________
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: Wed Feb 14, 2018 12:46 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 519
Location: Hell
I can only speak for myself here.
I wouldn't use that option, at least not in my current project, the only option I would use would be a codeobject-wise runtime-function option.
But I have already a usable solution and I'm fine with that.

Better go on with the documentation (and improved auto complete support :twisted:, no I'm not givin' up, constant dripping caves the stone HaHaHa)

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


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 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