Silent Cacophony's Recent Forum Activity

  • Thank you very much. That helped me a lot. But one little Problem is still there. How can i load an Image from an ini file with such a function ?

    INI.ItemString("item1", "image1") does not work in Function.ProcessSprite("Sprite", "Sprite2").

    If i can load the image from an ini string, my problem will be solved.

    You're welcome. I'm not terribly familiar with the INI object, but I added one and replaced the function call in start of layout with this:

    + System: Start of layout
    -> INI: Set INI file to "MyINI"
    -> INI: Write string "Sprite2" to item "Item1" in group "Group1"
    -> Function: Call function Function.ProcessSprite("Sprite", INI.ItemString("Group1", "Item1")) (and Forget picked objects)
    [/code:2h0ho73a]
    
    ... and it worked the same as before. Assuming that you're storing object names in the INI file.
    
    Also, the same as above can be done from python as:
    
    [code:2h0ho73a]INI.SetFile("MyINI")
    INI.WriteString("Group1","Item1","Sprite2")
    Function.AddParam("Sprite")
    Function.AddParam(INI.ItemString("Group1","Item1"))
    Function.Call("ProcessSprite", 0)[/code:2h0ho73a]
  • Well, you can use variables instead of string or number literals. The variable just has to contain the name in string form, or the Object ID in number form, as R0J0hound pointed out.

    The bigger issue is the fact that the python methods are messed up, but it should be possible to work around that with the function object. I made a simple example with a couple of different ways to use the function object to do image processing, including from python.

    v.99.84 Cap here: http://dl.dropbox.com/u/5868916/FunctionWorkaround.cap

  • Yeah, I can't get it to work either.

    I also noticed that there seems to be no method defined for 'Copy from sprite', which makes Python usage of the manipulator even more difficult.

  • Hi. From my interpretation of the original post, it sounds as if you only need a 2-D array, like so:

    x1y1, x1y2, x1y3,

    x2y1, x2y2, x2y3,

    x3y1 ...

    Ok, so that may not be clear, but I made a simple example based upon what you described, and showing loops as well:

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I generally make a copy of an event by dragging it while holding control, then make the new condition, then delete the rest of the conditions and actions. It depends on the event, but this can be sometimes faster.

    Wow. I didn't know about the control-drag thing. Thanks for the tip. That will do nicely for me.

    I may as well add that this issue has annoyed me in the past as well...

  • Oops. After using this more, I found a bug in the way I handled detection of the 'enter' key, which also affected command editing around newlines. I also decided to add a few minor changes along with that fix.

    • Fixed the bug with 'enter' key handling, and cleaned up some unnecessary code along with it.
    • Added a control to reset the shell (control - delete.) This returns the shell to it's initial state, but leaves the Python environment the same. Any classes/functions/variables assigned will remain.
    • The shell now loses focus when a command is executing. This serves as a visual cue, and prevents extraneous input. It also regains focus automatically after exceptions are raised.
    • The first entry in the command history is now an empty string, to serve as an indicator that the beginning of the history has been reached when cycling through it. Also, other empty and exact duplicate commands are now discarded instead of being added to the command history.

    I can't seem to break it now, so hopefully that will do it.

  • Ouch... That is surely a sad amount of code for the end result. I think I'd prefer SDL or some other framework for something like that.

    Anyway, dev appreciation is surely in order for a great project such as this one. Thanks to core devs especially, and also to those who have pitched in plugins and fixes and such.

  • Thanks for the comments. I've updated this a bit.

    I've found myself using this more often, so I set about making it a bit more user friendly. After a fair amount of trying to force Construct's EditBox object to do my bidding, the result is what I consider to be a fairly respectable command line shell. It works in a manner similar to the Windows version of the Python IDLE Shell, with a command history that works similarly to older shells. Some notable features:

    • Like the Python IDLE Shell, when a command block is entered, if it evaluates to an expression, the shell will print a representation of the result (if it is not the value None.) Otherwise, it is simply executed.
    • Auto indentation similar to the Python IDLE Shell.
    • Keeps a display history of (approximately) the most recent 90,000 characters in the shell. This is able to be changed easily. Higher numbers may slow the shell's responsiveness. This display history may not be changed, but may be moved through in order to copy portions and such.
    • Keeps a command history of all command blocks that have been entered. These commands are recalled in a manner similar to the way that old unix shells work. In this case, 'control - up arrow' moves in reverse through the commands, and 'control - down arrow' moves forward through the commands. Recalled commands replace any current command entry, and may be edited (or not) and executed again.
    • All variables used in the code here were added to the 'Shell' object so that they would not pollute the global namespace. Otherwise, there is a PyShellOutput object name added to handle output.

    I had also hoped to thread the output so that it didn't display all of the output only after the command block was done executing, but ran into deadlocks when trying to access Construct objects from a thread. I scrapped that, as it's not of much consequence.

    I set the window/layout size to 640 x 480, but it's easy enough to change to one's preference. I decided against making window resizing possible, as I couldn't get it to work to my satisfaction.

    The screen shot and attachment are updated in the original post for this version.

  • Without MS we wouldn't have computers or Al gore's etherweb. So we will be their slaves forever, and love it.

    Computers and the internet would certainly still be here, had Microsoft never existed... The 'popular' OS would probably be based upon Linux, which would be fine by me.

    I'll leave it at that for a MSRANT.

    Anyway, I've always found it quite alarming how the masses of young people looking to enter any market always seem to jump on the most crowded bandwagon. How is one to distinguish oneself from the rest that way? Ah well...

    OpenGL isn't going away, in any case, so those who dare to be different can enjoy it if they wish.

  • Look for the Common Dialog object. For a quick test:

    • Start a new project
    • insert a CommonDialog and an EditBox into the layout
    • make two events in the event sheet like so:
    + System: Start of layout
    -> CommonDialog: Show open dialog
    + CommonDialog: File dialog: OK
    -> EditBox: Set text to CommonDialog.FirstSelectedFile[/code:8irsnubz]
    
    Note that you can do this without typing anything, if you haven't learned the finer points of Construct's interface. You can also do quite a bit more with this object.
    
    Anyway, the result is a string, and can be used in any other way as such.
  • [Edit]At last it's working, but I need to know something. Is there any Wildcard option (*) in Construct?

    I don't think that Construct has any regular expression support, but you can probably do make an acceptable function in Construct using the text processing functions shown here:

    http://sourceforge.net/apps/mediawiki/c ... xpressions

  • Hello.

    I don't have the registry key that you mention:

    "/HKEY_CURRENT_USER/Control Panel/Desktop/MuiCached/MachinePreferredUILanguages"

    The bold part is as far as I could go on that path.

    I do, however, have "\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Nls\Language\Default", mentioned earlier, which correctly has value 0409 for English.

    Also, I found "HKEY_CURRENT_USER\Control Panel\International", which had an item "sLanguage" with value "ENU" for U.S. English. I don't know if one can count on that being there for other machines.

    EDIT - I got a bit more curious about this, and tried it in Construct 0.99.84. I Created a new .cap, dropped a Registry and a Text object in it, and it works. Here is the one event that I used 'copied as text' using Construct:

    + System: Start of layout
    -> Registry: Open key "SYSTEM\\ControlSet001\\Control\\Nls\\Language" under root HKEY_LOCAL_MAHCINE
    -> Text: Set text to "Language code is " & Registry.ReadString("Default")[/code:2s6rxsh0]
    
    This displays 0409 for me (US English.)
    
    Note that the backslashes were 'escaped' using double backslashes, and the 'MAHCINE' is a typo in Construct.
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