Jump to content


Photo

GMTuple


  • Please log in to reply
7 replies to this topic

#1 GameGeisha

GameGeisha

    GameGeisha

  • GMC Member
  • 2739 posts
  • Version:GM:Studio

Posted 17 January 2012 - 07:56 PM

GMTuple v1.1
By GameGeisha

Introduction
Do you need to pass/return multiple values from a script, but getting tired of ripping the script apart into components? Do you need to squeeze several values into one, but getting sick of creating ds_lists and having to clean up every time after that with ds_list_destroy()? No problem, GMTuple can handle the packaging and unpackaging for you.

Features
  • Fast access time
  • Simple to use
  • Compatible with GM8.1 Lite and Pro (HTML5 support coming soon)
  • Tuple data stored as simple strings, can be easily written to and read from files
  • Modular and easy to expand with plugins

What can I do with GMTuple?
Spoiler



Downloads

Core Library

Plugins --- Just import and go!

Demos
Coming soon!


License
GMTuple is released under the MIT License.


Enjoy! If you experience any trouble using GMTuple, or have any suggestions or comments, feel free to post here.

Edited by GameGeisha, 31 January 2012 - 05:19 PM.

  • 2

#2 GameGeisha

GameGeisha

    GameGeisha

  • GMC Member
  • 2739 posts
  • Version:GM:Studio

Posted 31 January 2012 - 05:31 PM

GMTuple has been updated to version 1.1!

This update solves a bug where invalid tuples with corrupt addressing tables are generated for certain input. Both the Core and Builder libraries are affected. If your game uses version 1.0 of either library, just replace the scripts with the new version 1.1 download. No further coding changes are required on your behalf.

GameGeisha
  • 0

#3 GM Flumble

GM Flumble

    GMC Member

  • New Member
  • 12 posts

Posted 11 February 2012 - 10:59 PM

Now that's a great way to do resource handling: not using them. :D That's some good inspiration now that I'm working on a JSON parser.
Also, your documentation is very nice, clear and consistent.

I do have some remarks, however:
  • strings have an upper limit of 100000 characters and cause undefined (but definitely not the expected) behaviour when exceeded - you might want to note that in the documentation or make a workaround*
  • does your scientific notation use the exact precision of GM or do you lose some precision when converting?
  • the to string-functions do not place quotes around the strings. For clearness and compatibility with e.g. JSON, you might want to add those.
  • since every (n+1)-th value directly follows the n-th, you do not have to write both the starting and ending addresses. (and for the end address of the last argument, string_length() will do)
  • chr(argument_count+65) and string(isstr) create the same behaviour as chr(argument_count) and chr(isstr) but with printable characters, so you can easily write them down somewhere

As for the tuple builder, I'd recommend to use globalvars, so you don't have to use global. everywhere. Also, while the access times of arrays are lower, the memory will never be freed, unlike ds_lists.


*a varint will do, but requires you to loop through all n indices when you want the n-th element
  • 0

#4 Zesterer

Zesterer

    Professor of Articul

  • GMC Member
  • 1018 posts
  • Version:GM8

Posted 11 February 2012 - 11:58 PM

So - could it be used to save/load the contents of a 128x128 ds_grid into and out of memory very quickly? (less than 10 seconds)?
  • 0

#5 Yal

Yal

    Gun Princess

  • Global Moderators
  • 5813 posts
  • Version:GM8.1

Posted 11 June 2012 - 09:33 AM

Zerester, that's a highly subjective question. Assuming a fast enough processor, anything is possible.


This seems interesting... oh, all the times I've longed for a way to pass and recieve multiple values at once from scripts! I'll certainly take notes about this extension.
  • 0

#6 GStick

GStick

    All Secrets Exposed

  • GMC Member
  • 1571 posts
  • Version:GM:Studio

Posted 11 June 2012 - 08:54 PM

Bookmarking this... tuples are extremely useful...
  • 0

#7 CarlosMarti123

CarlosMarti123

    GMC Member

  • GMC Member
  • 7 posts

Posted 21 June 2012 - 06:20 AM

Bookmarking this... tuples are extremely useful...


Game Maker should definitely employ tuples as a data structure or type some time in the future. I can't imagine how many times I've wanted to pass more than one value from a script, without using lists or having to create separate scripts (which of course wastes a lot of processing time).
  • 0

#8 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3274 posts
  • Version:GM8.1

Posted 29 June 2012 - 03:47 AM

game maker can already pass multiple values. when a script is executed the variables inside become local variables to the instance calling them
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users