lucid's Forum Posts

  • click here to download latest version (10/14)

    <img src="http://dl.getdropbox.com/u/1013446/s/s.png">

    ok, I apologize for the delay, but there is a silver lining. The superstructure portion of the plugin for download above is much closer to complete.

    We are going to have a different type of tutorial today, that will be a crash course in everything s over a wide array (get it?) of ideas and syntax. I won't be walking through every detail, but there should be enough information to get you on your way. Anything anyone needs help on, or can't get to work properly, we'll delve more deeply into those areas in the tutorials that follow.

    OK, so this tutorial assumes you've read, and understand, the first two tutorials.

    We've created string arrays, and added values, and deleted values.

    Number arrays are used in the same ways, and we will be looking at primarily numerical examples as we complete the remainder of the basic array features. The examples in this tutorial require features from the new version of the plugin linked above.

    First we will learn 2 new math expressions included in s

    Get T

    abbreviated t(min,max,amount)

    this will generate a value between 0 and 1 that represents the ratio between min and max that amount is.

    it would return 0 if amount was equal to min,

    1 if amount was equal to max. and 0.5 if amount was halfway between the two.

    this t value has many uses.

    here's a simple example

    First we will see an example of an energy bar that shows how far across the screen we are

    http://dl.getdropbox.com/u/1013446/s/energybar.cap

    the t value is also the value t in many equations, such as interpolating functions, and trigonometric functions. (ie. lerp and cosine)

    there is a special version of this lt, short for loop t, we will use later in this tutorial

    another math expression in s is

    ranged seeded random.

    the expression is s.rand(min,max) and returns a random number between min and max

    there is an action to Seed Random

    if you will need to repeat the exact same sequence of random numbers again

    seed the random with a known value (this can be a random number that you save in a variable for later use)

    after seeding once you generate random numbers as normal

    if you needed the randomness to reset you could reseed the random with the numbervariable you created. this will start the same exact random sequence you had the first time. you can do things like generate the same random starfield each time a game loads up, or have a rewinded scene generate the same randomized values for ai decisions, or in a custom particle generator.

    Next we will move onto one feature of arrays we didn't cover in the last lesson. the 'last element expression'

    you will find it as Number Array size -1, String Array Size -1, etc when you double click s for the expression list

    These expressions return the index of the last element in an array, Since s is 0 indexed, this is the array size-1

    the expressions are:

    ole({"object array address"}) index of last element in an object array

    otle({"objecttype array address"}) index of last element in an objecttype array

    sle({"string array address"}) index of last element in an string array

    nle({"number array address"}) index of last element in an number array

    sule({"super array address"}) index of last element in an super array

    now that we've covered the basic expressions for arrays,

    let's move on to actions and conditions.

    First the other basic actions we haven't learned yet that apply to every type of array.

    One of them is rotate array. This will shift every member of the array the specified amount of times forward or backward, and have anything that shifts off the end of the array wraparound to the other side, for instance:

    A B C D

    if you rotated this 1 it would become

    D A B C

    if you rotated ABCD -1 it would become

    BCDA

    swap array values swaps two values with eachother

    given ABCD, if you were to swap 0 and 3, you would get:

    DBCA

    Delete Array destroys the entire named array, you cannot add to the array again, because it no longer exists

    Clear Array deletes all the elements in an array, but not the array itself.

    Now onto conditions,

    Is Contained in allows you to specify a value. if that value is in any of the elements of the array, the condition is true,

    now, we are moving onto the For Each conditions

    These are similar to other For Each conditions in construct. They loop once for each elements in the specified array.

    There are a few important things to know unique to S's for each conditions.

    The first is, these are named loops, and you can nest them within eachother.

    you can use the name of the loop for several things

    you can do

    lle("loopname")

    loop last element

    this gives you the largest index the loop will loop to. It is the size - 1 of the array the loop is looping through

    li("loopname")

    loop index, this gives you the current index in the loop

    also when addressing something from the loop, you can use a special key character "l" to automatically specify the array the loop refers to. for instance

    loopname: "myloop" For Each Number in {"this","that","number"}

    if you wanted to get the number contained at the 0 index of "number" while in the loop, instead of:

    n({"this","that","number",0})

    you could just write n({"l","myloop"})

    we haven't worked with addresses longer than one word, but this will come in handy as you construct larger and more complex structures. Also, these work recursively, you can specify the array to loop through using the {"l","loopname"} notation.

    here is an example of a simple app that uses the ranged random function, and loop t function (s.lt("loopname") - this is the equivalent of t(0,lle("loopname"),li("loopname")), basically a t value for the progress of the current loop)

    this example also uses the rotate array action, you can toggle that off, and try the swap array function as well

    to use this cap simply press the left mouse button to add extra random numbesr to the array.

    right mouse button rotates the array.

    http://dl.getdropbox.com/u/1013446/s/randrotgetloopt.cap

    sorry for the delay in tutorials. I'm beginning work on the object and objecttype array tutorials, and that's where you'll start to see some of the real power of s

    after that will be the super tutorial, and at that point you will have enough information to use 's's superstructure functionality to the fullest, and I will move on to complete the rest of the plugin

  • understandable

    and do you mean earlier versions of spritefont, or earlier versions of construct?

  • i couldn't get passed the first level

  • it shouldnt be too slow konjak, i think the main time event slowness as compared to plugin speed matters is when youre doing hundreds or thousands of events per tick. i think the array problem youre having might be fixed by using a different type of container, such as those provided in the new s plugin. also, if you plan on making an event based text writer, the s plugin may be useful for that as well. however, other than the issues with the arrays, what other features are missing, that i might add to a future version. what form of control? i still havent documented this plug, so its possible its actually already in there

  • k, turns out tutorials take longer to write than software

    I'm working feverishly to get a complete crash course on the rest of the current feature set

    also, since the last post, I've completed most of the superstructure portion of the plug

    you will be learning on a much more streamlined version than had I released the tuts a few days ago

    bear with me. There's some really good stuff coming your way.

  • I think that the construct ui is built using that library, not the games and apps you produce with construct

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • could you post or pm me a cap, or a screenshot of the cap, konjak and cyvix?

  • Also, is there no way in Flash to use the RMB in a different way or disable it? It just seems lame that I buy a full game, press the RMB and that flash menu pops up. A content creation program should never put itself into the foreground like that while you're actually playing a game or running an app or watching an animation or whatever.

    I've always thought that as well

    why would you impose such a huge limit as deciding that "settings" and "about" are more important than anything someone might want to do with the right mouse button

  • it's a bug

    I submitted it a few weeks ago

  • theres another way in the newer versions

    just set the object to movable or unmovable and back again

  • next tutorial delayed slightly, I was late to work today after oversleeping from last nights late night tut writing, so I need to get some z's tonight. trust me though, these tuts will be a regular thing until everything is covered. gnight

    z

    z

    z

    z

    z

    z

    z

    z

    z

    z

    z

    z

    -_-

  • for those just tuning in, the second tutorial and the plugin download are at the bottom of the first page.

    You are using 0-indexing? I believe that Construct is trying to streamline 1-indexing.

    this plugin, as someone pointed out earlier in the thread introduce object oriented design possibilities to construct, especially when combined with the function object, which we will explore in later lessons. because of this, i believe this plugin will be useful to people with a programming background. given how central indexing and looping are to the plugins use, i thinkk 1 indexing would be hindering and inconveiencing many of those users. also, personally, i hope it is changed to 0 indexing in construct 2. i was supportive of unifying the indexes to a single standard, and also of providing a more welcoming methodology to nonprogrammers, but in retrospect, it may have been better to simply explain in a single sentence to those foreign to 0 indexing that counting starts at 0 instead of 1. also, when working mathematically with array indexes, 0 indexing fits perfectly into most computational situations, for instance, i was to arrange several sprites in a row, starting at x value 400, spaced 100 pixels apart, i could simply say each sprites x value is 400+(100*loopindex). there are countless situations simple and complex that work out that way. also this plugin can be used for dynamic and logical vertex control, and mesh distortion coordinates are 0 indexed. in short, conforming to the current standard in construct would force the end user to type -1 all the time. besides.., it was going to be nearly impossible to find the 1 spot where i forgot to put +1 in the c++ code when some seemingly random glitch came around.

  • thanks for all the kind words and encouragement, everyone.

    I will eventually consolidate and clean up all these tutorials into a single pdf help file.

    I don't have as much time as I originally intended to write tutorials today, however, I did have a chance to share the alpha with a few people in chat and get initial impressions on what was most confusing, and what things needed special emphasis. Today's tutorial will be extremely basic. Basically a "hello world" program, and I will try to release at least one tutorial a day. Please feel free to ask questions, especially about "why isn't this working", and I will do my best to answer them throughout the day, and perhaps integrate any remaining questions in the next days tutorial.

    keep in mind this plugin is in the alpha stage. Though I will follow basic steps to allow backward compatibility with previous versions, s will be updated on a sometimes daily basis, and advancing development will take priority over maintaining compatibility with caps created with alpha versions. Please do not begin any major projects that require this plugin until a non alpha/beta release.

    <img src="http://dl.getdropbox.com/u/1013446/s/s.png">

    first. download s:

    click here to start download

    extract the rar into your construct folder.

    • Start a new project, and add one text object, and the s object.
    • Add an At Start of Layout condition.
    • With s, add an Add Array action <img src="http://dl.getdropbox.com/u/1013446/s/helloworld.PNG">
    • For the name of the array choose "words".
    • Skip over within which super for now (leave it as {""}
    • For the type choose String
    • For the default, choose "default!!!" or anything else you're happy with
    • The last option is only relevant when creating super arrays. we will come back to this in a later lesson.

    You have now created an empty string container named "words" with a default value of "default!!!" (or whatever you chose as your default)

    • Make a Set Text Event with your text object, and double click the s object to get a list of expressions. choose Get String
    • Set Text to s.s({"words"}) do not omit the curly brackets {}, this is the number one cause of crashes amongst both myself and the test group earlier today. s.s({"words"}), not s.s("words"). <img src="http://dl.getdropbox.com/u/1013446/s/hello.PNG">
    • Run your cap

    if all went well your text should be set to the default value you chose, since your string has not been set to anything yet.

    now let's take a look at the expression first we have s.s

    every expression in s is abbreviated to as few letters as possible

    to retrieve a value of each of the types the expressions are:

    • s for a string value
    • n for a numeric value
    • o for an object variable's type
    • ot for an objecttype variable

    fairly straightforward to remember, and you can always double click the object if you forget.

    inside the Get String expression you had {"words"}

    in the last lesson we saw several examples of addresses.

    this is a simple address, and fairly straightforward.

    we will reexplore the syntax of addresses in greater detail in later lessons

    for now, lets change our cap a little and make it a true hello world example.

    between the action to create the string array, and before you set the text

    • add an action with s to Add/Overwrite String in Array
    • for the String to Add, choose a string. Try "hello world!"
    • for Within which Array choose {"words"}. and don't forget the curly brackets!
    • for How To Add Choose Insert
    • Add/Overwrite where can be left as "end"

    Now run cap again.

    you should now see that ever so satisfying "hello world!" message.

    This means your string container is not empty anymore.

    it contains a single string value. Remember though that all containers can hold more than one value if necessary.

    return to your cap, and copy/paste the Add/Overwrite String in Array action so you have 2 of them in a row

    in the second one however, change the message to "Goodbye World!"

    you now have two values in your "words" array

    if you run your cap again, it should be no different than the first time.

    you will get the value stored at 0 in your array

    when you do not specify an index in your address ( {"words"} ):

    0 is assumed

    you could achieve the same result by changing it to {"words",0}

    if you would like to access your goodbye message

    set the text to {"words",1}.

    try this and run the cap again.

    try changing it to {"words",5} and running the cap again

    unless you added extra strings yourself, you should get the default value.

    any time you try to access an array location that is higher than the size of the array, you will get the default value.

    I will introduce briefly some related concepts before closing today's lesson.

    The first is the difference between overwrite, and insert.

    overwrite does just that, it overwrites the current value at the index specified

    insert adds the specified value, and if there is another value already at that index, the old value is pushed forward

    so if you had two string values in {"words"}:

      0

      " beginning"

      1

      "ending"

    and you overwrote index 1 in ({"words"}) with the string "middle"

    you would still have two string values, but the second would be overwritten with the new value:

      0

      "beginning"

      1

      "middle"

    and you inserted at index 1 ({"words"}) with "middle"

    you would now have:

      0

      "beginning"

      1

      "middle"

      2

      "ending"

    if you would like to try these in your cap, change the last value in the Add/Overwrite String in Array action from "end" to the numerical index you'd like

    when attempting overwriting or inserting at a location higher than the highest index of the array, the array will increase in size, and any intermediate spaces will be filled with the default value, so if your default string was "nothing to see here" and you started with the array:

      0

      "beginning"

      1

      "ending"

    and you inserted the value "way up there" at index 7 in {"words"}, you would end up with

      0

      "beginning"

      1

      "ending"

      2

      "nothing to see here"

      3

      "nothing to see here"

      4

      "nothing to see here"

      5

      "nothing to see here"

      6

      "nothing to see here"

      7

      "way up there"

    The last item for today is the "end" string value for the index you saw in the Add/Overwrite String in Array action

    open your cap, and double click one of those actions.

    the last setting in this action is Add/Overwrite where

    it is defaulted to "end". This is the only valid string to insert here. normally you put numerical index values here. "end" is a convenient way of specifying the end of an array without having to retrieve it's size. if you choose to insert at "end", the item will be inserted after the last value in the array, if you overwrite at "end" the item will overwrite the last value in the array.

    please feel free to experiment, especially repeating some of this lesson with numbers instead of strings. if you experiment too much you're bound to crash the plugin. it is not unstable, but as you can see thus far, it has a very specific syntax. please ask any questions you have. and stay tuned. After we get through the basics, we will begin to explore some of the things you can do with s, and the new level of power and organization it brings to construct.

  • Hello fellow scirra members.

    I am preparing for the alpha release of the 'S' plugin.

    The purpose of this thread will be to explain what the S plugin actually is, and to serve as an on-going tutorial. The exact order of the tutorials hasn't been decided, so feel free to weigh in on what needs teaching, and I will try to plan out the next tutorial based on demand. This first tutorial will primarily explain the theory and purpose of S, and only briefly introduce some of the syntax. Future tutorials will give more concrete examples, and eventually walk through the creation of more complex projects. The plugin itself will not be released until the 2nd or 3rd tutorial, as it essentially useless without some background information.

    For starters though, we will look into what the S plugin is, and what it can be used for.

    click here to download the previous version of s (until I update the tutorials, use this for the everything before the level editor tutorial)

    click here to get the newest version, use this for the level editor on. I know this is messy. I will update the earlier tutorials when I get a chance

    extract the rar into your construct folder.

    <img src="http://dl.getdropbox.com/u/1013446/s/s.png">

    This symbol will be at the beginning of each tutorial in this thread so you can easily find them and go back to them.

    S stands for superstructure, or systemplus. it is shortened to 's' to require the minimum amount of typing when invoking expressions. also, s happens to be the first letter in two of it's major functions.

    We will first go over what a superstructure is.

    A superstructure is a named container which can contain named arrays of 5 different types of data. Strings, Numbers, Objects, Object Types, and other superstructures.

    <img src="http://dl.getdropbox.com/u/1013446/s/basictypes.png">

    in s you can create variables of any of the following types:

    • strings - store text, like names of characters or items, players, or dialogue.
    • numbers - store floating point or integer values, like hitpoints, or x and y positions
    • objects - store references to construct objects. a construct object would be like the player sprite in your game, or a text object on the top of the screen that displays the current score. You can use these references to gather information from objects, and to control objects. For instance, you can find out the x and y coordinate of an object, or pick an object so you can change it's position. This is only a reference, however, not the object itself, so more than one object variable can refer to the same object, and destroying an object variable or reassigning it to another object doesn't affect the object itself.
    • objecttypes - stores a reference to construct object types. while an object variable refers to an actual object, the object type variable refers to the type of an object as distinct from an actual instance of that object. If you destroy a sprite at start of layout, even though there are no sprites you can create an object of type sprite. You can check if there were any collisions with an object of type sprite, even if there on are sprites on your layout. ObjectType variables can be used anyway you'd normally use a dropdown box to select a type in construct, like creating a new object, or checking for collisions.

    with s you can create any number of named variables of any of these types. such as a number called "hitpoints", or a string called "name", an object reference called "currenttarget", or an objecttype reference called "enemyspecies"

    remember that these are all variables, so any value, including the object and objecttype variables can be changed at any time.

    most of us our familiar with the idea of a string or number variable and their various uses. So let's explore the possible uses of objects and objecttypes.

    I will only give one possible scenario for each for now, but their possible uses are as diverse as strings and numbers, if not more so. One could create a "currenttarget" object variable that could be used to store the current target for an ai enemy for instance. the enemy could be made to chase this object, you could pick this particular object and check for collisions, you could change targets arbitrarily, or you could recall this object at any time, even if it is not in any particular pickable situation.

    one example of a usage for an objtype variable is to store the type of a currently equipped throwable weapon.

    one could make an objecttype variable "throwweapon"

    when it was time to throw a grenade, a boomerang, a bomb, or a knife, you could use the same code to Create New Object, and just insert the variable type in place of a particular type. it wouldn't matter if they were all of the same type (like a sprite, or an xaudio2 object, or what behaviors they had applied to them, etc. You could use one single action to spawn whichever type was stored in an objecttype variable

    there are many other scenarios where these new types of variable could be useful, but we'll move on to specific application after we've covered all of the basics.

    next we will explore the concept of arrays:

    in s, when you create a single variable, you are actually creating a container for that variable type.

    The container consists of a name, a default value, the variable itself. for instance:

    <img src="http://dl.getdropbox.com/u/1013446/s/singlestring.png">

    so here we have a string container called "username" with a default value of "player", and the actual string value stored in the variable. However, each named container in 's' can contain any number of values referenced by numerical index:

    <img src="http://dl.getdropbox.com/u/1013446/s/stringarray.png">

    they can be accessed and treated as single values. if you specify no index, the first value is accessed. if you try to access an index greater than the size of the array, the default value is returned. Also if try to set the 30th value of your array, without having 1 through 29 added yet, 1 through 29 will be created and set to the default. Remember, it is perfectly acceptable to create a string container to hold a single value. the concept of an array only comes in if you need that container to hold more than one value.

    You can create arrays of strings, numbers, objects, objecttypes, and supers.

    Now to explain the super, or superstructure.

    a superstructure is a data structure that can hold any number of any of these named array containers, including named containers for arrays of supers:

    <img src="http://dl.getdropbox.com/u/1013446/s/super.png">

    a super is designed to as a completely customizable conceptual object. You can organize data an objects in a meaningful way. The entire collection of containers and data structures you create is actually contained in one 'master' super.

    for example:

    one my conceive of something called a "party"(a super), which has a "name" (string), a "rating" (number), and contains an array of "party members" (array of supers). Each "party member" has "hitpoints"(number), a "name"(string), an "inventory"(array of object types),"armor"(super), and a "weapon"(super). Each "weapon" consists of "strength"(number), "name"(string),and a "sprite"(object).

    S uses a special array notation to navigate and access your structures

    it is necessary to understand this notation before moving on to actions, and expressions

    {""}[/code:17pu5r54]
    this is an empty address
    
    [code:17pu5r54]{"party"}[/code:17pu5r54]
    the address of the "party" super in the above example
    
    [code:17pu5r54]{"party","name"}[/code:17pu5r54]
    the address of the "name" string of the "party"
    
    [code:17pu5r54]{"party","party member"}[/code:17pu5r54]
    the address of the first "party member" in "party"
    
    [code:17pu5r54]{"party","party member",0}[/code:17pu5r54]
    this statement is equivalent to the statement above, any time you include a number in the array it refers to the index of the previous address component.  This is a 0 index, so it begins on 0 instead of 1.  0 is assumed if an index is not provided, in this way, you can address singular variables the same as arrays (remember single variables are just arrays that contain only one member)
    
    [code:17pu5r54]{"party","party member",3,"inventory",5}[/code:17pu5r54]
    would refer to the 5th item in the "inventory" of the 3rd "party member" in "party"
    
    In the next lesson, we will see an simple CAP example of how superstructures, and other arrays can be created and accessed.  I will also release the plugin itself.   Unfortunately I'm out of time for today, but tomorrow I will go over several examples of the applications of the superstructure system.  Once the basic syntax and workflow are understood, it will be possible to easily create projects that would once have been extremely convoluted, and difficult to organize with traditional events and picking.  A few simple examples would be the creation of a 3d object editor, or an AI that can prioritize tasks and targets.
    
    I hope you all will forgive me for the mostly theoretical post.  I had anticipated getting far enough to actually release the plugin itself. Unfortunately, I've run out of time and I must get to bed soon.  Please bear with me long enough to see what this thing can do 
    see you tomorrow
  • >

    > so will that picking thing be any good for families with containers?

    >

    >

    It means you won't really need families or containers. You can pick however you want. It kinda makes the pairer plugin obsolete.

    what davio said,

    if you wished, you could create structures with container and family like functionality at runtime, but with full control over how picking, creation, and destruction are handled. you could also arbritraily change the members.