Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / I Need DarkScript Examples

Author
Message
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 1st Apr 2007 23:09 Edited at: 2nd Apr 2007 00:36
Are there any "Good" examples of how to use DarkScript to make & edit 2D & Sprites, with GM file and DBPro File?

My project "MSDesign" is a DTP, so this could be useful in my project to Make "PlugIns", But some help files would be useful as any "Plugin" would need to edit in 2D on screen or a bitmap or to a sprite.

Is this even possable with DarkScript?

Once any plugin has done its business to a BMP/Img/Spr, It would also have to call a Compiled Function to get the bitmap so my system can update, and I have no idea how to call a Function in the DB Code from DarkScript?

And last question, Sharing Integers and Strings such as "ActiveSpr" and "Spr(n).Data$"

Be easy with me as its my first time using DarkScript

EDIT: This is what I've got so far


Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 2nd Apr 2007 02:13 Edited at: 2nd Apr 2007 02:14
If you are using the trial version of DarkScript it will not have some of the features I'm going to share below. I don't have my portable out to see if you're on the customer list.

Dbpro user functions are registered to the scripts in this fashion (taken from the help file).
Quote: "SCRIPT LOAD DBP FUNCTION
This command will create a new script command using a user DarkBASIC Professional function. To find the function number you count
each function within your DarkBASIC Pro source code in the order they are coded. The script command name is a string value you
specify that will be used in your scripts to call the DarkBASIC Pro function. The number of parameters is an integer specifying how
many variables your user function takes as input. Be sure to read the usage example for further comments and information on using this
command.

SYNTAX
SCRIPT LOAD DBP FUNCTION Function Number, Script Command Name, Number of Parameters"


For example if you used the command:

script load dbp function 3, "actAdd", 1

You would access that user command in the script like this:

dbpro.call( "actAdd" , Content );

To share variables between scripts and dbpro you can create global variables in your script file. Global variables can be created in this way:

global ActiveSpr;

That command will create a global variable with no value set named ActiveSpr. To set a value to any global variable from dbpro you will use one of these commands:

SCRIPT SET INT VARIABLE Script Global Variable Name, Integer Value
SCRIPT SET FLOAT VARIABLE Script Global Variable Name, Float Value
SCRIPT SET STRING VARIABLE Script Global Variable Name, String Value

It's also possible to use the command SCRIPT EXECUTE to set variables, or execute functions. Here's how to use SCRIPT EXECUTE to set ActiveSpr as 1 (assuming ActiveSpr in your dbpro code is equal to 1).

script execute "ActiveSpr = " + str$(ActiveSpr) + ";"

At some point you'll have to read those values you set in the script in dbpro, so to do that you can use one of these commands.

SCRIPT INT VARIABLE : Return Integer=SCRIPT INT VARIABLE(Script Variable Name)
SCRIPT FLOAT VARIABLE : Return Float=SCRIPT FLOAT VARIABLE(Script Variable Name)
SCRIPT STRING VARIABLE : Return String=SCRIPT STRING VARIABLE(Script Variable Name)

Keep in mind that the suggestions I gave in this post are only that. There are tons of ways to do the same thing with the DarkScript plugin, and users have really came up with some creative uses. Have fun exploring it, and feel free to ask questiosn anytime!

Login to post a reply

Server time is: 2024-11-22 17:16:23
Your offset time is: 2024-11-22 17:16:23