Mipey's Recent Forum Activity

  • For example I'm going to use hashtables for each entity, if a number of entities gets into hundreds, I imagine simply saving hashtables would result in hundreds of small files. Not good. So I was thinking I could dump them into the ZIP.

    On another thought, I guess there is no point of removing a specific file at all if I'm just using this to save and load the game. Either load all or don't load at all. Dynamic file structure - such as some sort of database - would probably be better off with something other than the ZIP due to the performance hit.

    Thanks!

    Edit: Funny thing, I was experiencing a crash on closing the application until I removed the ZIP object. All I could get was runtime error popup, which disappeared too quickly.

  • From what I have garnered from object information of the ZIP, a couple useful features are missing:

    • remove a file (it supports adding, but not removing files from the archive)
    • password protection (so that nobody but the executable can access the zip)

    A couple trivial things, but they would greatly expand the practical uses of ZIP object, such as an use as save file.

  • But what if you store values externally, say, from a hashtable, which is in a container with the sprite? Would the proper sprites be picked up by checking for hashtable key value?

    As you can see, I used exactly that in the above example and it behaved funny if I picked families by contained hashtable values.

    I want to use hashtable as I will need a dynamic table of variables, while there can be only a fixed number of PVs. Well, I could put numerous values into PVs as concatenated strings, but that'd make things unnecessarily complex (i.e. using Find() to locate the exact string in PV for each object would take more CPU time than just reading hashtable value).

    Oh gee, am I complicating too much? I just want a sprite or some sort of object that represents a RPG character/NPC/enemy with lots of variables of varying amount... the system has to be very robust, if I get bugs like my huge male barbarian suddenly becomes a female gnome witch... well... that'd be fun, actually.

  • I see, makes sense now. I need to clear this up (among other things) before I attempt a real project, so I am making weird stuff like this to see how it works.

    If I got it right, if I want to change a specific sprite, I should pick it singularly instead of the family, but where I need to address a number of sprites, I should use a family instead?

  • Okay, I have attached a demo, which uses contained sprites and hashtables. By right clicking them, the hashtable value is incremented by one.

    At 1 click the sprite turns green, next click it reverts to yellow. At 5 clicks it is destroyed.

    Now, click around a bit and you might notice a funny behavior... Like, sprites start rebelling and changing color when they should not or even get destroyed en masse.

    What gives? Is it a bug? If so, I'd like to pinpoint it down before submitting a report. If it is just sloppy programming on my part, I'd like to have the flaw pointed out.

    Thanks!

  • All this can be dumped into its own event sheet and then pushed aside to be included in any layouts where necessary. A simple way to execute actions linked to buttons would be with a function call.

    MouseKeyboard: On Left Either single or double clicked on Blue
    

    FunctionCall function Blue('MenuItem') (and Forget picked objects)[/code:2f5tekex]

    As you can see, this calls a function with name taken from the menu button variable. The function can be stored anywhere, best on the layout event where menu was generated (assuming the button clicked has "exit" stored within MenuItem variable):

    Function: On function "exit"
    

    System Close application[/code:2f5tekex]

    That is all it takes. And when you need to disable the menu after clicking a button, just set the global variable 'MenuToggle' to 0 within the called function. Poof, menu gone. Hooray for clean code (at least within the layout sheets)!

  • As long as menu operations don't make use of timedelta!

  • I use web space on Google Pages, I just upload stuff and link it there. 100 MB space, which is more than enough for my needs. They have locked signups, though, as they're developing Google Sites, which will have more features.

    Should my creations gain in size in a way Google wouldn't satisfy me anymore, it would be time to get professional, heh.

  • This demo shows how a dynamic menu can be created using a hashtable. The hashtable contains menu items (such as Start Game, Load Game, Save Game, Exit Game etc.), which are read and used to build the menu with. The menu automatically expands and adds necessary amount of buttons as well as set them up to work with.

    All this can be done in runtime; just change the hashtable entries. See the demo here:

    Menu Demo cap

    I am open for alternatives and optimization tips.

    Bug: Also, in this demo the debugger bug is apparent. Run in debug mode, open and close menu, in the instances list in debugger the MenuButton shows as 0 instances, but it contains entries. Clicking one of them will cause a crash. MenuButton is a container object, contained with MenuButtonText, and is destroyed when MenuButtonText is destroyed. Debugger doesn't seem to register this and so refers to non-existing isntances.

  • Okay, it really evaluates inverse when picking families.

    For example I have the following condition:

    Green: Pick by HashTable("Clicks")=1
    

    Green Set filter to 0

    [/code:25y77vpo]

    Green being the family. It does the opposite; the action is performed for ALL objects of the family except for those that pass the condition (i.e. have "Clicks" value of 1). Inverting the whole thing solves this neatly, but it is rather mean to be so misleading!

    So many hours wasted just because of this...

    Edit: nevermind all that, according to tracker the bug has just been fixed! Cheers! Bring on the next version, so that I can get some proper work done

  • That is quite an interesting logical game!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That is what I was not looking for, I was hoping for a system expression or an evaluation that checks if ANY object instance has a certain key with exact value, but oh well, I'll have to go with a workaround, which requires a whole event and is rather unwieldy.

    Hmm, come to think of it, I'll need some sort of 'search' function after all... that searches all hashtables for an exact key and/or value. Might as well create a function especially for that.

    Thanks, though!

Mipey's avatar

Mipey

Member since 16 Jan, 2009

None one is following Mipey yet!

Trophy Case

  • 15-Year Club
  • Email Verified

Progress

16/44
How to earn trophies