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
RedFlames
17
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 28th Aug 2008 18:14 Edited at: 28th Aug 2008 18:15
Hey Ian, found a bug in "Get Arrayptr Count":


I made an empty array and used the Ptr to "Insert at Bottom" at that Array, but "Get Arrayptr Count" still returns -1 although the value of "Get Arrayptr Size" rised from 0 to 1... (of course i could just use Get Arrayptr Size(Ptr)-1 but its still confusing if you dont know about that bug )

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Aug 2008 21:23 Edited at: 28th Aug 2008 21:36
You've reported this just in time! It's only because I was being lazy this lunchtime that I haven't packaged everything up for the next release.

First, you're specifying dimension zero - no such thing. In this case it's correctly reporting -1 because you specified an illegal value. However, when I fix your posted code by specifying 1, it's still reporting an upper bound of -1

Turns out that I hadn't fully thought through the effect that the list/queue/stack array commands have on a 1D array - it was reporting the correct upper bound of the array dimension as far as it knew.

Anyway, it's now fixed ready for the next release.

[EDIT]BTW, you have a question in your code - the answer is that once you've unlinked an array, there is no array left to undim, so the undim's you have don't have any effect in your code.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Aug 2008 22:15 Edited at: 28th Aug 2008 22:23
Here's the latest release package - nothing earth shattering to report, just a few tweaks, minor new commands and bug-fixes:

Matrix1Util_03 1.1.0.2
- Fixed resource string for SYSOBJ EXIST function.

Matrix1Util_12 1.1.0.5
- Get excluded or hidden status of a limb.

Matrix1Util_16 1.1.0.2
- Get ASCII value of a character in a string using MID ASCII.
- Search for an ASCII value in a string using FIND ASCII.
- Minor speed tweaks to SPLIT STRING command (5% gain).
- Added SPLIT CSV STRING command to split Excel-format CSV records.
- Added DELIMIT CSV$ function to add escapes to an Excel-format CSV field.
- Fixed bug in REPLACE STRING$ (ReplaceSection) that caused one or two of the last 2 characters to be lost in the new string.

Matrix1Util_22 1.1.0.2
- Added the ability to load/save via a pointer to memory.

Matrix1Util_26 1.0.0.5
- Fixed aspect ratio/fov functions for cameras, due to 6.9 changes.
- Added functions CAMERA RANGE NEAR / CAMERA RANGE FAR.
- Added functions CAMERA BACKDROP ON / CAMERA BACKDROP COLOR.

Matrix1Util_28 1.0.0.3
- Amended the PERFORM CHECKLIST FOR INTERFACES to fill the checklist with the dhcp server ip address rather than just an on/off flag.
- Amended the PERFORM CHECKLIST FOR SOCKETS to fill the checklist value d with the blocking status of the socket.
- Removed limits on checklist sizes in both PERFORM CHECKLIST FOR INTERFACES and PERFORM CHECKLIST FOR SOCKETS commands.

Matrix1Util_29 1.0.0.4
- Use allocated size to calculate the upper bound of a 1D array.
- Added UNDIM ARRAYPTR command to free the memory for unlinked arrays.

Matrix1Util_30 1.0.0.2
- Fixed bug where BeginScene wasn't always being called before rendering.

Attachments

Login to view attachments
RedFlames
17
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 29th Aug 2008 17:28 Edited at: 29th Aug 2008 17:31
Wow thanks

Get Arrayptr Count works now, just a very small problem:
"Undim Arrayptr" is not in the Keywords-file, so it isnt highlighted... but it is in the helpfile ^^

Edit: Wait it IS in the ini-file Why doesnt Synergy highlight it... Oops i had to "Rebuild Keywords" as the file isnt new, just changed, so it will not be put into synergys cache-files or whatever. Never had to do that before

Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 29th Aug 2008 21:56
Mmmh... I've got another problem with your socket plugin : in the help file, I can find BytesRead = RECV FROM SOCKET( Handle, BufferAddress, BufferSize ) but the keyword file and the compiler expect BytesRead = RECV FROM SOCKET( Handle, BufferAddress, BufferSize, IP Address, Port Number ).

And actually, I don't really understand why the IP address and port number should be specified when receiving.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Aug 2008 22:19
Quite right - both the command resource string and the INI file are wrong, but the help file is correct.

As a short-term measure, you can either change the resource string to the following:

and hack off the last two parameters in the INI file, or you can safely set the IP address and port number to zero until I make a permanent fix.

It looks like a copy/paste error when I set up the resource string, and I use those to build the INI file, so that explains the problem in both places.

Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 30th Aug 2008 00:59
I know I have said this many times before, but these plugins add so much versatility to DBP and they must have taken so much time and effort to develop and test that I must buy IanM at least 2 beers at this years con.

Thanks for all the hard work, I'm always using them

TheSturgeon(playing me at chess) : I will use my powers of the horse and pwnzor you.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Aug 2008 12:39
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 30th Aug 2008 18:26
I've found another error with the socket dll.
According to the help file, Connect Socket has got an extra timeout parameter but DBpro refuses it.

Nevertheless, thank you a lot for these dlls, I've been able to program a network application dealing with multiple clients using tcp and udp (even if it took me ages to understand how udp works ).

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Aug 2008 21:03
That's a mistake in the help file - but it was a good idea so I've written the command, and added an equivalent ACCEPT SOCKET command too.

Keep 'em coming

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 31st Aug 2008 16:05
What about a 3d maths extension (such as commands to get elements in a matrix, or even better, just completely rewrite it so that it doesn't use IDs!)

Also, some commands for getting/setting additional camera properties (like the view and perspective matrices) and additional object and limb properties (such as enabling/disabling the flag that sets whether a matrix is used directly, and setting or getting the matrix)

That would be good!
Some more 2d commands would be nice too (Like drawing a polygon filled/unfilled and some blending and filter effects)

Thanks again, I use this plugin in nearly every project!


One more thing, an array sort function which took a function pointer would be cool (It would take two variables of the type of the array, and would compare each one and return a value saying if one was less, equal or more than the other one.

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 31st Aug 2008 19:19
Quote: "What about a 3d maths extension"

For example? Apart from looking at specific cells in a matrix, what else do you need?

Quote: "just completely rewrite it so that it doesn't use IDs!"

An OpenGL-like system? Or do you have something else in mind?

Quote: "commands for getting/setting additional camera properties ... additional object and limb properties ... setting or getting the matrix"

Sounds like that could possibly be a useful set of commands.

Quote: "Some more 2d commands would be nice too"

Would they be useful though? Polygons (filled or not) should be easy enough to do, but blending/filling effects would be a lot of work for little benefit.

Quote: "an array sort function which took a function pointer would be cool"

What would you be able to do here that you couldn't with the system I've already implemented? (Apart from being 'cool' that is )

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 31st Aug 2008 21:25 Edited at: 31st Aug 2008 21:29
I don't know how OpenGL treats its matrices, but I meant one where you could call make vector3() for example and it would return a handle to the vector.
Now that I think about it, you could just overload the 'make' commands to ones with no arguments that use the find free XXX commands.

A command to get a pointer to a matrix/vector would be good (for passing to dlls or just fast access)

For extra commands, it is useful to have a get/set function for matrices like I said, and also a function to separate out a matrix into translation, scale and rotation (a quaternion). I'm sure you know there's a built in command for this in D3DX.

Also, all the D3DX quaternion commands and creating a rotation matrix from a quaternion is missing.


For the basic2d, maybe polygons might not be that useful (although triangles certainly would!)

I was thinking also of a kind of paste image command, but with blending options and transformations and things. They would be especially useful for something I'm doing at the moment (involving red/cyan glasses You currently can't 'add' an image to the existing bitmap, which is necessary for red/cyan 3d).

edit:
Also, a 'map pointer to bank' command would be very useful!

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Sep 2008 12:19
Quote: "Quote: "Some more 2d commands would be nice too"
Would they be useful though? Polygons (filled or not) should be easy enough to do, but blending/filling effects would be a lot of work for little benefit."


I believe Cloggy has added this to his D3D plug-in if you need it.

Question: Is it possible to add alternative command names (in addition to the ones there and already used by the masses)? For example, REPLACE STRING$() is also in Styx. Whenever you update your plugins, I have to change the string table (It's not possible in Styx). I add "MX " as a prefix.

Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 7th Sep 2008 00:01
I got a little problem using your shortcut creation command : if you use a forbidden character (like ':') it will create an empty file that you cannot remove because of a 'file does not exist' error. I think a security check should be added to avoid that kind of problem, or at least a warning in the help file.
The only way to delete the empty file is to call the del "" command (giving an empty string for the file name) but it will remove all existing files in the folder, so don't forget to backup your work.

Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 7th Sep 2008 16:35
Quote: "Question: Is it possible to add alternative command names (in addition to the ones there and already used by the masses)? For example, REPLACE STRING$() is also in Styx. Whenever you update your plugins, I have to change the string table (It's not possible in Styx). I add "MX " as a prefix."

Styx had to go because of this. The third time I had to rename Matrix1 commands I decided I'd rather not. That's not the only command that's duplicated in Styx either.


Come see the WIP!
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 7th Sep 2008 18:09
I too had the same issue, and for me the solution was the same as for Cash ... I got rid of Styx.



IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Sep 2008 19:42
@Batvink,
I'm not planning on changing any of the commands/functions in these plug-ins - that would just break too much code for everyone who uses these plug-ins but doesn't use styx. However, I will see if I can find a way of automatically generating altered plug-ins from the originals, so people can change them themselves.

@Math89,
That's a bit of a problem you have there, but I'm not too sure what I can do about it right now, because ':' is a valid pathname character under many circumstances, and the shortcut commands accept pathnames, not filenames.

Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 11th Sep 2008 13:42
Do you have a set of header files that acts as an interface to your dlls, for use with the GDK?

TheSturgeon(playing me at chess) : I will use my powers of the horse and pwnzor you.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Sep 2008 15:27 Edited at: 11th Sep 2008 15:29
No, because they wouldn't work - a lot of my DLLs expect the DBPro DLLs to be available and will fail if they aren't. Also, some require the ReceiveCoreDataPtr function to be called for initialisation purposes.

I've had some vague plans to convert in the past, but never followed through - I may get around to it sometime.

[EDIT]If you have a specific plug-in or several in mind, let me know and I'll aim to get those converted first.

Ed222
17
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 12th Sep 2008 01:16
@IanM
Is it possible for you to add a loading bar function?

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Sep 2008 00:24
I'll admit that's not too likely - there's too much variation in what people would want, how they'd want it to look, how it would respond/update. Besides, it's not as if a loading/progress bar is difficult to code, so why write a plug-in for it?

Silverman
17
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 13th Sep 2008 16:07
hello,

@ianM
archive corrupt

@+

AMD Athlon(tm)XP 3200+ (2.2GHz)/DDR pc3200 (1024Mo)/Nvidia 6800GT / XP Pro SP2
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Sep 2008 16:25
I've just downloaded it to test it, and it downloaded and extracted just fine. Try downloading again, maybe with a different browser, or with your AV software temporarily disabled (manually scan the zip before extracting it though).

Silverman
17
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 13th Sep 2008 18:35
@ianM

it is ok now,(Alzip 6.7 bug). I've downloaded and extracted fine with 7-zip.

AMD Athlon(tm)XP 3200+ (2.2GHz)/DDR pc3200 (1024Mo)/Nvidia 6800GT / XP Pro SP2
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Sep 2008 13:55
Good. 7-Zip is what I use myself to create these zip files.

TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 16th Sep 2008 07:37
Would anyone happen to have a stable Matrix1Util 28 HTTP Client Code Example capable of handling Large Page Downloads? Any help would truly appreciated.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Sep 2008 20:29
Stable? No, but here's a simple example with next to no error checking (left as an exercise ... actually, I couldn't work up the enthusiasm to do it myself ) :


TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 16th Sep 2008 23:55
Sincere Thanks IanM,

That little bit of code, greatly improves what I was working with. Additionally, your using commands that I wasnt familiar with this provides a good example of their use.

freight hopper
20
Years of Service
User Offline
Joined: 26th Dec 2003
Location: Just beyond the Dunsmuir yard limits
Posted: 17th Sep 2008 19:55
Recently tried the "save frontbuffer" command and it failed, looking for a d3dx9_35.dll. I reinstalled per the suggestion but still get it. Other plug-in commands work for me.

The message header is temp:temp.exe - Unable to Locate Component. the bocy is This application has failed to start because d3dx9_35.dll was not found. Re-installing the application may fix the problem.

Is this an old reference? My plugins run from Matrix1Util_01.dll to 30.

Thanks.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Sep 2008 20:02
Nah, it's not you, it's the way I compiled that program. I'll try to get it fixed in the next release.

Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 22nd Sep 2008 18:02
Your random function always returns the same values for me:

what's wrong???

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Sep 2008 00:19
It's not you, it's the plug-in. It'll be fixed in the next release later this month.

Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 23rd Sep 2008 01:34
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 24th Sep 2008 15:12
I ran into an interesting problem. I just replaced my home grown 'getFreeObject()' function with 'find free object()'. I got a strange crash that was only reported as a 'physics error' by the Cloth and Particles plugin. I narrowed it down to this...



It crashes on line 7 because 'obj' doesn't change. Line 1 correctly returns the next free object, in this case 733. Line 5 returns the same number as line 1, 733. I suspect that the way this command works and the way the Cloth and Particles dll allocates objects is incompatible. Since I try to execute line 7 with an object that already exists it crashes.

I've changed it back. It didn't affect anything, I just thought I'd point it out.

I've implemented my scripting system using your function pointers and Barnski's Lua plugin. It's absolutely brilliant. I was worried that it would be unstable, calling DBP functions and commands directly from Lua, but it couldn't be better. Every single function and DBP command is exposed. Now it's possible to code any kind of engine extension you want through scripts. Thanks for all of this, nothing like this would have been possible otherwise.


Come see the WIP!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Sep 2008 22:06
Quote: "I suspect that the way this command works and the way the Cloth and Particles dll allocates objects is incompatible."

Yes - if the plug-in actually creates a 3D object, it is detected. If it doesn't (collision sphere for example), then it isn't detected.

I'll be having a chat with Lee/Mike at the convention about supporting this plug-in properly.

Quote: "Thanks for all of this, nothing like this would have been possible otherwise"

You're welcome

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 25th Sep 2008 00:56
Awesome plugins! I reallly wish I had found out about these earlier, I have wasted soooo much time on my projects making functions that are found in your plugins. Thanks again, these really extend the functionality of DBP.

90% of statistics are completely inaccurate.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Sep 2008 00:54
Glad you like them.

Here's another update - lots of fixes here, plus another new plug-in for lookup tables.

Matrix1Util_01 - 1.1.0.2
- Added MAP MEMORY TO BANK for mapping raw memory pointers to a bank.
- Corrected help for FIND FREE BANK.

Matrix1Util_02 - 1.1.0.3
- Added two new functions to get the ticker interval and the lifetime of a ticker.
- Corrected help for FIND FREE TICKER.

Matrix1Util_03 - 1.1.0.2
- Corrected help for FIND FREE SYSOBJ.

Matrix1Util_08 - 1.1.0.2
- Corrected seeding of all random generators.

Matrix1Util_09
- Added VECTOR TYPE function to determine the type of vectors.

Matrix1Util_16 - 1.1.0.3
- Add quotes to CSV field if the string also starts with '='.
- Revised SPLIT CSV STRING command to fix a bug with quoted fields.
- Added constant string functions.
- Added function to wrap text in double-quotes, and to remove double-quotes.

Matrix1Util_18 - 1.1.0.3
- Added new MAKE OBJECT NEW with an extra parameter to determine whether to initialise the index/vertex buffers to 0 or not (for speed).
- Minor change to MAKE OBJECT PLAIN commands when calculating object size.

Matrix1Util_19 - 1.1.0.2
- Corrected help for FIND FREE OBJECT.

Matrix1Util_22 - 1.1.0.6
- Corrected help for FIND FREE FILE.
- Changed string mode 1 to allow the CR prior to LF to be optional.
- Added new string mode to allow unterminated strings to be written. Reading is as per mode 1.
- Renamed DATAFILE RAW and WRITE DATAFILE RAW to DATAFILE MEMORY and WRITE DATAFILE MEMORY.
- Fixed a bug that wouldn't allow the WRITE DATAFILE MEMORY to be used on a writable file.
- Added commands to do raw (unterminated) reads/writes of strings.

Matrix1Util_28 - 1.0.0.4
- Corrected parameter list for RECV FROM SOCKET.
- Added CONNECT SOCKET command with timeout.
- Internal re-org of code.

Matrix1Util_30 - 1.0.0.2
- Recompile with correct version of DirectX

Matrix1Util_31 - 1.0.0.1
- Built new plug-in for basic string lookups (key->value).
- Included commands for simple ini-file handling.

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 Sep 2008 01:04
Here's some code that uses the new plug-in - it doesn't do anything useful, but does exercise the majority of the commands:



IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Sep 2008 01:06 Edited at: 28th Sep 2008 01:13
Another example - loading a lookup table from an Ini file.

Paste the following into a file named 'test-in.ini':


This shows the format of an acceptable ini file.

Run the following code to load/save/display the lookup table:


The saved equivalent 'test-out.ini' should be identical, except for the removal of comments - sorry, but they're not maintained in this version.

Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 28th Sep 2008 01:13 Edited at: 28th Sep 2008 01:13
Are these lookup tables like the 'map' class in c++ just with two strings (key / value)?

Why haven't you done this earlier?



IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Sep 2008 02:06
Pretty much - I didn't add something like this to the plug-in set earlier, because I had already written a similar plug-in back in 2004.

The reason it took so long for me to get around to revising it is that unless someone has a specific request for it, I generally don't write it until I need it - I needed functionality that I couldn't implement in the original plug-in, so I wrote a new one where I could implement it.

The functionality of the two plug-ins is overlapping, but there are things that each one can do that the other can't:

Matrix1Data
Can be slightly faster.
Automatic conversion to the requested type - automatic and can be relatively costly, but the cost can be hidden.
Requires a two-part key - makes it difficult to map to non inifile file types.
Limitations on the key contents - in reality this isn't too much of a restriction.

Matrix1Util
Requires a one-part key.
No conversion - everything is a string. If you want something different, you do it yourself at a known cost.
Ordered iteration through the data (either forward or reverse).
Find key, or nearest match.

Next on the agenda is to make the plug-in faster so that it at least matches the Data plug-in for speed.

Gold Dragon 27
16
Years of Service
User Offline
Joined: 3rd Sep 2008
Location:
Posted: 28th Sep 2008 02:21
What about more math stuff....

Like a trajectory calculator....
Input start x,y,x,initial velocity,angle....
stuff like that and be able to attach an objects x,y,z the the output.
do auto collision,do impact,make explosion

for like long range cannon and artillary kind of stuff

Put it all in one dll....
Coin
19
Years of Service
User Offline
Joined: 15th Mar 2005
Location: Bexley, UK
Posted: 28th Sep 2008 02:28
Thanks for this revised collection of utilities - magnificent as always.

Just one minor point - the Matrix1Util_30 help file contains this syntax guide:

OUTLINE BOX x1, y1, x2, y2

I had to reverse the words OUTLINE and BOX to avoid error messages and make it work.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Sep 2008 13:10
You could make a 'solve quadratic' function, which would also be able to do what Gold Dragon said.
Maybe even cubic:
http://www.math.vanderbilt.edu/~schectex/courses/cubic/
Or quartic:
http://en.wikipedia.org/wiki/Quartic_equation


[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 28th Sep 2008 15:00
IanM,

I have encountered a bug with the Find Char$() command. If there are any of these three characters in the string to be searched, the command returns an incorrect value:

"£" , "¬" , "¦"

For example, if one is trying to find the position of the character "x" in the string "££££x", the command will return a 1, instead of a 5.

I had been using one of the older versions of .dll number 16 and I did have similar problems with the second version of this command. However, with the latest version of the .dll, the problem seems to have been fixed (even though it wasn't mentioned in any of the "Fixes" reports).

The bug for the first version of the command is however present in the latest version of the .dll. The problem could exist for other characters as well as those mentioned, but I have not tested for all possible characters at this time (except for all of those present on the keyboard).
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Sep 2008 16:25 Edited at: 28th Sep 2008 17:19
It's present in both variations of the FIND CHAR$ command, plus the SPLIT STRING command - anywhere that multiple characters are searched for.

The problem can be triggered almost anytime a character with ascii value > 127 is present either in the delimiter string or the string being searched.



It's caused by an optimisation I made. I use some bitshifting on the character to generate a small lookup table - as the char type is a signed type, when you shift a character with a negative value, the sign is maintained. Switching to using an unsigned char solves the problem.

[EDIT]I've made the adjustment, tested it, and rebuilt the release (see attachment).

Quote: "You could make a 'solve quadratic' function"

It's not needed. Gold Dragon's request can all be done using plain old vector maths and sparky's.

However, it's requests like that that make me regret leaving school when I did - I don't use maths like that at work, but I miss out on doing some of the fun stuff for myself


New release information:

Matrix1Util_16
- Fix for FIND CHAR and SPLIT STRING when chars > 127 are present.

Matrix1Util_30
- Corrected help file for BOX OUTLINE

Attachments

Login to view attachments
Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 28th Sep 2008 17:51
IanM,

Thanks for the update. I confirm the "Find Char()" command works fine now even when a string has those characters that I mentioned earlier.
Coin
19
Years of Service
User Offline
Joined: 15th Mar 2005
Location: Bexley, UK
Posted: 29th Sep 2008 17:03 Edited at: 29th Sep 2008 17:04
Ian M

If you are still accepting requests for new commands and functions there are three that, as a former Amos Amiga programmer, I miss quite a lot. They are actually commands from extensions of Amos and I always have to insert at least two of them as functions into my DarkBasic programmes.

Value=Texp(TestExpression,TrueValue,FalseValue)

Texp means "test expression" and the first parameter is the one that is tested for true or false. If it is true then Value is set to TrueValue, if false it is set to FalseValue. A variation on this could be:
Text$=Texp$(TestExpression,True$,False$)

TrueFalse=Between(TestedValue,Value1,Value2)

TrueFalse is set to 1 if TestedValue is between Value1 and Value2 (or equal to either). It is set to 0 if it is not.

Add,Variable,Value,First,Last

Similar to the Inc command. Value is added to Variable, and, if it exceeds Last, Variable gets set to the value of First. If Value is a negative and Variable is reduced below First, then Variable gets set to the value of Last.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Sep 2008 19:28
Texp seems to be the equivalent to the VB IIF command - I can do that, but it will evaluate all of the expressions - ie, the following code would print both 'F1' and 'F2':


The BETWEEN function again is easy, and subject to the same.

ADD is more difficult in that particular form, but I think it's doable.

Login to post a reply

Server time is: 2024-11-22 17:08:41
Your offset time is: 2024-11-22 17:08:41