GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 Re: Script Submission » instance_nearest_advanced » 2012-11-20 17:32:41

Hmm would split it in 2 scripts..

Also it is recursion, with the limited stack-function depth (128 I though was the limit in GM:HTML & GM8.1, mike commented and said it somewhere at the bug tracker and it surprised me that it was so low) it is risky. As it is tail recursion the functions can be easily changed to iterative approach.

#2 Re: Off Topic » GMOrganizer - Making up for the loss of gmres files. » 2012-01-27 22:54:40

Bumping this, just finished a "nightly build" (well it's night and I finished it, right?)

The functionailty is done now, what's left is writing some more "mergers" & to write a helpfile / GUI. (I've ordered a book for Qt, so once I finish that book you'll start seeing me pestering you with over-the-top annoying graphical interfaces). Anyways, as it's near complete I decided to license GMOrganizer under GPL & upload it for everyone smile.

Download gmorganizer.zip from Host-A

Tomorrow I'll spent some time on writing a formal help file, though for now you'll have to do it with this in-topic help (or use the flag -help <TOPIC>).. I'd tried to implement a root-system.. Though I failed a bit with it, you can now (when mode is set to ask user for input) choose if you wish to merge, copy or skip the resource. And by giving the sign 2 times (ie "mm" instead of "m") the organizer will do so for the rest of the file I forgot that this isn't exactly as expected. You'd expect it to do the action for everything at this level and lower. So that's on the TO-DO list.

Anyways here are the current command line parameters understood:

  • -help <TOPIC> Shows generic help (or about TOPIC if specified).

  • -i <FILE1;FILE2> Sets the input files, that is the files where the resources are copied from

  • -input <FILE1;FILE2> Sets the input files, that is the files where the resources are copied from 

  • -O <FILE> Sets the input file, that is the file where the resources are copied to 

  • -output <FILE> Sets the input file, that is the file where the resources are copied from, when merging the file has to exist. When splitting the file is cleared firest

  • -merge <RESOURCE1;RESOURCE2> Sets the modus to merging  <RESOURCE1;RESOURCE2> are resource links (1)

  • -split<RESOURCE1;RESOURCE2> Sets the modus to splitting, <RESOURCE1;RESOURCE2> are resource links (1)

  • -Ds Sets the action on duplicate resources to skip duplicates

  • -Do Sets the action on duplicate resources to overwrite duplicates

  • -Da Sets the action on duplicate resources to ask user for action on duplicates

  • -Dm <LEVEL> Sets the action on duplicate resources to merge duplicates, notice that when a resource can't be merged, it will try to do another option. LEVEL indicates the level to which a resource is merged. (0 means infinite)

  • -no_opt When splitting into a new project, objects aren't copied

Project Files
The Organizer works over complete projects, so you should specify the project folder. Ie "gregexp.gmx" or "gregex.gmx". Output is similar, always make sure to provide the extension .gmx otherwise GM crashes.

Resource links
A resource link consists of an identifier for the resource type, followed by the "path". If the identifier ends at a whole "folder" (or simply is the identifier) all resources in the folder are considered. Multiple resource "trees" can be given seperated by ;
examples:
sprites.sprite0 - would specify the sprite "sprite0"
objects.test  - would specify every object in the folder "test", thus "object3" & "object2"
sounds.group.sound1 - would specify the sound1 (under the folder group)
datafiles - would specify all datafiles

All identifiers
sprites, sounds, backgrounds, paths, scripts, fonts, timelines, objects, rooms, extensions, triggers, datafiles & help


Some complete example of calling this:
GMOrganizer.exe -i Gregexp.gmx -o test.gmx -split objects;rooms.rmTest;sprites.sprite0 -no_opt
effect: new project is created "test.gmx". From Gregexp.gmx all objects, the room "rmTest" and "sprite0" is exported. The options for the new project are set to the default options

GMOrganizer.exe -i Gregexp.gmx -o gregex.gmx -merge objects.test.object3;scripts -Dm 0 -Da
effect: Resources are merged from "Gregexp.gmx" to "gregex.gmx" - "object3" & all scripts. If possible it tries to merge the resources, up to an infinite depth. If merging isn't possible it asks for confirmation

GMOrganizer.exe -i Gregexp.gmx -o gregex.gmx -merge timelines;extensions;sprites -Dm 1 -Da
effect: Resources are merged from "Gregexp.gmx" to "gregex.gmx" - all timelines, extensions & sprites. It tries to merge all resources. Inside resource for duplicate settings & entries it asks for user action.

GMOrganizer.exe -i Gregexp.gmx -o gregex.gmx -merge  -Do
effect: simply merges EVERYTHING from "Gregexp.gmx" to "gregex.gmx" Overwriting all resources


---------------------------------------------------
I hope this will tool will become useful for the extending gamemaker capabilities. As with this tool it ought to be relatively easy to export whole "engines". (As long as you keep everything from an engine inside a sperate folder). Also importing engines becomes a "breeze" - the last example is probably everything anyone needs in that regard: you "download" an extension. And then overwrite a possible out-dated.
Merging (Dm) can be used when working on the same project with multiple people, it shows quickly where "differences" appear & tries to find the best combination of both. One might wish to keep all merging at level "1". (only merge based on the existance of duplicate resources, inside resources it can only overwrite or skip). As otherwise it will try to merge events, which results in appending the new data to the existing event. (Obviously that MIGHT be wanted, though better is to explicitelly ask for this).



What I need right now is someone to provide me a real "test" for this, to see what's wrong with it. It ought to never crash gamemaker, I've went through great troubles to verify that the resulting gmx files are always working with GM  - but without an independent test it's hard to say for sure.

I'm not really sure what future this project will be, first I'll read up on Qt, and then I'll check what yoyogames has in mind for GM:studio/gm9.
But hey, it's GPL, everyone will extend this, right?

#3 Re: GML Code Help » A question of style: arguments » 2011-12-30 23:05:03

Daniel wrote:

I always edit the arguments in-place, and will do so until we can somehow define data TYPE's for the arguments, because right now there is no point, but if the function definitions were more like any other language then I would of course use the new argument declerations.

Use for me is that I can swap order of arguments easily.. As well as that it seems more clearer.. What I do now is simply:

Expandvar v;
v = DEFAULT VALUE;
if (argument_count > 0) {
    v = argument[0];
}

#4 Re: Script Submission » ds_list_sort_assoc » 2011-12-30 23:02:37

I just use instances to hold the data in these cases: prevents any programming errors on the algorithm level.

#5 Re: Off Topic » future unimprovement of gamemaker » 2011-12-30 23:00:47

Well doubling the event pace also doubles all calculation gamemaker does behind the schemes. - Better would be if you could just havea "pre-draw event" that your engine is certain to be executed BEFORE the rest of the game (obviously different pre-draw events don't have a given order, but then it would be obvious to have those events not depend on order anyways).

In the very first draw event one can simply draw to the surface tongue.

Also each surface should be capable of redrawing itself at each draw event: otherwise you have a 50/50 chance your game goes boom if a screensaver pops up or another game gets focus.

#6 Re: GML Creations » Here's an interesting keyboard replacement for entering text » 2011-12-26 21:12:19

I'm constantly wondering why those new age keyboards constantly use a qwerty scheme.. They even advertise "now with qwerty keyboard". I mean: qwerty is developed as a keyboard which could ideally be used by a 10-finger typing method. Now with a single finger it is far from ideal (characters which often follow after each other are at opposite parts of the keyboard - requiring a lot of thumb movement), and not logical at all.

Now that method of Ken Perlin seems very promising. I remember reading about it in a magazine some time ago: google was developing it for their androids. (Though it looked a bit different). The advantages were that it uses a shape instead of exact positions.

#7 Re: GML Reference » Disturbing Game Maker Surface Creation Tests » 2011-12-20 07:49:19

mike.dailly wrote:

The first thing I would say, is no matter what the platform, you REALLY don't want to create surfaces "all" the time. You create them once and keep them around. Since moving to hardware rendering this is even more important as surfaces are created "on card" using VRAM, and this is a limited resource. So if you make several large surfaces all the time, you will very quickly fragment memory and never be able to allocate one again.

In "real" cases (i.e. in a game), you will create a surface on object creation, and then keep it around which is what you really want to do.

Problem is there are quite a few cases which destroy surfaces (ie screensaver / other programs). And tehre's no way to "catch" this event. So I've in the past changed quite often simply added (in the step event):

Expandsurface_free(s);
s = surface_create(x,y)

Other solution would be to call "surface_exists()" first I guess (and only recreate on existance)? Though when I tested it with gm6 surface exists was slower than recreating surfaces on the fly. Well I really hope there would be a "solution" sometime for surfaces being freed by external sources.

#8 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-12-18 17:30:24

this bugreport might be interesting.. If I understand it correctly using a subtracting a negative constant gives an error. My quick uneducated guess is that the obfuscator replaces constants with their literals (in a textual manner). Not placing a space/braces becore & after the new constant. Which then results in another token (--x insteand of -(-x) ). (Similar problem to the famous #define macros).


I'm still waiting for rudement d3d actions to be implemented (a lot of my graphic libraries nowadays depend on transformations to only calculate the offset once in a central place and not at each sprite/subsrite to draw).

#9 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-12-07 07:26:36

Thanks for compiling mike's updates smile for us without twitter tongue

Finally, with the arrival or a proper fullscreen API, #HTML5 has gotten the last "missing piece" that will allow it to surpass Flash.

Meh biggest missing piece to me would be no storage api.. Localstorage is just too limited (0.5 - 5 mb depending on browser). - And there's no way to "request" more storage space from a program. (I'm hoping for a standard which shows up a message screen to the user "this app requires more storage space, give it XX space?") Maybe even an API to load files (through a user dialog) from the hard drive.

Also it's still impossible from gamemaker to *load* resources (sprites, sounds) from localstorage, or am I missing something?

#10 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-11-12 05:12:10

Nice to se all major features be implemented now. Now it's probably waiting for better webGL & websocket support before we see big changes.


Hmm wondering now if I should (now that bugs seem to be start to get ironed out) report "annoying" incosistencies in the file format.. Though probably yoyogames doesn't want to get bothered tongue - so I'm posting this here, waiting to be forgotten smile.


For example: each "resource" section is named after the resource name (in plural):
<objects name = "FOLDERNAME"> , <sounds name = "FOLDERNAME"> - which is also the directory name in which the resources are saved. (FOLDERNAME is the name of the folder in the resource tree).

Apart from extensions: those are positioned under <NewExtensions>.

Also for datafiles, the datafile-resource information is stored inside the main gmk (where all other resource information is always stored external in another file). The format of data-file tags is also very strange to my eyes:
<name>, <filename>, <origname> & <data> - name & filename seem to always be synonyms? & data seems to be simply "datafiles/" and then the filename. Original name seems to be an indication for if the data goes missing it copies from there. - But this seems to not work half the time?

further down the room-attributes I wonder strongly if they have any influence:

<rooms name="rooms" roommaxid="100003" room_maxtileid="10000000">

#11 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-11-04 17:11:15

xot wrote:

GM-HTML5 does not fully support importation of Game Maker 5 projects (*.gmd). In particular, it has been observed that sound resources are not referenced correctly during HTML5 compilation. Manually reloading these resources into the project corrects the problem. There appear to be no plans to improve GM5 support.

I'm honestly surprised GM5 is even used nowadays -.-.. Let alone that someone finds a bug here. It uses directdraw, that should indicate the out datedness of gm5.

#12 Re: Off Topic » GMOrganizer - Making up for the loss of gmres files. » 2011-11-01 09:39:24

Not really going to work on an interface - I really dislike making interfaces tongue.


Also I wish to get it working together with subversion, so you can completely automate version control without clicking, many confirmation screens.
Keeping the core a command line interface, as this allows me to run the organizer from within visual studio & other programs (hopefully gamemaker will someday allow pre & post build programs to run).

#13 Off Topic » GMOrganizer - Making up for the loss of gmres files. » 2011-10-31 12:02:35

paul23
Replies: 3

EDIT: please read the 4th post


Hi,

To accomodate for the new structure of gamemaker I've created a small command line tool to split (and later merge) projects. This should make up for the loss of gmres exporting and importing. I'm not really sure where to post this (it's written in C++), maybe at some day I'll post this at the GMC.

Below you can download the file as well as the source.
Download gmorganizer.zip from Host-A


Currently it only features splitting of gamemaker projects - not very useful  I must admit -. Splitting would be done by the library developer to split his library away from the extra resources used for testing etc.
It is a command line application, so you'll have to either run the command prompt, or invoke the program in some other way. A typical call to split would be:

ExpandGMOrganizer -i "Gregexp.gmx" -o "gregex.gmx" -split "sprites;objects.test.group;extensions.GM Printing;help"

Which would split from Gregexp.gmx (project folder) to gregex.gmx. It would take all sprites, all objects in the folder "group" (under test), the extension GM Printing & the help file.


As I said the current version should be considered proof of concept, I'm going to add a "merge" feature soon. The engine is already capable of it, I just need to write a suitable interface. It should become easily more powerful than the old gmres solution was. An example would be objects: as they are xml files themselves too, I could merge 2 objects with the same name into one, allowing multiple developers to work on a single object. - Or any other resource. (Apart from scripts).

For merging I'm really wondering the approach: if the output file would exist would you expect it to be overwritten? - Or would the new input be appended to the output file? Also what are possible solution for collisions of resources? - Should I default to try merging (in case of objects, rooms), or overwrite?


Also everyone: feel very free to write an UI for the application. Haven't got any experience with window libraries in C++ yet, and leave me some feedback smile.

#14 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-10-20 13:45:19

Hmm well "if you say so" tongue - Once GM:HTML5 has stabilized and I know I have to watch out for these errors (as gamemaker no longer reports those back), you know what to hunt, so it might indeed be not too much trouble.


Anyways, I'm always a bit weary of implicit conversions as they might open the door to a point where 1 == "1" is true. Though as far as I can see conversion only happens implicitelly when used on conjunction with operators, and only from numbers to strings.

#15 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-10-19 15:19:59

mike.dailly wrote:

You can't have it both ways.... we can either validate EVERY variable access by going through functions for everything - which is dog slow, or you can go direct to the variables and get code as fast as JavaScript allows, but deal with stuff like this.

Most users would rather have the speed..... at least that's what they're always shouting about. smile

In this case? - That's like omitting exceptions & using arrays instead of vectors in C++ ><.

But at least in debug builds I expect these kind of checks sad

#16 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-10-19 06:20:43

Variable handling has become much more weakly typed.. Even more weak than PHP it seems hmmm

Expandvar myvar;
myvar = 0;
myvar += " hello"; // now myvar is "0 hello"  a string!
myvar -= 1; //now myvar is NaN - an undefined (though considered a number)
myvar += "1"; //now myvar is "NaN1"

This even works with build in variables:

Expandx = "I'm a string!";

When giving a string as argument for the position drawing will implicitelly fail, no error will occur and just the function will be omitted.


I'm going to love debugging in gamemaker now -.-

#17 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-10-06 16:30:56

wow nice that mike has found its way here smile..

And really good you fixed the "/" issue, sorry for the incosistent bug report, but it was pretty hard to pin point the bug as I didn't expect it there.


Now I've got to find time again to use GM a bit more to test more, however with unobfuscated code: you should all try firebug it makes debugging (in firefox) of javascripts real neat.. Line by line execution (and pausing/entering of functions) breakpoints and keeping track of all silent errors. What else you need? tongue


I might actually write a "tutorial" at the gmc about this in the weekend, though I'll first check gm's debugger.

#18 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-10-01 04:28:14

You won't break with that:P

the < & > signs are converted to "<" and ">" respectivelly. - Ow and to let that work, the "&" sign is converted to "&"

#19 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-09-30 19:49:55

Meh, luckily I looked before I reopened the bug -.-.

Well at least they are aware that the bug is there hmmm. I would just like to know what exactly is affected, a simple script to replace all "\\" by "\" placed over all literal strings seems to work..

But what about constants? And are other functions affected, reading from files? When strings are "in memory" they seem to be handled correctly, the strings won't change anymore.

Below is a script which should hence be called over all literal strings.

Expandreturn string_replace("\\","\")

project merging
In other news, I'm working on a GMK split, merge tool. I was decently far before I realized boost::property_tree::ptree doesn't handle different properties with the same id very well. So a read-write cycle breaks a lot of things. (Though this showed up only after I added code for merging). Seems like I have to find a good XML library, am now looking into rapidXML (xerces refuses to load project files as they aren't correctly formatted xml files).
The goal of this would be to have a (command line) application to split and merge, with control over which "branches" to exclude.
I'm wondering if such a tool should "merge" resources (objects, rooms) - or just pick on of the two?

#20 Re: GML Reference » GameMaker:HTML5 - Things that work differently » 2011-09-28 05:00:14

xot wrote:

It is visible but it has fallen to the fourth page with ten other unassigned bugs. I count 89 unassigned bugs in total. sad

With "visible" I meant the bug in gamemaker, not the bug report lol tongue..


The bug gives no error, or other failure.. It fails silently, and in some cases user might think it is their fault ("did I accidentally type double {\\\} somewhere?").

edit:*great* forum software doesn't allow backslashes between spaces tongue

Board footer

Powered by FluxBB