crowtongue's Forum Posts

  • This is extremely helpful! Thank you.

    There are two other parts to this I need to get working, but the main thing that is holding me back is I am trying to convert this so it can work with both the X and Y coordinates of an array.

    In the example I posted the array size was 50 x 1 x 1. I'd like it to be able to be 50 x 50 x 1. For some reason I can't seem to get it to fill the hash table properly like this, since I have to use a numbering system like HashTable("31,32").

  • I've had a thread about this before that ended up getting too confusing because it was about my project as a whole.

    I have created a simple project to illustrate what I am trying to get working. You can download that here:

    https://dl.dropbox.com/u/69407974/hashtable%20to%20array%20conversion.cap

    Basically, I am moving the contents of an array to a hashtable, by creating keys for each X of my array, then putting the value inside it. When the load button is pressed I want to set the values in Array back to their corresponding ones stored in the HashTable.

    As it stands, the array just ends up loading nothing.

    Why not use a HashTable instead of an array? I will be storing lots of other stuff in the HashTable as well, and that would end up breaking a lot of other things.

    Thanks for any and all input into this!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sad to hear this. But good luck wherever you move on to.

  • I thought I did! And.. I didn't. Let me take a look again.

  • I don't think it should become it's own thread. And I think it depends on the nature of the derailment.

    Think about it. This only serves to deter people, in the forum for this program, from wanting to use this program.

    While your experience is definitely valuable, I don't 100% put stock in it. Konjak has been developing The Iconoclasts with this, and 6e6e6e has been making Radio The Universe with it. Both of those are full length polished games in the works, I believe they will both finish.

    I've been working on my own project for a few months now, and it's discouraging to see other people start this sort of thing. I'll say it again, it's not constructive. And now I will stop reading this thread.

  • It would probably be easy if you would post a link to your .cap

    https://www.dropbox.com/ is a good place to start if you need somewhere to store files.

  • Boo

  • If you mean that your menu won't appear then:

    go to event 71. Right click the condition "Layer "menu" is visible". Select "Invert Condition." Now, in the action for this event change "Set Layer "menu" visible:Invisible" to "Visible" instead.

    If you mean that you can't load files then...

    in event 47, move the action "Array: Clear with 0" directly above the "Load Array" action.

  • Wow! That's a lot to process.

    So I've got it. A HashTable has to have a KEY that is a string, but it doesn't matter whether the value is a string or integer. Thanks for the lucid explanation.

    Your example is fantastic. I'd never actually considered storing multiple levels within a map. I think I will probably use that idea eventually, but it's going to wait until I finish the basic version of this (random map generation would be something I'd love to put in later too.)

    I have one concern. One of the things I've been quite happy with in this project is the possibility of making a map as big as 1000x1000. I once tried storing all of the paths to texture files in a global variable, and it crashed construct after about 40 of them (they were pretty convoluted to be fair c:\users\documents\dropbox\construct projects... etc..) Anyways, I can't find anything on a hard limit for global variables, would you happen to know what it is?

    In the meantime this is much simpler than the method I was using, which took me two new files to figure out and a bunch of messy notes on a pad of paper!

    and don't worry, I didn't take offense. Just seems like a lot of work helping out everyone, and I'm eager to be able to do the same.

  • AH! I had read on the Wiki that hashtables could only store strings, but I had stored numbers in them before so I just assumed that this was old news. I think I had determined that with input from a textbox, which must default to being a string even if it is a number?

    This makes sense now.

    As for your point about why I care I'm not too sure if it's rhetoric or not so I'll answer:

    This isn't a game, it's a map editor! So I expect myself and whoever else uses it to move files around. As I make maps they pile up pretty fast. If I were to split the file out of wanting to take the easier route I would end up having to make 3 files each per map (not including the optional tileset save file)... so it just starts to get kinda messy.

    And I could use folders, but I think it is just easier if I want to share a map with someone to just send one map file.

    The second thing is that while I'm mostly making this for me (maybe a couple of friends, and I plan to share it on the forum) I'd rather not have to code for an exception if one of the files is missing. Just easier, once I hit the bug squashing phase I'm going to have my hands pretty full anyways.

    You make a great point about spending more time helping people too. I find when I look (and I do whenever I'm on here) I don't have anything to contribute to questions about physics, or controller issues, or AI. This will change when I'm done this map editor and actually focusing on making games, but in the meantime I am constantly amazed at the frequency that you and Jayjay and R0j0hound help people.

    If I haven't said it before, thank you so much.

  • You're right, sorry about that! I didn't initially realize what the problem was because it was manifesting in a strange way.

    I've re-titled this thread and rewritten my first post to try and clear things up.

    So I need to figure out how to create keys in a HashTable for each element in my array, and give it a name indicative of the position in the array. (ie: x10, y52)

    My first thought would be to use:

    For Each Element -> HashTable: Insert key Array.CurrentX with value Array.CurrentValue

    This does nothing. I also tried creating a loop and using Loopindex instead, which also didn't work.

  • Thanks for your response!

    The file actually loads fine. It's just that it can't store more than one of these objects at a time. It either stores the contents of a hashtable, or the contents of an array.

  • I've also discovered that you can only save one array or one hashtable to a file at a time.

    I guess I could use the INI object to store my variables, but I would rather everything be stored in one file.

    I'll have to try and make some sort of loop that stores the contents of my array into the hashtable while saving, and empties it back into the array on loading.

  • Arsonide -

    Construct Throwback is a great idea! I hope as you continue down that road you keep us updated. I would love to keep using CC, I'm not sure the HTML5 thing is ever going to be quite what I want from it.

  • This is for the purpose of saving and loading using my tile based map editor.

    I would only like to have one file per save. I need to save a bunch of values from global variables, and the contents of (at least) one array.

    To do this I need to move all of the array to a HashTable before saving the file, then upon loading I need to reverse the process, overwriting the array with the contents of the HashTable (excluding global variables obviously.)

    *Edited, thread re titled, and post rewritten for clarity. Keep this in mind if the next post or two seem redundant!