WarpedOldMan's Forum Posts

  • I understand, thanks for commenting. I'm not sure if it's the right direction to go in anyway.

    It would actually be better if we had a generic "Object" object, to which we could add sprites, dictionaries, arrays, and such as components.

    The families system is a little awkward to use, but using multiple families and sticking many objects in several of them, I can make a system that isn't too ugly, and allows for relative easy creation of AI. But this kind of falls apart when I'm trying to basically custom make a container system for half of my objects with events.

    For instance, let's say I have a family called "friendly". Each object in this family has a nice pre-defined polygon used for collision, however, during certain circumstances, I also want to have each "friendly" use a second, and different collision polygon. So, I make a second transparent dummy sprite with a different collision polygon, and give it the "Pin" behavior. Now though, I'll need to create it each time an instance in the "friendly" family is created, pin it to that instance, and then destroy that same instance, if the "parent" instance is ever destroyed.

    One might look at that and say, "I don't see the problem, it looks simple to me.". But that kind of "fix" is rather ugly because it piles on top of other little "fixes" scattered throughout the event sheet. And also, it's likely not very optimized if you want to have a layout with a few hundred objects with even simple AI running.

  • Ah, ok. Well thanks for confirming anyway.

    I always seem to struggle with making groups of objects behave as one entity, while also building simple and clean AI for these object-groups/entities.

  • Since families are restricted to one object type in C2, it seems odd to me that you can't put families in a container.

    I'm at a point in my current project where this would be extremely useful and time-saving.

    Is there some technical or design-philosophy reason that this isn't done?

    Also, has anyone else wanted this, and come up with a substitute that isn't ugly.

  • I've done some testing.

    The "tokenat" function seems to recognize "my string" alone as a separator and also recognizes a Newline alone as a separator, but it doesn't seem to recognize "my string" & newline as a separator.

    I should add that "my string" & newline do follow each other directly such that they should work as a separator.

    Also, I tried using the "find" function on my source string to look for the index of "my string" & newline. Unfortunately it returns a -1. I do get the correct index if I use "find" with "my string" or Newline, just not when I use "find" with "my string" & newline.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am indeed only trying to delete files in folders that I have created with the runtime.

    What I'm trying to make is a profiles system. What a profile is, is just a folder with a name. In a "Profiles" folder.

    With the runtime, I create an "insert-game-name-here" folder in the Appdata\Roaming Directory. Inside this I create the "Profiles" folder.

    So far, I have profile creation working well enough, but I also want the user to be able to delete a profile. This should just mean deleting the folder and all of it's contents.

    The reason that I don't want to/can't just delete all the files in the folder explicitly is that the # of files, and folders and further sub-folders in the particularly profile-folder that I want to delete will vary depending on the profile.

  • I modified the Node-Webkit plugin to allow for removing an empty directory.

    I also attempted to include the recursive folder deletion, but I don't really know JS or programming much at all, so I failed at that.

    My next thought was to simply expose the ability to check if a path is a directory or a file in C2, then I could implement the recursive folder deletion from within construct, a much more familiar environment. I've failed at this as well so far, however.

    For now, I think that there is a very ugly method I can use to recursively delete a folder within construct using only the delete-an-empty-folder option.

  • Ah, well it's good to know that I'm not just missing something.

    I'm a little surprised that I can delete files but not folders.

    Anyway, thanks for looking into this for me TiAm.

  • I may be missing something completely obvious.

    In Node-Webkit's actions I see the "Delete File" action, but no "Delete Folder". The "Delete File" action accepts a path, and I tried a path to a folder to be deleted, but it does not seem to work. All the other file and folder actions behave as expected, so I don't think this is related to a file or folder's access permissions.

    I've tried to check the manual entry on Node-Webkit but it seems to just lead to a download page for the plugin.

    I'm using the latest version of C2 and the Node-Webkit plugin.

  • Ah, it does work as you say. Thanks for confirming the intended behavior. Knowing this, I can rework my event structure appropriately.

  • If possible, I would like to confirm that something I am observing is intentional, unintentional, or an error in my events.

    Ok, so my layout has 4 instances of an object.

    I have a function named "deleteobject".

    • in a subevent's condition I pick one of these four instances (arbitrarily) by UID.
    • then use the normal "destroy" action in that same event for that object.
    • immediately following that action, in the same event, I set a global variable to object.count

    I call the function and destroy the object, then set the global variable to object.count, so object.count should return a value of 3 not 4 correct?

  • I think I figured out what the problem is, my example .capx is probably too complicated to be of much use to anyone but myself.

    When I deleted the node, and tried to get a keycount directly before that, a mix-up in the events also caused nodes to be added to the client list immediately before the deletion went through, causing a keycount of 3 instead of 1.

  • I've now tested this in both the latest stable release, and the latest beta; no change unfortunately.

    If anyone tries out the supplied .capx and needs further clarification about what the problem is and what I'm trying to achieve I can try to explain further.

  • Ah, that plugin is unnecessary to the project anyway. I've removed the plugin and attached the updated file. In the meantime I will try updating to the latest stable release and see also if that fixes my problem.

  • I'm not exactly sure how to explain my problem. Instead, I'll explain how to reproduce it.

    Firstly, you'll need to open the attached .capx file.

    Debug the layout. (I usually open the debugger in a separate window)

    Next you'll need to create a couple nodes. To do this, press the "1" key to begin placing a node. Click with the mouse to finalize the placement.

    Make two nodes in addition to the nodes that are already present on the layout on start.

    Place the two new nodes close to the existing nodes (preferably within 200px).

    Now, pay attention to global variable "diagnostic2", and middle click node #1.

    For some reason I get a value of 3, when it should be a value of 1.

    The key-count is too high, as far as I can tell only one instance of the dictionary is selected and it can only have 1 key at most (provided that my setup directions are followed).

    The relevant event in the project is #79.

    The project is quite messy and not commented in any useful way, however I hope that the issue is isolated enough that my mistake will be evident to an outside observer.

  • Hmm, for some reason I thought that dictionary keys weren't indexed. Your method looks like it will work just fine.

    Thanks for your help, this one had me stumped.