rexrainbow's Recent Forum Activity

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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 ";".

  • I'm trying to use python as more as possible.

    Python is cool. For example, "execfile(FILENAME)" can load python script into event sheet, even if the cap file has been exported to exe file.

    It means someone can customize the game by change the python script without cap file.

  • Here is the test cap file:

    http://dl.dropbox.com/u/5779181/objspv_access.zip

    There are many instances of objA. I try to attach a new member named "_value" on each instance.

    for _obj in objA:
        _obj._value = 10
    _obj = objA[0]
    output.SetText("%d"%(_obj._value))[/code:vvgcwmd3]
    And get the error message:
    [quote:vvgcwmd3]TypeError: %d format: a number is required, not NoneType
    
    from the last one "output.SetText("%d"%(_obj._value))".
    It seems I can not attach new member to each instance.
    
    Another way, 
    [code:vvgcwmd3]objA._value = 10
    output.SetText("%d"%(objA._value))[/code:vvgcwmd3]
    It works. I can attach new member to objA (not objA[0]).
    
    What's different between "objA._value" and "objA[0]._value" in this case?
  • That's cool~ Thanks

  • But how to index objA[1], if there are many objA?

    System.CreateByName("objB", 1, 0, 0)
    SOL.objB.SetPositionToObject("objA[1]", "point")[/code:24de8rgx]
    It doesn't work.
    
    Thanks
  • My goal is to replace "Create Object at Image Point" ex:

    -> System: Create object objB on layer 1 at (0, 0) from objA 's image point "point"[/code:2ymszz8n]
    to python script. 
    
    I try to call 
    [code:2ymszz8n]System.CreateRelObjIP(objB, 1, 0, 0, objA, "point")[/code:2ymszz8n]
    But get error message
    [quote:2ymszz8n]Type Error:CreateRelObjIP() takes exactly 6 arguments (7 given)
    
    
    How to pass parameters to System.CreateRelObjIP()?
    
    My construct version:Construct class 1.2
    
    Edit:
     "System.Create()" may not work, too.
    
    Edit:
    I try 
    [code:2ymszz8n]System.CreateByName("objB", 1, 0, 0)
    SOL.objB.SetPositionToObject(objA, "point")[/code:2ymszz8n]
    and doesn't work.
    
    Test cap is here.
    [url=http://dl.dropbox.com/u/5779181/create_rel_image_point.zip]http://dl.dropbox.com/u/5779181/create_ ... _point.zip[/url]
  • I use Construct Classic (v1.2) on win7 32bit, and got the same result.

rexrainbow's avatar

rexrainbow

Early Adopter

Member since 4 Apr, 2011

Twitter
rexrainbow has 84 followers

Connect with rexrainbow

Trophy Case

  • 13-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies