'S' update as of 4/12/11

This forum is currently in read-only mode.
From the Asset Store
Pack of illustrator graphic styles. Make your own logos, game titles, or anything you want.
  • hey lucid , i've been playing a bit with your "S" plugin and it's great so far So could you or someone assist me on this? : how do i delete an object and destroy it only without destroying all the others ?? I've tried "destroy object", it destroys the object but do not delete it from array... and "delete object" , removes it from array and destroys all the others (only one type) .Does it has something to do with object range ?

  • sorry for the late response.

    delete an object from an array should give you the option of whether to destroy the object, and should only destroy that one instance, and not all of that type.

    ill try to take a look at this when i get home

  • thnx for the response i tried it this way and it worked:

    <img src="http://i47.tinypic.com/24m5bnp.png">

  • Hey all,

    I'm still new to Construct so I'm a little bit in the dark about its current limitations [namely, based on what I've read in the forums, python scripting bugs]. How exactly does 's' fix python? Is it that 's' provides the functionality that the python scripting can't yet handle, or does it actually extend the python scripting's power by repairing any known issues/adding features? What sort of tasks is the python scripting still struggling with?

    Thanks all, and to Lucid- 's' looks amazing!! Keep up the great work

  • thanks cresco

    python currently ignores picking and just applies actions to the first object

    so if you had a condition

    on collision with Sprite2

    ----python : Sprite2.x =50

    it wouldn't apply to the sprite2 in the collision, it would apply to the first instance of sprite2, no matter what

    the upcoming (not yet released) version of S

    allows you to loop your python actions through every picked instance of an object

    thus fixing this problem of python

    the only other python issue I know of is that you can't use system actions

    this would be an easy fix, but more time consuming than I can manage at the moment

    finishing s is on the backburner for me right now, because my dayjob is unstable, and I need to get my game far enough along that if something happens with my job it isn't impossible to work on in short bursts

    however, due to all the python talk on the boards lately, I'm going to probably release the In Between Version I'm currently working with, that has the python fix, and just warn people about the other new (nonpython) features that aren't fully integrated

  • Ah interesting, interesting... Python sounds a lot less 'broken' than I've heard, especially with the inclusion of your fine work. I'm just getting started with Python (and thus haven't gotten into much Construct scripting yet) and I've been wondering-- how exactly does the Python language integrate with the Construct engine? Obviously there must be a special commandset to link the two; do you have any suggestions as to where I should look to learn Construct scripting [is there at least a reference of Construct-specific commands someplace]? How specialized is Python for Construct (would I be able to script effectively if I knew the canonical Python language and had a reference of any Construct-specialized commands/command structures)? Anyway, I hope everything stays well for you at work!

    Thanks very much

  • every action, expression, and condition has a python equivalent

    even for 3rd party plugins. it's built into the SDK to require a python command for everything

    the expressions are written the same way in construct or in python

    so if you can type sprite.angle in construct to get a sprite's angle, it will be the same in python.

    most actions and conditions have an obvious python equivalent, but if you're having trouble figuring it out, there is a way to look up the python commands for most plugins.

    it may seem a little complicated, but it isn't really

    first go to the construct SVN:

    http://construct.svn.sourceforge.net/svnroot/construct/Plugins/

    and find a plugin you'd like

    when you click on the plugin directory (in the SVN link above, not on your hard drive)

    there will be a bunch of files to choose from

    the only one you need is ACETABLE.cpp

    this file contains all the info construct uses to make the plugin's editor interface to actions conditions and expressions

    once again, this next part might seem intimidating, but there's only one tiny piece you need, I'm just pasting the whole thing here, so you can have an idea how it'll look in the file

    (they won't be highlighted on the SVN) :

    this is from the line plugin:

    29 ADDPARAM(PARAM_PRIVATEVARIABLE, "Private variable", "Select the private variable to test.");

    30 ADDPARAMCOMBO("Comparison", "Select the comparison to make.", "Equal to|Not equal to|Less than|Less or equal|Greater than|Greater or equal");

    31 ADDPARAM(PARAM_VALUE, "Value", "Value to compare to");

    32 ADDCND("*Compare a private variable", "Private variables", "%o %n: Value %0 %1 %2", &ExtObject::cValueCmp, "CompareValue", 0);

    see that last line? the second thing from the end, highlighted in green?

    CompareValue

    that's the python command. on the very left of this line after ADDCND, highlighted in red, is what you would click on in the construct condition list to add this condition, so to "Compare a private variable", you would you type CompareValue.

    one more example:

    78 ADDPARAM(PARAM_VALUE, "X", "X of line start to set.");

    79 ADDACT("Set start X", "Line", "Set start X to %0", &ExtObject::aSetStartX, "SetStartX", 0);

    second from the end is : SetStartX

    this is how you "Set start X"

    if you use your browser's find function, it is very simple to find whatever it is you clicked on in construct to get an action, and the corresponding python command

    hope this helps

    without the S fix, which I will try to release this weekend (remind me )

    you can still experiment with python, and get it up and running

    I have to leave to work now, but if you search the forums you can find the answers to the following:

    there is a certain version of python that must be installed on your system for python to work in construct

    have fun

  • This is REALLY useful advice for people going the python route. IMHO should be in the wiki.

  • Hey Lucid,

    I finally got around to messing with S again. I remember you said that the old examples didn't have the ACEs in the right order or something. For the life of me I can't figure out a simple example of adding an object into an array.

    http://www.box.net/shared/qqn6400180

    I tried to straight copy from your level editor example which doesn't crash. However, I get nothing but crashes when I run into the object to add to the array.

    Could you example why the current cap doesn't work as well as how to make the old .tt("blue" example work? Thanks!!

  • k

    there are two problems here first:

    <img src="http://dl.dropbox.com/u/1013446/spritefont/s1.PNG">

    you're creating an array called "" inside the nonexistant array {"level"}

    instead of creating an array called "level" inside of {""}

    even though it doesn't crash at this point, there is no array called level, so anytime you try to access it, it will crash

    the second problem is:

    <img src="http://dl.dropbox.com/u/1013446/spritefont/s2.PNG">

    you're trying to insert into an "object type" array

    the array "objs" you created was an object array

    this also causes a crash, because 's' is looking for an "object type" array called "objs" which doesn't exist

    I think this was a simple oversight, but if you need help with the differences between objects, and objecttypes, just post back, or check out the first post in this thread.

    I think now that you realize the mistake, you might not need any help with the tt thing, but post back if you do

    thanks for using S

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • scidave, your answer is in the previous post

    for anyone who read my longwinded explanation of how to find the python commands for a plugin.

    I just rerealized. you can just type 'objectname.' in the python script editor to get a list of every command and parameter

    much simpler

  • Lol, yeah that helps a lot Somebody should really add that tidbit to the wiki page about Construct python scripting...

  • lucid - Thanks, that did the trick! I now have the example working. I understand at least partially why the tt example wasn't working as well. However, still get crashes when I try to fix it. I haven't installed the old version to better see how they work so I won't blindly ask you to fix it. Hopefully I'll get some free time this weekend and figure this S thing out.

    One interesting thing I noticed is that you can no longer spawn another object with editable expressions like in your old example. The only way now is with a system create object by name action.

  • Hi Lucid,

    I'm trying to work again with S on this inventory thing. Here is the general idea.

    The player has X number of equipped item slots (3 in this case) and a large area where inventory items can be kept (bag or case). When the player goes around and touched an item it is added to the case. If the player then switches to inventory mode they will see all of the items they have touched in the bag. They then have the option to equip and unequip items. When they equip an item the icon for that item displays in the equipped slot.

    Of course, this could also relate back to the player. If they have certain items equipped then they could have those actually spawned with them (like a knife vs sword) or a magic spell.

    Ok, that is the main idea. I've attached a .cap with a really rough implementation that is just really bad and doesn't work well. It crashes unless I switch to inventory mode before having the player run over the item. I completely do not understand that crash. It also doesn't work if more than one item is in the family. I thought one of your example used just the object kinda like what I am doing here (even though the family is specified). I clearly do not understand S right now.

    Also, unrelated to S do you know a way to "pick object by name". For example, if the global var # of equipped is 0 I would like the equipped0 panel to display using something like (object name = "equipped&global("equipped").

    Here is the .cap:

    http://www.box.net/shared/g3sf71mjl2

    Thanks for any feedback.

  • Hi Lucid,

    I'm trying to work again with S on this inventory thing. Here is the general idea.

    The player has X number of equipped item slots (3 in this case) and a large area where inventory items can be kept (bag or case). When the player goes around and touched an item it is added to the case. If the player then switches to inventory mode they will see all of the items they have touched in the bag. They then have the option to equip and unequip items. When they equip an item the icon for that item displays in the equipped slot.

    Of course, this could also relate back to the player. If they have certain items equipped then they could have those actually spawned with them (like a knife vs sword) or a magic spell.

    Ok, that is the main idea. I've attached a .cap with a really rough implementation that is just really bad and doesn't work well. It crashes unless I switch to inventory mode before having the player run over the item. I completely do not understand that crash. It also doesn't work if more than one item is in the family. I thought one of your example used just the object kinda like what I am doing here (even though the family is specified). I clearly do not understand S right now.

    Also, unrelated to S do you know a way to "pick object by name". For example, if the global var # of equipped is 0 I would like the equipped0 panel to display using something like (object name = "equipped&global("equipped").

    Here is the .cap:

    http://www.box.net/shared/g3sf71mjl2

    Thanks for any feedback.

    sorry for the slow reply

    here:

    http://dl.dropbox.com/u/1013446/inv2.cap

    the most important thing to remember when dealing with objs and objtypes is to recognize and remember the differences

    it's definitely a little strange at first, because in construct you normally never have to think of the differences. The idea of S is to give you some of the same abilities you have when making a plugin in c++.

    so if you want to remember what "kind" of object, that's an object type

    you can create and object of an objecttype, or select objects of an objecttype, or even check if an object is of an objecttype

    if you want to remember an actual object, that's object

    objects are things on the screen, that can be moved around, destroyed, have behaviors on them, etc.

    when you put the objects in the array, then you destroyed the objects, the array was remembering objects that were no longer there. To avoid this, when destroying objects inside an array, use the delete object action. This allows you to destroy the object and delete it in one step

    for in an inventory, however, where you don't want the object on the screen, you just want to remember what type of object it is, that's an objecttype. please try the example, and let me know if you have any more questions.

    one of the things I hope to eventually add to 's' is a debugging feature, where instead of crashing, there can be an "on error" condition, and a "geterror" expression, so you can set a textbox to the error, and see why it's happening. should make it easier to learn, and to find mistakes. that's a little further down the line though.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)