'S' update as of 4/12/11

This forum is currently in read-only mode.
From the Asset Store
A post apocalyptic music pack with 12 main themes and 12 in-game loops
  • > 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.

    just give the plugin the option to set the index base. 1 or 0. both parties satisfied. problem solved.

  • Either way is fine, as long as it is clearly stated which indexing is used, to avoid confusion.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • <img src="http://dl.getdropbox.com/u/666516/super.png">

  • 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.

  • This seems super useful - can't wait til you release a first version to dabble with.

  • Very useful stuff, Lucid!

  • 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

  • thanks for this.

    I get a runtime error when clicking in the last .cap and it closes?

  • thanks for this.

    I get a runtime error when clicking in the last .cap and it closes?

    sorry, change the loopname on createtext to numloop instead of nummy

    I changed the names at the last minute, and forgot to change it there...also, you can just redownload the cap at the same link, I fixed it

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

    ok, for this tutorial you will need to redownload the plugin, if you downloaded it before this tutorial was up.

    This is a simple objecttype tutorial, to introduce objecttype arrays.

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

    in this little game thing, you have a default green thing as your attack (space bar)

    as you pick up items they are put in a queue, and each time you press space you use the first item in the queue, when you run out of special items, you fire your default again.

    at the beginning you see I deactivated bullet movement...this was just so the objects would sit there until you picked them up.

    on collision with blue I inserted tt("blue") into the array

    tt stands for true type, you can of course choose a normal type, or a family to be added to the array. In this case, we don't want the type "blue" inserted into the array, we want the "true type" of the object, not the family type. this expression only works if there is an actual object, because of course there is no true type for the family itself.

    so we insert the type at the "end"

    and destroy the "blue" object

    on "space bar" pressed

    spawn the type at {"types"} (which is {"types",0})

    and delete that entry in "types"

    try out the cap, and try to understand the events.

    now we are going to change it a little bit

    we want to make lightning the new basic weapon, if we pick that up.

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

    on collision with "blue"

    we use a condition from s

    "is of object type"

    we check if "blue" is of the lightning type. in this condition, you can also type in an arrayaddress for an object type or even the array address of an object using the o expression o({"objectarrayaddress"})

    if it is of lightning type, we use the "new default value for array" action to make lightning the new default, and then we destroy the object we picked up

    else, if it is not lightning type, we add it to the array the same as in the previous version

    The next topic will be object arrays, then super arrays. then we will start to see full examples of complex projects, like inventory systems, and level editors, and we will see how s works to make these types of projects simple, and with few events.

  • this is great so far, you seem to make it easy to understand.

  • thank you, alspal, i edited it after you posted your first post, did you see I responded to your question about the crashed cap?

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

    things are about start coming together, the next tutorial I have planned is on object arrays, as opposed to objecttype arrays. This post is not the full tutorial. It is a description of the problem we are going to solve with object arrays, and the example cap to do so. You may be able to figure most or all of it even without the tutorial.

    so here's the problem.

    create a weapon for an overhead shooter. You can left click on enemy ships to make them targets. Click the right mouse button to fire out drone missiles. The drone missiles should attack the targets one by one in the order you clicked them. if you fire more than one missile at a time, the missiles should take over the next target in line. No two missiles should ever attack the same target at the same time. After all targets are either destroyed, or currently being pursued by another drone missile, the drone missile should return to the mothership.

    This can be accomplished in relatively few events, using s.

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

    there's the cap, tutorial coming soon

    have fun

    a note on crashes: if you click the same target twice you can make it crash. These are not random stability problems, I understand where the crash is coming from. I am working on ideal solution that will both maintain the power s and usability . The default system is the solution to the problem of trying to access values outside the array. This used to cause a crash, but I didn't want to return a meaningless value either. It turned out to be useful in another ways. The following problems also require solutions that both prevent the crash, but also make it obvious where something is going wrong, instead of just being a silent bug in your code. In the meantime, there are a few things that make s crash that can be avoided if you are aware of them. 1. typos. misspelling a name, forgetting an element to an address, or doing "this" instead of {"this"} 2. destroying an object, and then trying to do something with an object variable that pointed to it. 3. destroying an array, and then trying to access it. please report any other crashes also, everywhere you're expected to type an array address should begin like this {""} so the brackets are already there when you start, this goes the same for expressions. Please let me know if you discover them missing anywhere. Also, anywhere you can type in an object address, you should be able to use the name "in quotes" of any picked object. Please let me know if you discover anywhere this does not work. thanks everyone who's helping me test this.

  • Just tested out the the three .caps. I was getting lots of crashes, but I guess I had an old version. I re-downloaded today and they work great. These examples are cool. The .caps aren't complex either... I'll have to spend some time studying them though. I've really been wanting to make a few simple things with this plugin.. but just been so busy.

    Anyway, nice work on the plugin and tutorials!

  • Is there and way to delete a container minimum and maximum value not just the value at the end of the container.

  • Is there and way to delete a container minimum and maximum value not just the value at the end of the container.

    yes, "end" is the last element in the array, you can also use any numerical index,0 being the firfst in the array. and i havent tested it much yet, but you can also specify a range of values as (min, max), such as (1,"end"), or (2,3), howver you must use the curly brackets, but my phone doesnt let me type those

  • > Is there and way to delete a container minimum and maximum value not just the value at the end of the container.

    >

    yes, "end" is the last element in the array, you can also use any ,0 being the firfst in the array. and i havent tested it much yet, but you can also specify a range of values as (min, max), such as (1,"end"), or (2,3), howver you must use the curly brackets, but my phone doesnt let me type those

    It dose not work.

    It just delete the first numerical index now,

    I need it to delete the index with the smallest value.

    I need for example:

    array {"1"}

    Index = Value

    Index 0= 282

    index 1= 438

    index 2= 10

    index 3= 169

    index 4= 1000

    Index 0 through 4 has there value.

    The index with the smallest value is deleted.

    That would be index 2.

    Then the next and the next,etc.

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