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 / The Matrix1Utils plugins collection

Author
Message
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Dec 2006 21:08
OK... I have no idea how that works



It looks good anyway

Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 27th Dec 2006 14:55
Hey IanM can you make that your MID$() into FAST MID$() because they look confusing if they have same names. I'm right know working on text editor so I use your string commands all the time and I must really say they are lightening fast. Thanks for the great work you are helping this community.

AMD Sempron 3.1+ Ghz, 512MB Ram, ATI R9550 256MB Ram, Sound Blaster Live!, WinXP SP2, DirectX 9.0c, DBP 6.2
http://www.myspace.com/producerolby
JDforce
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: Sea of Tranquility
Posted: 28th Dec 2006 00:46 Edited at: 28th Dec 2006 00:48
Hi IanM, Perhaps you could give me a hand on these, or make a plugin dll that contains this...
Am looking for a way of set transparency for the main window, on a given color key. It means that if the window background is black and I set it's transparent color to rgb(0,0,0), then everything in the window will be see-thru. I want to put some DirectX models to float in midair on my desktop, interactively.
With delphi it is a breeze, just set transparentcolor to true and then set the color.
But trying to make a dll for Dbpro use, I found a little hard to get the handle of the main dbpro window. Am not expert on c++, but making the main form a "layered window" and setting its alpha or colorkey attributes it can be done. Am suffering from the simplicity of delphi!
Thanks,

Julio

Edit: This should be something similar to the setwindowregion used in window skinning (non square shaping) plugins.

May the 3d force B with U
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Dec 2006 12:14
Here's some code that I've played around with:


In summary: I couldn't get the damned thing to work!
The window border can be made transparent by changing the alpha level of the window, but the bit drawn by DirectX just stays fully opaque. I can see why that would be and have no idea on how that can be overridden. DirectX just does not play well with the GDI.

JDforce
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: Sea of Tranquility
Posted: 28th Dec 2006 17:38
Well, You definitely pointed out how to obtain the handle ID of the DBPro window, and I did a test. Thanks for that!

My PC has dual monitors, with a couple of nvidia cards, each different (a fx5500 and a mx4000). The funny note is that the program does not work at all on whatever I set as primary monitor, but it definitely works great on the secondary one, if I set either the fx5500 or mx4000 as primary or secondary.

Programs I have done using Delphi and Truevision3d Sdk, or another directX tools have the same exact results. I posted here screen shots for both DBpro (using your code) and Delphi programs, leaving the window border and title bar visible, for easy window dragging. The screen capture is wide, but it actually is displayed split in half and to the corresponding monitor. You can see the mess left in the primary monitor, pointed by red arrow annotation. (the black background window is inactive garbage not cleaned by directX when I dragged the program window to the secondary monitor)

On the other hand, using delphi and openGL, there is no trouble at all. I attached here a test program with media. The problem yet is to use directX models in OpenGL, and the sadness of not being able to use darkBasic or directX.

As a final note, I have been thinking and failing on this for months but I downloaded the skycar from www.yummy-media.com and it definitely is a directX program, just by examining its installation folder. The car, I think, is a full screen window, borderless and with transparent background. And the controller is a skinned window.
So, there is a way. We are getting close...

May the 3d force B with U

Attachments

Login to view attachments
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 26th Feb 2007 21:37 Edited at: 26th Feb 2007 21:37
IanM, several years ago you and empty worked on a function pointer dll for dbpro, but you never released it to the public (see here). A dll that would allow you to reference functions either by address or by any value is exactly what i need in order to efficiently incorporate function overriding and polymorphism into oodbp. I would very much appreciate it if you could send me a copy of your dll, if it is functional. I've sent an email to your email address found in your profile, but i wasn't sure if you actually use that any more, so i thought it was a good idea to post here. You can contact me at: xbmodman42@comcast.net

Thanks,
Mike

Who needs a signature?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Feb 2007 22:33
I do have a plug-in, but it's not functional ATM - I basically started again with a better supporting structure, and haven't got around to completing it. Last modification was 29/04/2005

I'm quite busy ATM with other stuff, but I'll make sure this is at the top of my TODO list when I get a little more free time in a week or so.

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 26th Feb 2007 22:55
Thanks IanM, I really appreciate it.

Who needs a signature?
JDforce
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: Sea of Tranquility
Posted: 2nd Mar 2007 16:10
Just a dumb question IanM, I checked the matrix site but it seems to be very outdated. The versions here at TGC are new. I know maintaing a site is sometimes too much work, but anyway you advertise it in your footer. Why not place links there to the new files? Your plugins are great.

May the 3d force B with U
Radek Inkom
17
Years of Service
User Offline
Joined: 28th Feb 2007
Location: Poland
Posted: 12th Mar 2007 01:25
IanM

I try to load my dbo objects into memory blocks in the background
using your Matric1Async next I copy memblock using MAP MEMBLOCK TO BANK next I try to load object using MAKE OBJECT FROM BANK.

App work very fast but I have a problem: only one of my textures is loaded.
It's a big map with tga textures.
Could you help me?

Here is my testing code:

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Mar 2007 23:55
I'll take a look at it, but I'll need a dbo object you are having problems with, and the textures for it too. You can email me direct if you don't want them to become public.

TinTin
18
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 14th Mar 2007 17:34
Here's the fastest ABS() code I can find...



I don't know what type of code DBP uses, I'd like to think thats it's no more complex than this...


Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Alquerian
18
Years of Service
User Offline
Joined: 29th Mar 2006
Location: Reno Nevada
Posted: 14th Mar 2007 19:32
Ian - I have been using this for months and I don't know why I haven't spent more time on this forum topic. The utilities are very useful and I just wanted to thank you, as I have found use for many of them.

So... Thanks

Quit planning to make a game and make a game.
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 14th Mar 2007 22:22
Hey IanM!

I just watched my old threads and saw you have answered in my "How to hide taskbar button" thread that it is possiple to hide the "Application Button/Taskbar Button" and you could add it to Utilties plugin so im very intrested about this one cuz im making sometimes app's what dont need the button in taskbar.. They are often desktop app's (cant be minimized) or System Tray app's..

So im very intressted this stuff so can you add it?



IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Mar 2007 23:21 Edited at: 14th Mar 2007 23:22
@Alquerian,
You are very welcome

@The Full Metal Coder Roxas,
Yes. I've just imported/updated my test code into one of the DLL's and it'll be available in the next release ... which will be coming when I've fixed a few bugs, and added a few new commands. A few days at the most hopefully.

@Radek Inko,
There's no bug there in my DLL - it's a problem with DBPro's DBO load routines. Basically when the DBO file was saved, all of the texture filenames inside it were written as if they were in the executables directory. When you put everything into a subdirectory it can no longer find the textures - it expects them to be in the current directory.

If you put all of the textures into your program directory, the object will be textured correctly when it loads.

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 14th Mar 2007 23:40
Ok thanks IanM!



Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 16th Mar 2007 03:19 Edited at: 16th Mar 2007 04:34
Hey IanM. I don't mean to be demanding, but any progress with your function pointer dll? If you haven't worked on it or don't have the time that's ok, i was just wondering

Who needs a signature?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Mar 2007 15:02
Haven't had the time, but that's changing now. I'll soon be releasing the next version of the utils plug-ins, which then puts the pointer library at the top of the list.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 17th Mar 2007 17:05 Edited at: 17th Mar 2007 17:18
YAY! Matrix_Utils is definitely useful!

Edit:
On the DBP 3rd party dll list, it says that the matrix utility dll was open source. If this is true, could you post a link I'm still learning how to write dlls for darkbasic

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Mar 2007 21:14
These ones aren't, but I have left the original utils plug-in and it's source code on my site. Get it from here: http://www.matrix1.demon.co.uk/DBPro/downloads/Matrix1Utility04.zip

While you are playing with it, you'll need to move the newer utils plug-ins out of the way otherwise they'll clash.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 18th Mar 2007 00:40
I get an error 404 whenever I try to visit that page, I've already tried that link. Does it work for you?

Please could you email it to me (My email is usually very reliable)

Thanks in advance, because I'm going to bed now!

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Mar 2007 03:00
Here's that new update - mostly bug fixes, plus one new plug-in (treat as experimental for now):

Matrix1Util_13 1.0.0.3
Added HIDE APP ICON and SHOW APP ICON commands to hide the application from the taskbar.
Fixed crash when DBProSetupDebug was not a part of the build.

Matrix1Util_15 1.0.0.2
Fixed crash that occurred during shutdown of the app.

Matrix1Util_16 1.0.0.3
Added check to FastLen for uninitialised strings.
Reverted to slightly slower but safer string length check because the fast one sometimes crashes.

Matrix1Util_19 1.0.0.1 New Plug-in
Keep track of objects in existence, and group them into categories.


Here's some basic example code for the new plug-in.

First, list all objects in use, and whether they are full objects, clones or instances:


The only reason for two loops is that if you delete the base object, its instances are also deleted - if I deleted in the first loop, I wouldn't see the instances.

Using the same type of arrangement, you can also run through all objects within a group.

Attachments

Login to view attachments
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Mar 2007 19:21
Here's another simple example using object groups:


If you hit '0' all of the cubes are hidden or shown. If you hit '1' then it's the spheres that are hidden or shown. As you can see, a group can be used to identify a type of object.

Take this a step further, for example in an RPG. Your player collides with an object ... what is it? Well, if you arrange your objects into groups (group 0 = static objects, group 1 = traps, group 2 = doors, group 3 = random magical item), then you can simply check the group that the object belongs in to see what you should do with it. And as you can have as many groups as you want, there's nothing to stop you having a group just for longsword + 3 if you want to.

Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 18th Mar 2007 22:41
These are nice ideas and, as with everything IanM does, very very solidly coded. A tip of the Bear's famous pic-a-nic basket to his Ianship.

Cheer if you like bears! Cheer if you like jam sandwiches!
"I highly recommend Philip" (Philip)
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 19th Mar 2007 18:49
Nice! Thank you IanM! Finally i can make TGC Desktop App



Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 19th Mar 2007 22:01
I've found a problem. The compiler whinges that the get display width command in matrix1dll_13.dll file is duplicated in the TGC enhancements plugin. IanM, please can you change the name of your command?

Cheer if you like bears! Cheer if you like jam sandwiches!
"I highly recommend Philip" (Philip)
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Mar 2007 22:48 Edited at: 19th Mar 2007 23:02
Poo!

Oh well, in that case here's the latest pack of utility plug-ins with that fixed, and including the earlier-than-I-wanted-to release of the function pointers plug-in.

High-points include:
A better & safer method of getting pointers to DBPro functions.
Calling functions is safe because all pointer are validated before use - if you didn't get the pointer from this plug-in, it isn't valid!
Standardised interface to both DBPro functions and functions loaded from a DLL.
No worries about whether the function you are calling uses cdecl or stdcall calling conventions.

Here's some code that I used for testing:


Although it's an earlier release than I really wanted, it's pretty much in it's final shape and includes all of the commands and functions that are useful for general use. It's also pretty solid due to the amount of validation that's built into it.

The only thing I can think of that is still to be added is a method of providing a call-back function that can be used in windows.

Attachments

Login to view attachments
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 20th Mar 2007 04:44 Edited at: 20th Mar 2007 05:13
Once again IanM, thank you for releasing the function pointer dll. OODBP couldn't be completed without it. This brings the number of your dlls used by oodbp up to 2

One thing that is a little problematic is the fact that you can only assign return values directly to variables. This means that with oodbp, for instance, you will not be able to nest method calls (that is unless i have it dramatically modify source code and increase runtime overhead). I guess i'll just have to work around these limitations though.

Thanks again,
Mike

Who needs a signature?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Mar 2007 09:58
Unfortunately there's nothing I can do about that - the DBPro LOAD DLL/CALL DLL system has exactly the same issues. You must pass the correct type, and you must put the result into a variable of the correct type.

Maybe I can come up with a set of casting functions that will help out, but it will mean an extra function call per argument, plus one for the result.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Mar 2007 20:32 Edited at: 20th Mar 2007 20:34
Now I can correct the problems with releasing too early - some examples of function pointers in action:

First, using a single routine for many purposes. In C there is a function called qsort that accepts an array and a function pointer that it can use to compare elements. I'm not quite there yet - the nearest for now is to pass a pair of numbers for the range of the array, and a function pointer to compare and swap items.

Here's the code, using a single bubblesort routine to sort and integer array, then a string array:


The functions called via the function pointers take care of all of the array access, and the sort routine doesn't know or care about what it's sorting.


Next is an example of moving objects using different behaviours, without using an 'if' in the main update function:


I'm sure that Philip in particular will be interested in this use of function pointers to control behaviour patterns of objects.

Also, if you think about the concept shown here a little more, then you'll see that it's easy to use an array filled with function pointers in a state machine - if you've read BatVinks Invader tutorial, you could replace the select statement in the 'GamePlay()' function with a function pointer call to individual small functions that action the cSTARTGAME or cSTARTLEVEL functions.

This arrangement of an array of function pointers is usually called a dispatch table, and is the kind of thing that Milkman will be building for each class to provide polymorphism in his OOP for DPPro preprocessor.

Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 21st Mar 2007 01:28
Thanks for fixing the conflict Ian. I've swapped over all the matrix 13.dll files across and its sorted the compiler error. I have one quick question though - apart from the files relating to matrix 13.dll and the new matrix 20.dll files, I'm assuming that nothing has been changed with the other dll files? In other words, I don't have to re-copy all the other matrix dll files from the latest zip file?

I'm interested in your example code showing how to use functions to control behaviour. In fact, on that note, last night I finished integrating DarkPhysics with my DBPro OpenSteer library (which I posted last year).

Cheer if you like bears! Cheer if you like jam sandwiches!
"I highly recommend Philip" (Philip)
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 21st Mar 2007 11:18 Edited at: 21st Mar 2007 11:21
Seems kind of silly always having to ask you to rename some of your commands. Do you know a way I can remove commands from a dll to fix the conflicts? Alot of the STYX dll's string commands have the same names as yours. I wish everyone could just adda couple of initials to the beginning of their commands on add on dlls.

[edit] Commands are:

compare, insert, instr, replace, and trim

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Mar 2007 15:17 Edited at: 21st Mar 2007 19:10
Well, I do spend a long while making sure that none of my plug-ins clash with existing plug-ins when I create them ... but in this case, I was here first - guaranteed - since these commands have always been in the utility plug-ins right back to its original incarnation as one of the first publicly released plug-ins in 2002.

I did rename the display width/height functions in the one plug-in for Philip, as I'm always jumping the wrong way with that one - it's my mistake so I fixed it.

The best I can offer is that you move that single DLL to one side (one of the reasons I deal with lots of small plug-ins now rather than do-everything plug-ins).

Alternatively, you can use a resource hacker to change the first character of the clashing commands to the remark character ` if you need commands from my plug-in that aren't in Styx.

[EDIT]Now I read this again, it comes across as a bit snotty - didn't mean it to be

@Philip,
The only change from the previous zip was the renaming of those two functions, and the addition of the function pointers plug-in. If you are talking about earlier versions you used, I'd suggest that you just overwrite all of the plug-ins with earlier versions as I can't guarantee that the old functions will work 100% with the newer versions of DBPro.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 21st Mar 2007 21:40 Edited at: 21st Mar 2007 21:52
Quote: "Alternatively, you can use a resource hacker to change the first character of the clashing commands to the remark character ` if you need commands from my plug-in that aren't in Styx."


I'll give this a try since I really need the fast string commands I had you to add

[edit] Man that worked great

jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 23rd Mar 2007 19:21
@IanM....not snotty at all, mate. You are a developer, you have the right to name your function whatever makes sense to you. Long ago, I had a conflict with two libraries, and had to rename one and recompile...no big deal, really, but it led me to start prefacing the function names, constants, MACROS with "br", or whatever seemed to give me a unique name.

Snotty would've been calling it "TabbedTextOutForWimps", for example.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Mar 2007 02:16
Quote: "you have the right to name your function whatever makes sense to you"


Yep, but I like English-like names - I have an aversion to prefixes, probably a spill-over from reading too much hungarian notation

The only function name I've used that I don't like is COUNT ... It's too generic a name. A prize of 19 general utility plug-ins to the person who gives me an alternative name for this function that counts the number of occurrences of a string within another string

Finally, just to please LiT, I've been going through the string plug-in over the past few days, and made improvements in speed and safety in pretty much all of the functions there. The replace, remove and insert functions in particular have all had a good going over to make them faster and safer.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 24th Mar 2007 11:02 Edited at: 24th Mar 2007 11:45
Quote: "Finally, just to please LiT, I've been going through the string plug-in over the past few days, and made improvements in speed and safety in pretty much all of the functions there."


Awesome, I'll give them a work out when done. I will be using alot of string commands from your dll very shortly in my 3dw Importer (after I get the terrain loading). I will make 2 versions:

One using your functions and one using the built in DBP code for the insane people who dislike using plugins even at the expense of running slow. *slaps insane people around*

Your plugin made my CSM file parser code go from 3.5mins to around 45secs on my work computer. Keep up the great work

[edit] Also just seen this:

Quote: "The only function name I've used that I don't like is COUNT ... It's too generic a name."


Thats one of the ones I have to change alot because alot of people use it. Thanks to reshacker it now has a new name

num instr( "blah1blah2", "blah" )

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 24th Mar 2007 16:30 Edited at: 24th Mar 2007 16:31
Quote: "A prize of 19 general utility plug-ins to the person who gives me an alternative name for this function that counts the number of occurrences of a string within another string"

occurrences()


Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 25th Mar 2007 16:48
@IanM, I have what may be a silly question regarding the "pointers to function" functionality in your new dll.

My understanding of C is that you can call a function via a pointer to the function and that you can also therefore pass the pointer as an argument to another function. My potentially silly question is: does your new dll permit that in DBPro?

Cheer if you like bears! Cheer if you like jam sandwiches!
"I highly recommend Philip" (Philip)
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Mar 2007 17:16
If you mean like the bubblesort example I posted a few days back, then the answer is yes.

In that example, there are functions that accept two arguments that refer to positions within an array. When called, they will compare those array items and swap them if the first is less than the second, and will return 0 for no swap, or 1 if a swap took place.

The bubblesort itself accepts a function pointer as an argument. It doesn't know anything about the array type it is sorting - it just knows that if it calls the function it will get a 0 if the items were not swapped, or a 1 if they were.

When you call the bubblesort, it is called with the start and end positions in the array you want to sort, and a function pointer to the compare&swap function.

Does this description match what you want to do? 'Pass a function pointer around, and call it when needed, if at all'

vibe runner
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: The Future
Posted: 26th Mar 2007 15:06
Quote: "The only function name I've used that I don't like is COUNT ... It's too generic a name. A prize of 19 general utility plug-ins to the person who gives me an alternative name for this function that counts the number of occurrences of a string within another string"


I cannot even begin to tell you how true this is. When I installed your (essential) plug-ins I was gutted to have to revist just about ALL my code and change COUNT to COUNTER. Also a number of other DBP programs use COUNT, including the Newton Physics demos. You have to amend them all to get them to compile.

How about:

Quote: "STRING COUNT
SUBSTRING COUNT
FAST COUNT"


I also dislike the replacement of DBP functions, is it MID$ you replaced? I forget. You should have used FAST MID$ or whatever. (IF I'm wrong on the MID$ thing, forgive me!).

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Mar 2007 15:20
I have exactly the same problem with that COUNT function, my own code included - that's why I want to change it.

MID$ is an overload of the existing one - it's an 'as well as' type function. Basically, it doesn't cause any problems when used alongside the existing function as it has an extra argument. I've no plans on renaming it, because it doesn't need renaming.

The FAST functions are named that way because they are 'replacements of' the existing ones. They don't have different arguments to the ones that they replace, so they had to be given different names.

Anyway, so far I like STRING COUNT best as the replacement name for COUNT. Unless anyone has a problem with it, it'll be set to that in the next release.

vibe runner
18
Years of Service
User Offline
Joined: 7th Aug 2006
Location: The Future
Posted: 27th Mar 2007 13:12
I understand now about overloading on the existing function, that is it shouldn't affect existing functionality, so no worries there any more.

Coin
19
Years of Service
User Offline
Joined: 15th Mar 2005
Location: Bexley, UK
Posted: 27th Mar 2007 18:43
Ian, I've probably overlooked mention of this earlier in the thread, but the link to "Matrix1Utility04.zip" on your website appears broken. Any chance of fixing this? I find the Zones functions very useful. (I have recently had to re-install everything from scratch).
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Mar 2007 03:02
It's still broken? Oh, well in that case, you'll find that the new util plug-in 21 contains the old zone commands, plus a few more

Here are the changes to the existing plug-ins:


Most of the changes are minor, but I pretty much rewrote the strings plug-in (16), and added two more new plug-ins (11 and 21).



The 'aliasing problem' is something you'll see there a few times. Basically, aliasing is when the same string pointer gets passed to a string routine several times:

a$ = mid$(a$, 1, 1)

My old code would delete the 'old string' immediately, which just happens to be the string I want to get data from ... crash! but not all of the time. The new code arrangement avoids that problem.

Attachments

Login to view attachments
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Mar 2007 12:38
Oops, during the rewrite of the MID$ command, I removed the special functionality when you specify a size of 0 (get the rest of the string).

That's back in with this release.

Attachments

Login to view attachments
Coin
19
Years of Service
User Offline
Joined: 15th Mar 2005
Location: Bexley, UK
Posted: 29th Mar 2007 00:48
Thanks, Ian, I have now got the Zones commands I wanted. However, the link to your Matrix1Array commands on the "3rd party dlls" page is broken. Are they still available?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Mar 2007 10:50
I think that I've fixed the problem on my site. It was a small mistake in the filename. It should be available again.

Seriously though - you should consider switching over completely to this set of plug-ins instead. It contains everything of use from the original plug-in and so much more, at higher speeds (especially the string commands now).

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 29th Mar 2007 12:21
Cool. I have fixed all the conflicts by adding "FAST " to the beginning of the names like the replacement commands you made for me I can now use your commands for my use and just remove that when posting for the insane people mentioned in earlier post. I haven't had time to fully test them yet but a few quick compiles seem fine. Thanks man

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Mar 2007 16:41
You're welcome.


I'm currently playing around with a few small ideas while I'm watching the double-glazing fitters do their thing, and I thought I'd post something I've thrown together this morning.

One of the things that happens so often in games is that you want some code to run every frame, such as updating a timer, deleting objects, sprites, sounds etc

One of the ways to deal with this is to write a function that contains all of this code with the sync command, and to replace all calls to sync with calls to this function instead.

With the aid of one or two of the utility plug-ins, I though I'd have a go at providing a standard way to do this.

Paste the following code into it's own .dba file and include the code in your project when it's needed:


Now, instead of using the DELETE OBJECT command, I can use the DeleteObject function:


I then register the recover function with the SyncFunctions library at the start of the program:


Then finally, I call DoSync() instead of the SYNC command. Now every time this command is issued, it will delete an object from object group 10000 automatically.

Here's all of that in a simple example:


You'll need to add an include for the SyncFunctions.dba file too. This is ideal for quick reuse of instances or clones of objects - preload all of your objects, clone or instance them on demand using FIND FREE OBJECT to find an ID to use, delete them when done.

I've also done the equivalent with cloned sounds - cloning sounds on demand, and then freeing them back to be reused later.

Login to post a reply

Server time is: 2024-11-21 12:38:08
Your offset time is: 2024-11-21 12:38:08