rexrainbow's Forum Posts

  • I had implemented a 'date' plugin simply wrapped from javascript's Date object.

    Here is the zip file.

    You can get full year, month, date, hours, minutes, seconds, milliseconds from expression.

    And provided an action:Start timer, expression: Timer to get delta time in milliseconds. See the capx in zip file for example.

  • Thanks a lot.

  • Hi, I write a simple plugin to implement 'function' object like in C1.

    There is my plugin and test capx.

    dl.dropbox.com/u/5779181/plugins.7z

    I call 'runtime.trigger' in acts.CallFunction to trigger cnds.OnFunctionCalled.

         acts.CallFunction = function (name)
         {
            this._function_name = name; 
           ??this.runtime.trigger(cr.plugins_.MyFunction.prototype.cnds.OnFunctionCalled, this);
         }; 
         cnds.OnFunctionCalled = function (name)
         {
              return (this._function_name == name);
         };

    It works fine, OnFunctionCalled can be triggered correctly.

    But, there are something wrong when go back to caller.

    I find that in eveng.js, function: run_actions_and_subevents

              // Run each action
              for (evinfo.actindex = 0, len = this.actions.length; evinfo.actindex < len; evinfo.actindex++)
              {
                  ?if (this.actions[evinfo.actindex].run())
                        return;
              }

    evinfo.actindex is incorrected when runtime.trigger finished.

    In my test case,

    evinfo.actindex = 2 when executing action line 3 (Call function).

    Event "On function" only has 1 line, so that evinfo.actindex = 1 when leaved.

    Now, go back to previous for loop (run_actions_and_subevents). The evinfo.actindex changed to 1 (before was 2)

    So that line 3 will be executed again, and again.

    Do I miss something about using 'runtime.trigger'?

  • Using 'print' command to dump message at development period is import for me, so that I wrote a small application to let 'print' command work in construct.

    Tool can be download at

    sites.google.com/a/binhua.twbbs.org/construct-project/FileStorage/MessageConsoleClient.7z

    I use a named pipe client to send 'print' message from construct to my named pipe server application.

    The instruction of using this tool is,

    1. open named pipe server application MessageConsoleServer\MessageConsoleServer.exe

    2. execute construct application

  • Yes, it's my own. All of these source files are put in zip file.

    The concept of timeline is simple.

    At each tick:

    1. get current time

    2. pick timer which is time-out.

    3. execute callback function of timer picked in step2

    A performance issue is, it need call python function each tick.

  • Thanks, I got it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have wrote a timeline in python before.

    sites.google.com/a/binhua.twbbs.org/construct-project/FileStorage/timeLine.7z

    Here is a sample code to

    1. flash a sprite object immediately

    2. then wait 2 second

    3. rotate the sprite each 0.01 second

    def test_iter(timer, obj):

        obj.Flash(0.1, 1)

        timer.delay_time = 2

        yield QTimer.CONTINUE

        timer.delay_time = 0.01

        while(1):

            obj.RotateClockwise(1)

            yield QTimer.CONTINUE

  • Hi, I can't find link of example cap file, would you please tell me where to download it?

  • Thanks, the plasma works.

    Dose "Plasma.PasteObject("fireball")" means I can not designate a target instance(ex: fireball[0]) from a kind object?

    "if 1:" is just a switch to easy turn off python script by change "1" to "0"(just for testing purpose). The built-event can turn off by clicking "Toggle event".

  • There is test cap file:

    dl.dropbox.com/u/5779181/Plasma_test.7z

    I transfer these event:

    + System: Always (every tick)

    -> fireball: Set position to object rot_arm (image point 1)

    -> Plasma: Paste fireball into plasma

    into python script:

    fireball.X = rot_arm.ImagePointX("point")

    fireball.Y = rot_arm.ImagePointY("point")

    Plasma.PasteObject(fireball)

    Plasma is shown in upper case, but not in lower case (python script).

    How to using Plasma in python script?

  • It works. Thank you again.

  • Thanks, it's very clear.

    Sorry for another question, I try to override System.Create() for the same reason, to add some custom initialize. How to get the class of "System"?

  • I test the "objA[0].Destroy() call objAInstance.Destroy()" is success. Now I can override Destroy method for doing some clean-up processes.

  • Hi, Master of Python,

    This code works in my case. Thanks.

    New member is stored into global (hash)table _Instances._vals_

    If an instance has been destroyed, the member of this dead instance in _Instances._vals_ will not be released automatic.

    Btw, the variable type in construct only support "Number" and "String", so that I can not store instance directly.

    I save the UID of instance and find it from adding an "compared" event, if I only use built-in event sheet (w/o python support).

    Question:

    Is there a faster way to keep the selected instances (w/o python support)?

    With python, I save the {UID:instance} in a (hash)table, and clean the {UID:instance} pair if the instance has been destroyed.

    Humm... Maybe I can cover the 'Destroy' method in objAInstance in _Instances to hang my clean method.

    Question:

    1. What is _Instances?

    2. Will objA[0].Destroy() call objAInstance.Destroy()? Is objAInstance the class of objA[0]?

    Thank you for your help

  • I find a pure python module "ConfigObj" for access unicode INI file.

    http://www.voidspace.org.uk/python/conf ... ownloading

    There is a little different between built-in INI object and "ConfigObj". The comment in "ConfigObj" is using "#", not ";".