'S' update as of 4/12/11

This forum is currently in read-only mode.
  • Thanks for the help!

    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.

    This would be a HUGE help. I keep wanting to look at the S object in the debugger to see what is being populated. Any extra bit of debug info would really help in understanding S. This plugin is so incredibly powerful!

  • Hey lucid, the code I posted for you yesterday didn't work So I rigged the same situation in a cap as an example so hopefully you or someone can notice what I did wrong!

    http://kayin.pyoko.org/saveexample.cap

    This is sort of a proto example of a save file format for my next game. Save stores all info and then there are superarrays within save, such as general. General keeps track of a few number arrays like x and y position, game time and deaths. General would have an index between 1 and 4 for each saved game.so {"save", "general", 1, "x"} would give the x value in generals saved game 1 slot.

    In this example, I keep save and general and only work with x.

    1 saves, 2 restores. Q and W add and subtract from the save slot. Text on the right tells you what save slot it's on, text on the left gives the x value in general 0 through 3.

    When you press to save, ALL VALUES get set to your position, which is clearly wrong. Lucid said my code looked fine when I gave him a screenshot of it, but clearly something is up!

    Any help will be appreciated, I've tried a million different things and 999,000 of them crash S.

  • I'm too lazy/busy at the moment to update all the links

    this is the latest version of 's'

    http://dl.dropbox.com/u/1013446/s/sdebug/s.rar

    there are some more added features and bugfixes I won't document at this time

    if you have any questions how to use something new though, please ask, although you may have noticed my answers are getting slower due to my current development/time management situation.

    anywho, the particular reason for making this current update public are the new debugging features.

    3 new actions:

    • set debug text output path.
    • set/add debug text.
    • clear debug text.

    set debug text output path, sets the output path and filename of the debug log. you can set whether or not you want the file to automatically launch the debug file when an error occurs, if you set this to "yes", and your file is a text file, such as "c:\users\you\desktop\debug.txt", this will load the debug file in notepad as the error occurs

    set/add debug text, let's you set your own text to go in the debug file, there is an option to either set the text, which clears all text, and sets it to the string you choose, or append, which will keep the current text, and add the string you choose to it. This is very useful for determining where an error occurs. For instance

    -**Start of Layout**
    ---SET Debug Text to "Start of Layout"
    ---Do whatever
    
    -**On Left Mouse Clicked**
    ---SET Debug Text "Left Mouse Clicked"
    ---Do something
    ---**Mouse is Over Sprite**[/code:3345ha65]
    ------APPEND Debug Text "Mouse over sprite"

    ------Do something else

    if a crash occurs now it is easy to determine in the log where the crash occurs

    Clear Debug Text simply clears the debug text, you usually will not need this, since Set Debug Text will clear it for you.

    's' is extremely stable, and doesn't crash unless there is a user created error. even if I added code to prevent the crashes, it would still mean that you would not achieve the desired result you were looking for, and would require a massive rewrite that would probably reduce the efficiency of the current code.

    as of now the debug does not log errors that are related to trying to access an object that has been destroyed.

    using these new features today, probably saved me a few weeks work from what it would have taken without the new debugging features...

    finally, kayin, sorry for the late reply, I'll take a look at that now

  • those looking for info on the new debugging feature check out the post just before this one

    Kayin:

    k, first problem, is in Start Of Layout, you added "x" to {"save","general"}

    but you never created the super array "general"

    for the remainder of the cap you're doing {"save","general",global('slot'),"x"}

    this will work if you add multiple "general" supers, and you want to access each one

    which now that I think about it is probably what you wanted to do, however,

    in the update to your example posted below, I have one "general" super, with many possible numbers in the "x" array:

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

    read up on super templates if you want to use default supers, they work a little different than everything else, and caps should be planned accordingly.

    btw, just for general info's sake, when you attempt to add an array to a super that doesn't exist, it adds it to {""}, I haven't tested it yet, but I believe this error will be caught by the new debugging features.

  • This doesn't work either. While it doesn't write to all positions at once, this time it won't write to any position outside 0.

    Even if I hardcode in a slot number. I ever cut down everything to a single number array in an attempt to write to a particular index. It was a failure. This really seems like something is broken.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • my bad brother

    I didn't even realize you were able to change slot numbers with q, so I had it always overwrite on the first slot...this works:

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

    also, when adding stuff to an array you don't specify the index in the array address, I wasn't paying attention when I did that, you specify the index under "where"

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

  • Are you infringing on my Red Lines And Text On A Screenshot trademark? You'll be hearing from my lawyer.

  • Hahah, thanks. You are the man, lucid.

  • Just a quick question is there a way to save the Layout number/name so that when you load the save file from one layout and sets the players position in different layout like for instance the player saves their game on the 5th layout and exits the game then 3 minutes later they decide to continue where they left off so they load the game and at the title screen on layout 1 they load that very same save file and they are placed on the very same layout same player position aswell. Is this possible to do this? The only possible I got was this but only saves the players position if they are in the same layout section but when you try to load the save file it wont put you on the same layout number only the coordinates:

  • hi Kinila,

    welcome to scirra. let me start by saying the 's' plugin is one of the more difficult things to use in Construct, and if used incorrectly, can cause crashes. Not trying to discourage you from using it, but in general, Construct is more intuitive and user friendly, so to make like easier, make sure Construct can't do it without 's' first, as it will probably be easier to do and more readable. Also, I've never used the built in save features on Construct. There very well may be a much simpler ways to do this, so if no one else replies here, you might try posting it as a general question in the help section.

    But, back to your question

    if you made a number array called, "layoutnumber", and a string array called "layoutname"

    this would work:

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

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

    you can name the arrays whatever you want,

    but if you use layoutnumber wherever would normally use a number or equation, it will replace layoutnumber with the actual numerical value at runtime, and likewise with the layoutname wherever you can input text

    so if you were on layout one and

    set global('example') to layoutnumber + 4

    global('example') would equal 5

    or you could

    Set Text to "hi, the name of this layout is " + layoutname

    to have the name at the end of the sentence

    these are System Expressions, and you get a list to choose from if you doubleclick the system icon while setting the parameters in any new action, condition, or expression

  • Hi Lucid, the 's' plugin does have some difficulty but I am not affraid to move on from basic to more advance features and like to learn these experiences. All of which you explained made sense to me but when It came down to this:

    [quote:2bjj7ar2]

    so if you were on layout one and

    set global('example') to layoutnumber + 4

    global('example') would equal 5

    wouldn't that set the global from layout 1 to a number equal to layout 5? how would a variable of this load the save file to set the player from layout 1 to where he saved his game?

    I am not even sure if I made a example good enough but here is another screenshot with those layoutname/number in the code with a example.

    Sorry if I am not getting what you said just started using Construct 2 days ago.

    Also the Event Sheets as you see there are about 9 of them. Reason for this is that it makes it easyer to recreate a fresh more organized Layout event sheets that has a linked and similar setup for the player, saveing, moving, death etc and if theres a glitch or bug in those variables it makes it similar fixing the glitch in the game if I edit 1 linked event sheet instead of multiple ones.

    But later on for the save feature for the title screen event sheet ill set it so that if player shoots (or clicks) a sprite it loads game file 1 or 2 depending on how this game goes in the future.

    Kinila

    (Naiakoa the Time Lost Gamer)

  • Hi,

    How do you save private variables for sprites that are part of the family?

    I'm creating a sprite formation editor that will eventually hold PV�s to determine the behaviour of any sprite after loading data from external files at runtime. This will save me masses amount of time.

    I�m having a hard time trying to save and load PV�s with the associated object array. Much like the level editor it will save/load XY positions. Trying to save various PV�s into number and string arrays but don�t know how to reassign them to indexed sprites. Sprites will have differing variable values and don't want to assign all the objects the same value...unless there�s another way I�ve completely over looked about how to approach this?

    Thanks for any ideas

  • Never mind on my other post I just got what I was looking for. What you posted lucid did help with the saving the layout number/name but you left out what one thing that I just figured out. For you to actually load the layout properly without errors is to set the event:

    <img src="http://i236.photobucket.com/albums/ff2/naiakoaa/savingload.png">

    thanks for the saving solution just took me a while to get the loading correct

    Edit: ok...it saves and loads layout but only one problem if there is another save point once saved then reenter the game it does load the layout but not the coordinates this might take a while to figure out why....

    Edit: ok im an ideot lmao i figured it out again and works lol upon the title screen i added a ContinueGame button and the variable for that is:

    <img src="http://i236.photobucket.com/albums/ff2/naiakoaa/titlescreenproperties.png">

    Then set 2 new global variables:

    <img src="http://i236.photobucket.com/albums/ff2/naiakoaa/globalvariablessavefeature.png">

    then on the seperate event sheat named save function for my game i set the foolowing:

    <img src="http://i236.photobucket.com/albums/ff2/naiakoaa/savefunctionsetup.png">

    Now for a small explaination of what i did When player plays the game and save shooting the save box it saves their layoutnumber and name X and Y coordinates into a file named save.sav at the same location the game is ran. when the player exits their game totake a break the game stays saved and when they return to the game they click the button at the title screen labled Continue Game immediatly when they click that the save file sets the coordinates in the global varialbes and then loads the layout number of where they left off at. Now since my game has multiple save points the player needs to be positioned where exactly they saved at this is where the global values come from Immediatly when they load layout the game checks the global values if it has numbers in it greater than 0 the player is set to those coordinates and then sets it back to 0 there was a loop in this so the Trigger Once feature fixed that.

    If anyone knows a much easyer and bit more organized way to set this up just let me know im up for suggestions

    Kinila

    (Naiakoa the Time Lost Gamer)

  • sorry kinila, forgot to check back to this post, but glad you figured it all out

    Hi,

    How do you save private variables for sprites that are part of the family?

    I'm creating a sprite formation editor that will eventually hold PV?s to determine the behaviour of any sprite after loading data from external files at runtime. This will save me masses amount of time.

    I?m having a hard time trying to save and load PV?s with the associated object array. Much like the level editor it will save/load XY positions. Trying to save various PV?s into number and string arrays but don?t know how to reassign them to indexed sprites. Sprites will have differing variable values and don't want to assign all the objects the same value...unless there?s another way I?ve completely over looked about how to approach this?

    Thanks for any ideas

    for each object in array (pick current)
       add your pv to the "end" of your private variable array
    
    upon loading all sprites to new instances
    for each string (or number) in your private variable array (let's say this loop is called "myloop")
    -----pick {"yourobjectarray",.li("myloop")} as yourFamily  
    -----set yourFamily's PV to .n({"yourprivatevariablearray",.li("myloop")})[/code:1n872g00]
    that should assign each sprite with the original private variable it had, regardless of what type of sprite as long as it was a member of yourFamily
    
    alternatively, once you're fairly comfortable with the 's', depending on what pv features you do and don't need, you may consider not using PVs at all, and just using 's' arrays to begin with.  but the above solution would work.
    
    let me know if my pseudocode made no sense, and I'll go into more detail
  • You said in IRC that there's a new version of S that includes search expressions for easy index referring without the need for extensive "for each" looping.

    Can you upload it, pretty please?

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