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
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Jun 2009 00:23
@CuCuMBeR,
I meant to get back to you on your texturing question, but I've been quite busy recently.

Can you send me the two textures you want to be blended, and the texture containing the alpha map. and I'll have a go at working it out - I'm not an expert, but I believe I should be able to get it working.

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 19th Jun 2009 09:40
3 textures are attached, i want to blend metal and rush using the greyscale texture.

I did this earlier with trial and error(lots of them), but even the result is what i want, i dont think it is the right way of doing it.

There is always one more imbecile than you counted on.

Attachments

Login to view attachments
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 19th Jun 2009 13:53 Edited at: 19th Jun 2009 14:05
Also i have a small request, i dont know if such commands already exist somewhere that i dont know or not.
But can you add these commands to work on array pointers as well please?

empty arrayPTR : DBPRO EQUIVALENT= EMPTY ARRAY Array Name(0) (NOT necessary indeed, its currently doable, but would be nice)
ARRAYPTR INSERT AT TOP : DBPRO EQUIVALENT= ARRAY INSERT AT TOP Array Name(0)
ARRAYPTR INSERT AT BOTTOM : DBPRO EQUIVALENT= ARRAY INSERT AT BOTTOM Array Name(0)
ARRAYPTR INSERT AT ELEMENT : DBPRO EQUIVALENT= ARRAY INSERT AT ELEMENT Array Name(0), Index (NOT necessary indeed, its currently doable, but would be nice)


I want to use it like this:



EDIT:
Currently i do allocate new memory with necessary amount at the end of the offset and it somehow works, but im quite sure it will conflict with others when things get crowded.

There is always one more imbecile than you counted on.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 22nd Jun 2009 13:30
There might be something wrong with HEX TO DECIMAL command.

Below code shows 112 for 0x70


But if you unrem the 2 other print statements, then it shows 114 for 0x70

There is always one more imbecile than you counted on.
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 22nd Jun 2009 14:22
For some reasons, the Hex To Decimal command makes DBPro to crash. I have the newest version of both DBPro and your plugin.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Jun 2009 15:09
Ok, I'll check it out - we're overdue for a new release of the fixes I've done over the last few months anyway.

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 22nd Jun 2009 18:44 Edited at: 23rd Jun 2009 11:26
You might as well wanna check the Ticker commands, rarely it misses if the ticker return value is 2 or 3 and keeps ticking.

Unfortunately, i dont have any code that proves it as it doesnt happen all the time which is strange.

EDIT: My mistake, it works as how its supposed to.

Math89:
Quote: "Your code is wrong, Cucumber: first of all, if n is 361, it should return 1 and not 0. Moreover, it doesn't take the negative numbers in account. "


Actually the code is right, as n is never equal to 361, n=>360 means, if n is equal or greater than 360, so logically when n is equal to 360, it never gets to 361 but goes back to 0.

Surely you can write it as if n>359, but actually it is the same thing.

Just to make things clear.

There is always one more imbecile than you counted on.
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 22nd Jun 2009 19:33
No I think you don't understand the problem. If your object angle is 350 and that you want to add a 20° rotations, it should give you 10°, not 0. Doing n = n mod 360 would give a better result.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 23rd Jun 2009 09:53
hmm, right.
Thing is i never add values more than 0.9, never needed to add 10.

There is always one more imbecile than you counted on.
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 23rd Jun 2009 16:54
The problem happens whatever you increment it by:
359.9 degrees + 0.5 degrees = 0.4 degrees, not 0 degrees

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 23rd Jun 2009 17:59 Edited at: 23rd Jun 2009 18:00
edited.

There is always one more imbecile than you counted on.
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 4th Jul 2009 17:52 Edited at: 4th Jul 2009 17:53
Hey Ian. I found a minor issue in Matrix1Util20 (Function pointers):

Get Function Ptr() should return a 0 if the function does not exist. Instead, I get a silent crash. If you will be fixing this (as opposed to fixing the Help file), then if you can make the Call Function Name and Call Function Ptr not crash if the functions do not exist? That would be great. Otherwise, some sort of Function Exists command would be needed, or the coder would have to build a list of existing functions and compare against that.

Error example:


I want to do this for scripting purposes. If the function passed by a script is not coded, then this could be a problem. There is that work-around I mentioned, but that slows down the scripting significantly.


Open MMORPG: It's your game!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Jul 2009 18:25
The problem only occurs if there are no functions at all in your code. If you have at least one, even if it's a dummy that you never call directly or indirectly, then the plug-in won't crash.

Hang on for a few hours, and you can have the new fix in the next release.

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Jul 2009 20:07 Edited at: 4th Jul 2009 20:19
New release - mostly small fixes.

Release 20090704
Matrix1Util_02 - 1.1.0.6
-- Internally adjust timer values to zero and program start to avoid rollover.

Matrix1Util_03 - 1.1.0.4
-- Owned mutexes are released on a program exit.
-- Added IS SYSOBJ LOCKED function.
-- Minor code tidying.

Matrix1Util_04 - 1.1.0.5
-- Corrected off-by-1 checking error when reading/writing double integers & double floats to a memblock.

Matrix1Util_07 - 1.1.0.3
-- Fixed HEX TO DECIMAL and BIN TO DECIMAL functions so that they actually work.

Matrix1Util_15 - 1.1.0.3
-- Correct ADD TO ENTRY BUFFER resource string.

Matrix1Util_19 - 1.1.0.5
-- Changed checking of instanced source & target objects to use a better method.

Matrix1Util_20 - 1.1.0.7
-- Corrected help file ARGLIST STRING -> ARGLIST STRING$
-- Fixed crash when no functions are present in the user code.

Matrix1Util_21 - 1.1.0.5
-- Increased limit on zones from 65536 to 262144 (256k).
-- Added help files for FIND FREE ZONE.

Matrix1Util_22 - 1.1.0.9
-- When reading a string, if EOF was hit but we have read string data, clear the EOF condition.
-- New command to set the file size (can both reduce or increase the file size).

Attachments

Login to view attachments
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 6th Jul 2009 17:46
Great downloading now, hope you put a small example on the blend mapping as well.

There is always one more imbecile than you counted on.
Serial Velocity
15
Years of Service
User Offline
Joined: 24th Aug 2008
Location:
Posted: 7th Jul 2009 22:26 Edited at: 7th Jul 2009 22:53
One question, will there ever be a GDK version? I love your plugins and I (and many other people) would be happy to see this awesome plugin set with GDK.

tiresius
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 7th Jul 2009 23:48
Quote: "will there ever be a GDK version? "

He's answered this before look in the previous pages.
Quote: "Also, I don't want to end up with two different copies of the source code - one for GDK and one for plug-ins. Plus it might actually be much better go give access to objects I use internally rather than force access through a set of standard C-type functions using id numbers. I may also need to replace the build system so that it works correctly for both plug-ins and .lib files."


I'm not a real programmer but I play one with DBPro!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 8th Jul 2009 21:07
Thanks IanM for the update!


Open MMORPG: It's your game!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Jul 2009 14:01
@IanM,

I have this slight adaptation of your code for loading dbo objects:


...and it always gets stuck at "make object from bank ObjectNo, 1, Offset-4" saying "Object number illegal at line...". I have no existing objects with the same number... any ideas what might be causing it?
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Jul 2009 15:51
There's not enough code there to show what the problem is - that's always a problem when relying on global variables - check your Door1/Door2/Room2/Room3/Level1 variables.

Oh, and you need to make sure you 'inc Offset' both on correct matches and false matches. Otherwise a false match will cause an infinite loop as it continually finds the same match over and over.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Jul 2009 16:52
I got it working in the end, only I don't know now if I want to re-texture all of my objects after inserting them as they are all inserted blank...

I think I'll have a bit more of a look at this solution but I need to have a serious look at what is causing the longest load times as I have a feeling it's not so much the dbo's as the lightmaps.

Thanks for your prompt reply though IanM and I'm sure this and the rest of the commands will be VERY useful!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Jul 2009 21:14
The idea behind loading DBO files from memory banks is NOT improved speed - it's the ability to package several objects together.

The 'best practice' for using this is to create a utility that can create your combined file with all your DBO files and associated data (positions, rotations, pickups, trigger points, anything associated with your world really) into a single file.

Your game would then use this single files for everything, except textures and shaders.

If you are both creating the combined file, and then using the combined file in your game then of course it's going to be slower, mostly because of all of the copying of data to disk that you are carrying out.

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 13th Jul 2009 19:21
Hey IanM. I had a bit of trouble with the new functions (Matrix1Util 20). I sent you an email with all the information. I am not sure its the utility or the way I am using it: I, as per normal, am trying to break things. Anyway, if you could look at it, that would be much appreciated. If not - well you and your work here are still very much appreciated.


Open MMORPG: It's your game!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Jul 2009 20:32
Right now I'm a little run down from the day job - I'll get to it as soon as I feel able to. If you do work out what's going on with your code in the meantime, just let me know.

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 14th Jul 2009 21:35
Ok. Thanks IanM.


Open MMORPG: It's your game!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 15th Jul 2009 20:58
Hey IanM, I think I found the real problem. It seems to be some sort of intermittent issue with Pick Object() with Hide Mouse and nothing to do with the Matrix Utilities. I am still trying to duplicate the issue in a smaller program. I also had some problems with my code, which have been fixed.


Open MMORPG: It's your game!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 16th Jul 2009 00:52
IanM: I had to go back to the drawing board since Pick Object/Hide Mouse turned out not to be the issue. The fix for my woes seems to have come from not using underscores in the middle of Function names (and therefore function calls). For example: "_MyFunction()" will work fine, but "_My_Function()" will cause a crash. So far, this fix seems to be stable. I will keep you posted.


Open MMORPG: It's your game!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Jul 2009 20:30 Edited at: 16th Jul 2009 20:32
I've spotted a small buffer overflow that is causing a problem - it's just luck that you have found what appears to be a stable fix, but I suspect that it will reappear even with the change you have made.

Replace the command CALL FUNCTION NAME with a dual call to GET PTR TO FUNCTION to get the pointer, followed by CALL FUNCTION PTR. That will fix the problem until I get a replacement out.

[EDIT]
The actual line from your _Call_Function function should read like so:


RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 17th Jul 2009 09:19
Thanks IanM!


Open MMORPG: It's your game!
Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 19th Jul 2009 15:04
IanM,

I have found a few bugs with the Matrix1Utils dlls.

Bug 1: Wrap function causes general crash when 3rd argument <= 2nd argument...lacks a controlled error message.



Possible Bug 2: The string displayed in the message box appears as jibberish, rather than "H".

It's possible that I'm doing something wrong or missing something in my code though.



Helpfile bug: Peek String helpfile not linked to correctly (this may already be known though).

I'm using DBPro v7.3 and the latest Matrix1Utils plugin dlls.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Jul 2009 18:57
The first bug is a divide-by-zero bug that only occurs when your min & max values are identical (which when you think about it is pretty nonsensical anyway). The next release will include a fix for this though.

I also spotted related problems with the GCD functions, so they'll be fixed at the same time.

The second bug isn't a bug.

Strings in DBPro aren't held as a sequence of characters - they are held as a pointer to a sequence of characters. You basically need to fetch the value as a pointer, then use that pointer to get the string data.



Finally, the PEEK STRING function should have actually been named PEEK STRING$ - too late to change it now though (it could break too much code), so I'll correct the help instead.

Thanks for the bug reports

Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 20th Jul 2009 19:34 Edited at: 20th Jul 2009 21:15
IanM,

Thanks for the reply on the bugs and the array pointers. Indirectly, this has helped me solve a problem that I've been having with a rather complex function that I've been working on involving the "Get ArrayPtr Field Offset()" command.

`-------------------------------------------------------------

I know that there are examples scattered around on this thread on how to use some of the commands in these dlls, but I feel it would be more helpful if it were possible to place these examples and others into some .html files for the DBPro help system, with some links to some respective "command" .html pages.

Sometimes, I feel that I'm missing out on the benefit of one command or another because I don't have an example of how the command works. Although I could (and do) write trial-and-error experiments to work out what a command does, some commands require a specific code context in order to work properly and in a few cases, it does take quite a bit of time to work out how to use a particular command.

However, I do know that there are many commands present, and I suspect that it would take some time to compose a set of .html example pages.

`-------------------------------------------------------------

I have found another bug that I have run into before and thought it had been fixed, but it seems to still be there. It is a fault with the "no-parameters" variant of the "Find Free Image()" command.

The following code will produce an error saying that "The Image plugin is not available".



However, the following code will run, but the values produced by the "Find Free Image()" command appear to be random.



After performing a search on the forums, I have discovered a thread in which it was stated that this randomness is the desired behaviour, but I'm not so sure about the error message.

`-------------------------------------------------------------
`-------------------------------------------------------------

Edit:

A command idea that might be useful,

Link ArrayPtr ptrArray, ptrArrayTarget
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 20th Jul 2009 21:00
IanM,
Functionality request (Utility 20 - Functions):
On the Arglist, can you provide either an Arglist Count(arglist) function or perhaps an Arglist EOL() function that would indicate that the end of the arglist has been reached? [EOL=End Of List]

The current solution is to call a function with an arglist that ends in a null string (for strings) or provide the arglist count at the beginning of the arglist. Either way uses up an argument.

I particularly would prefer the Arglist EOL(), then this could be accomplished, which would be very useful:



Thanks.


Open MMORPG: It's your game!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Jul 2009 22:36
Sorry, but currently there's no way for me to work out the number of parameters passed at runtime. That info isn't stored in the compiled exe (it almost is, but not quite).

@Phjon,
The random selection of image number is by design. Although you can switch the selection to sequential numbers from 1, that makes the function almost as slow as writing it yourself.

When I get around to it, I'll switch to the system I use for getting free object id's, that uses a completely different system, but requires a whole load more work (in the case of images, it's probably around 4-5 times more work that for objects).

As for the 'xxxx plugin not available' messages, that was a deliberate design decision for this particular plug-in.

It would be trivial for me to get that plug-in to pull in all of the DBPro plug-ins that it requires to fulfil all of its functions, but that would quite literally pull *all* of the DBPro plug-ins into your exe, making any executable you produce the largest it could ever be.

I took the decision to not require that because you'll only get an error message when you write trivial do-nothing code like you did in your first snippet (the second snippet pulled in images, because you used the object plug-in which pluss images in automatically).

Ask yourself, who would try to get an image id, but then not actually use it for an image? If you do use it for an image, then the correct image plug-in would be included by the compiler automatically. If you don't use it for an image, then why try to get an id anyway?

Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 21st Jul 2009 00:24
IanM,

Fair points made.

I am a little concerned that the increased use of high index id numbers will slow down the loading/creation of entities (objects, images, etc.) by some measure.

However, as there is the option of loading things in using the linear version, this is at least an option that one can use if they're finding that, whilst the "Find Free()" commands run faster, the "Load/Make" commands run slower, and they need to balance the two to achieve optimum performance.


--------------------------------------------------------


Could I ask what your view is on the help file idea (example code snippets placed into .html files and added to the Matrix1Utils download .zip file) that I mentioned in my previous post?
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Jul 2009 00:50
The speed of images isn't affected by high ID numbers - I believe that it is affected by the number of images that you have loaded though. However, if you want to limit the range of ID's allocated, you can use the range version of the function instead, eg FIND FREE IMAGE(1, 1000).

I've also just noticed your LINK ARRAYPTR suggestion - I'm not sure what you are asking for. Could you explain what you believe it should do?

I have been pulling together a few example snippets to make into a big zip file to replace the standalone examples I've posted in this thread from time to time - I'll spend a little more time throwing a few more in and then upload it. Any suggestions and especially contributions would be very welcome as there's a lot to be covered. I'd even accept some of your 'trial and error' code.

And that's also open to anyone who wants to contribute
Nice simple examples that showcase a command or a set of commands.

Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 21st Jul 2009 17:42 Edited at: 21st Jul 2009 21:56
IanM,

The range limited versions of the "Find Free()" commands could be very helpful, especially in the case of objects.

As you've mentioned, the performance difference between low and high index id's for images seems to be fairly low, but for objects, the difference is substantial. The test program below shows how long it takes for a group of entities (images/objects) to load.



On my PC, the results were as follows:

Images: Low index id's = 8695 ms
Images: High index id's = 8782 ms
Images: Time difference = 87 ms ( + 1% )

Objects: Low index id's = 2 ms
Objects: High index id's = 323 ms
Objects: Time difference = 321 ms ( + 16050% )

--------------------------------

For the "Link ArrayPtr()" command, I have realised that it is not possible to use such a command for the purpose I had originally thought for it. However, the command may still be of use to somebody else, so I've presented the idea that I had for this command in the code snippet below:



The code snippet did form a part of one of my projects (before I discovered that the "Link ArrayPtr()" didn't exist). The "LinesInFile()" function comes from a different part of that particular project; it returns the number of lines present in a string-based text file.

--------------------------------

Thanks for the reply on the "Examples" idea. I have a couple of code snippets here that might be useful.

This one demonstrates the "Split String()", "Split Count()" and "Get Split Word$()" commands:



This one is a little on the long side, but it helps to demonstrate the "Get Array Item Ptr()", "Get Array Field Offset()" and "Peek/Poke()" commands:



Hope these will be helpful.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Jul 2009 20:24
It seems that your LINK ARRAYPTR is simply a GET ARRAYPTR followed by an UNLINK ARRAY - you want the array storage, but in pointer form only.

This function does what you want, returning the newly allocated array in array pointer form as its result:


You'll also need to link it back to an array and undim it to properly destroy the storage and avoid memory leaks:


An array is basically a combination of 2 things (4 things really, but ignore that for now):
1 - It's a name
2 - It's data storage

When you use UNLINK ARRAY, you are breaking the link between the two. When you use LINK ARRAY, you are recombining the two.

(The third thing that makes up an array is it's compiled type, and the fourth is it's storage type - normally they are the same thing, but they don't HAVE to be, and that's why that second function will work.)


Quote: "the performance difference between low and high index id's ..."

Try them again, but count down from the highest to the lowest - you should find that images take about the same amount of time as before, but objects are created far faster.

Most resources in DBPro are kept in lists, so if you have 10 images and need to create another, it runs through the 10 to see if the new id is already in use.

Objects though are kept in an array. That makes it lightning quick to check if an object exists, but it means that when you allocate a new object that has a higher ID than any other existing one, that new storage for the array has to be allocated, the existing data copied over, and then the old array freed.

If you use the highest ID first, the array will be grown only once. If you use sequentially increasing ID's, the array will be grown each and every time - that's slow.

Oh, and thanks for the examples - I'll put them to good use

Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 21st Jul 2009 21:55
IanM,

Interesting information on arrays. I'll try out that particular function variant to see if it helps with my project.

-------------------------------------

I am having some trouble with this code snippet. It transfers data from one array to another via the use of pointers. However, I'm coming up with a crash when I change the string word "WidgetIm" to "WidgetI", and I have no idea why it would crash with a slightly different string. I can only assume it has something to do with memory allocation, but it may need someone with a better understanding of what's going on to debug this:



--------------------------------

I confirm your findings on the index id's; objects loading in with high id's in descending order do so in 56 ms rather than 323 ms. This could be extreemly useful for one of my older projects that instances a large number of objects. I need to point out an error in my code snippet on this test; the value 10000000 should be 10000001 - I shall correct this. With that correction, the images load in around the same time for both low and high id's when in ascending order and in descending order.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Jul 2009 00:22
You've picked a difficult subject there...

First things - you can't just poke strings into any place you want. You can get away with poking a shorter string over a longer string, but doing it the other way around is simply going to overwrite memory that could be in use for other strings, object, images, anything really.

That's what's happening in your code. You need to replace string pointers, not overwrite strings.

Secondly, you have to take care to protect the DBPro heap and the heap my plug-ins use - you can't expect to mix memory from different heaps and have it all come out right. It may work for a short while, but at some point (and definitely during the program shutdown) windows will throw out an exception.

So, with that in mind, here's how you change a string in an array, without mixing heaps, and without memory leaks:


Hopefully the comments will give you an idea of what's going on.

Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 22nd Jul 2009 01:15
IanM,

That snippet was useful; I understood well what was going on in it.

I may have got close to something like that at some point. I was fiddling around with the "Reserve$()" command and poking pointers into an array, but I suspect that something got deallocated by accident before I do anything more with the array. In addition, in your code, there's no need to retrieve the size of the string for the transfer, unlike when using the "Reserve$()" command, which is helpful.

I should point out that there is a mistake in your code snippet.

The line: "poke ItemAddr, NewStringAddress", should be "poke dword ItemAddr, NewStringAddress"
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 27th Jul 2009 17:53
Hi! I found a problem with your make object plain command: it seems that the object has a limit of 2^16 vertices. Is there a way to correct this or is it a problem with DBPro?
And thank you for these great dlls!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Jul 2009 19:42
Well, the 'limitation' is per limb, not per object, but yes it's DBPro, and no it can't be fixed.

Turn the question around - what are you doing that you need access to so many vertices? For most people that would be a substantial part of a level, or even a whole level in a single mesh.

Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 27th Jul 2009 21:25
I was actually trying to make a terrain system. I guess I have to use multiple plains, which should improve performances, but will make the terrain edition code more complex.
Demon000
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location:
Posted: 28th Jul 2009 02:53 Edited at: 28th Jul 2009 02:55
I was wondering if you've ever considered adding a make image from bank imgnum, banknum kind of function. It would be really useful for something I'm working on.

BTW, great plugin collection!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 28th Jul 2009 09:38
Hey IanM. I was playing around with the Find Free Memblock() function and it returned an non-valid Memblock ID (I believe it was >255). So, I set the range of the function: Find Free Memblock(1,255) and it worked perfectly. I have tried to reproduce the issue in a smaller snippet, but I am having no luck. Anyway, you might want to take a look at that command.


Open MMORPG: It's your game!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Jul 2009 15:09
You can safely make a memblock with any id up to and including 257, however my plug-in commands should be limited to 256 anyway.

But yes, if you can reproduce it, I'd be interested to see it and fix it.

@Demon000,
I'll take a look and see how much work is involved. In the meantime, simply create a memblock of a matching size and copy the data from the bank to the memblock, then clean everything up.

Demon000
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location:
Posted: 28th Jul 2009 19:16
Thanks IanM

There's a couple of reasons why I'm asking for this functionality.

I'm working on an encryption system using banks which allow more freedom than memblocks in the encrypting process.

When I make a memblock from an image, the memblock takes a different size than the original file, so getting the data with the bank and passing it to the memblock doesn't allow me to get the image from the memblock.

I've managed to make this work by:
-Loading an image
-Making the memblock from that image
-Copying the memblock into a Bank
-Encrypting
-Saving the file

The problem with this is that the file ends up being too big and it takes longer to decrypt/encrypt because of the process and the filesize increase.
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Jul 2009 20:52
Save it out as an image, then load the file into a bank, encrypt it, and save it out again

Demon000
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location:
Posted: 28th Jul 2009 21:12 Edited at: 28th Jul 2009 21:14
Well, that part isn't the problem encrypting works easily, the problem is that I want to decrypt it and use the decrypted image without having to create a decrypted file.

Login to post a reply

Server time is: 2024-02-29 21:59:19
Your offset time is: 2024-02-29 21:59:19