Silent Cacophony's Recent Forum Activity

  • I'd recommend setting up some simple tests that compare performance between the two in ways that matter to your application.

    In my own past tests, doing things like moving sprites around, python has been significantly slower than using events. However, you can mix events and scripts just fine, and that is what I often do.

    Python has some distinct advantages when you need complex data structures, and for re-usability of code, among other things.

  • how would you go about displaying only a certain type of file?

    like a particular file extension, is that possible?

    + Your condition...
    -> ListBox: Add line File.FileListFiltered("F:\Downloads", "*.cap")[/code:tghtci61]
    
    This shows me all of the .cap files in my download folder. Check out this wiki page for more that the file object can do:
    
    [url=http://sourceforge.net/apps/mediawiki/construct/index.php?title=File_Object]http://sourceforge.net/apps/mediawiki/c ... ile_Object[/url]
    
    It does have the elements necessary for more complex file and/or directory listing. Also, the Common Dialog Object has some uses in this area, if you don't mind a windows-style requester, though it's not quite as flexible as the file object.
  • For a very simple list of files, I have used this:

    -> ListBox: Add line File.FileList("F:\Downloads")[/code:2bxjb9by]
    
    Just drop in a listbox and file object, and add that action somewhere. That path is just my download directory, which has hundreds of files. It seems to handle separating each file into a new line just fine.
    
    You can handle selections or double-clicks easily with something like this (which only copies the filename to a text object):
    
    [code:2bxjb9by]+ ListBox: Selection changed
    -> Text: Set text to ListBox.LineText(ListBox.SelectedLine)
    
    or...
    
    + ListBox: Double clicked
    -> Text: Set text to ListBox.LineText(ListBox.SelectedLine)
    [/code:2bxjb9by]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there a way to make a mathematical formula that checks for any value between a set minimum and maximum number?

    I'm responding to this question in general, since it seems that the overlapping condition is not the only case you are looking to use. That would be a bit complicated and inefficient, as mentioned.

    In case you don't know of this, and you just want to check if a variable is within a certain range, there are two easy ways to do that. The System conditions Number is between... and Evaluate can be used to do so:

    + System: Sprite.Angle is between 5 and 10

    -> Do stuff...

    + System: Sprite.Angle >= 5 and Sprite.Angle <= 10

    -> Do stuff...

    Of course, you can use any variable for any of the numbers there, as well.

  • I seem to have this problem most of the time. You don't, however, need to use tabs for indentation. Spaces work quite fine.

    Whichever you use, you must be consistent with the character used, and how many that you use for each level.

    I usually just end up using IDLE or Notepad for the large chunks of code, because of that tabbing problem.

  • thank you sirs.

    edit: it appears to be software limited, is there a way to remove the limit to speed up the process? It seems to perform one process per 'tick'?

    Note that I said this was a prototype in the OP. The slow speed is caused by my use of sprites and such in the visual creation of the levels. They need to be updated every tick for something like this to work at all. So, I had to design two nested, 'for loop' alternatives that would run one iteration per tick, using groups.

    That is exactly why I'm writing a Python version of it, which will be just data processing, and should be quite fast. The result will be a Python object containing a 2D list and some other data. The list will optionally be able to be copied to a Construct Array object.

    This is not intended to be anything like a plugin. I'm rolling my own dungeon generator, and maybe some others might find the methods that I used useful. The Python version will have the advantage of being able to easily put into another project, and expand upon, for those who have learned a little Python, or just copy to an Array object easily for those who don't like Python.

  • Hay, construct noob here. I'm picking up construct with the hope of making my own roguelike (looks like I came just on time too, it appears to be in fashion ).

    It says I need a different version though, I could only find .99.91 on the website, is there a beta version you're using or something?

    Yeah, it was done with v0.99.92. I forgot to mention that. May as well go for the latest build that Krush mentioned.

    On another note, I'm going to write a Python version of this without the visual creation. I'll most likely just use a couple of simple objects and keep it to a fairly straight translation of this. Depending upon how much time I have (I'm extra busy lately), it should be done this week sometime, hopefully. This could be easily dropped into any existing project, and extended as needed to fit the game.

  • I haven't had any problems like that. It didn't make heavy use of families, but I recently posted an example .cap that used a family so that I could pick two different instances of the same object, and it referenced private variables, here: http://www.scirra.com/forum/viewtopic.php?f=16&t=7028. I've used families for other things with no problems, as well. I did have one project that had a different problem that I never figured out, which used families, though. This was several builds of Construct ago...

    [quote:24k7cs23]I read this in the Wiki about families:

    "Note that adding a new object to a family with common private variables, effects or behaviors will invalidate all existing events using them, if it does not have the same common variables etc. To ensure consistency between objects, the family manager should be used to add and remove objects from families."

    I think that this means that if you manually add a new object to a family in the layout editor, without using the family manager, and it doesn't have the common variables that the other objects have, that Construct will likely not work correctly in regards to that family. This would be understandable, if so.

    As I recall, if you use the family manager to do so, it will take steps to ensure that the new object has the common attributes.

  • Nice examples. Pretty cool how easily things can be done in Construct.

    I had to have a go at this, and I thought of the lerp() system expression. This would be useful if you need the number of links to change at runtime, too.

    The first 'link' always is centered behind the 'head' in this example, and the rest are spaced in between it and the 'anchor'. This could be changed easily, though, by using 1/(Link.Count+1)*LoopIndex, or changing the 1 to 0.9, or something similar.

    http://dl.dropbox.com/u/5868916/ChainExample.cap

    Just make sure there is at least one 'link', or bad things may happen, unless a check for that were added.

  • I was just thinking about this thing again, and wondered about how to do a cursor. I found that it is feasible, though it'd be a bit more complicated than I'd like to make for a multi-line editbox.

    It's pretty simple for a single-line box if you limit the text length so that you don't run out of the Text display area. Here's a quick example:

    http://dl.dropbox.com/u/5868916/EditBoxCursor.cap

    The cursor is just a sprite with the hotspot set to lower-left, and sine-opacity behavior.

    This doesn't handle shift-selecting very well, but hey... I'm sure that could be done, too.

  • There are a few ways to set the cursor to the end of the text in an EditBox. Here are two that I've used:

    EditBox.SelectAll()
    EditBox.ClearSelection()
    
    or:
    
    EditBox.SetSelection(len(EditBox.Text), len(EditBox.Text))[/code:1ck842a0]
    
    I greatly prefer the latter when the text is large, as it's faster, and prevents the selection flashing that the former causes. It just sets the start and end of the selection to the end of the text, which doesn't really select anything.
    
    As for making the .cap above with less events and separate objects, you can use a single Text object for all of those separate ones for the denominations, with private variables set differently for each instance to make them distinct. This can be done at runtime with a for loop that creates each instance at a different Y location, then sets an ID or Index private variable for each immediately after, using LoopIndex or something similar. Or, you can clone them in the layout editor, and set each manually there.
    
    I'd probably have a private variable for ID, Denomination, and Number. ID would be 1-12, Denomination could be set at runtime with [i]{1,2,5,10,20,50,100,200,500,1000,2000,5000} @ LoopIndex[/i], and Number would store the number that has been input for that denomination.
    
    Also, this way you could do a for each to total the amount by adding Denomination * Number to another variable.
  • These sound like some great fixes and additions. Thanks, guys.

Silent Cacophony's avatar

Silent Cacophony

Member since 11 Mar, 2010

None one is following Silent Cacophony yet!

Trophy Case

  • 14-Year Club

Progress

14/44
How to earn trophies