making checkpoints?

found a way to make a checkpoint however cant seem to revert any of the attributes the player recieved during the time, any way to do this?

for example:

start
[start](checkpoint 1)

[checkpoint 1]: 
@set checkpoint = 1
gain point

[jump path A]
[jump path B]

[jump path A]:

gain point

[progress](checkpoint 2)

[checkpoint 2]

@set checkpoint = 2

[boss]

[jump path B]:

gain more points

[progress](no checkpoint)

[no checkpoint]

gain point

[boss]

[boss]:

fight fight.. you find way to be defeated and now all your points you gathered it reset to to what ever checkpoint you passed...

{if checkpoint=1:[Load checkpoint](checkpoint 1).}{else: if checkpoint=2:[load checkpoint](checkpoint 2)}

the example is to allow the player to go one path or the other, the safer path has less points but has a checkpoint while the other path has more points with no checkpoint. the question is, how do you take away the points the player gained if they went the more risky route? it becomes more difficult if there is a lot of other random points before the checkpoint to so if you have paths upon paths , how do you take the points that the player gained after the checkpoint?

the alternite way is to code every path with

{if path101 = 1: you gain point}{else: you gain point @inc points}
@set path101 = 1

though am sure the 'if' command and '@' code work to well together as i seem to not be able to get it to work as it requires a new line and the if doesn't work if the end is on a new line for some reason (even if it should).

so is there a way to do checkpoints without having the player get too much of a single point or an item by looping the same path due to the checkpoints. could also put checkpoint before the boss but also want to add earn with risk...


You can't use @inc in the text section.

A Squiffy section is divided up into 3 parts, which are treated in different ways and must come in the right order.

  • First is the script part. Every line starts with at least 4 spaces, and the instructions are javascript.
  • Then comes the assignment section, where every line starts with @ and you can use directives like @inc and @set.
  • Then finally there is the text part, where the only interactive commands are the {text processor directives}. If you want to change a variable here (for example within an {if), you need to use the text processor version. For example, instead of @inc points, you write {@points+1}.

Your checkpoints seem kind of weird. However, I think it might be possible to reset the points using interpolation. You could do:

@set checkpoint = 1
@set points_at_checkpoint = @points

and when the player dies, you do:

@set points = @points_at_checkpoint

before the "Load checkpoint" link.

(off the top of my head; I haven't done much with Squiffy functions because the Javascript ones are more flexible)


Thanks, will give it a try, dont use it often but seems to be the easiest one to use when your time is limited to learn...

Do you know if the {if and {@ work for things like time and something like game experience?

Thanks again for the help, sorry for late response too, was pretty busy with things but this project lol


Do you know if the {if and {@ work for things like time and something like game experience?

Squiffy doesn't care what attributes mean; it treats them as numbers and text. You can use them for anything you want. Time and experience can easily be represented as numbers.

If you want to use real world time, you can fetch it using javascript and put it into an attribute. You could use any of:

    squiffy.set("year", Date.now().getFullYear());
    squiffy.set("month", Date.now().getMonth() + 1);  // +1 because getMonth gives you a number from 0 to 11
    squiffy.set("monthname", "Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov".split("/")[Date.now().getMonth()]);
    squiffy.set("dayofmonth", Date.now().getDate());
    squiffy.set("dayofweek", Date.now().getDay()); // 0 = Sunday, 1 = Monday, ... 6 = Saturday
    squiffy.set("dayname", "Sun/Mon/Tue/Wed/Thur/Fri".split("/")[Date.now().getDay()]);
    squiffy.set("militaryhours", Date.now().getHours()); // hour (0 to 23)
    squiffy.set("normalhours", (Date.now().getHours()-1)%12 + 1); // hour (1 to 12)
    squiffy.set("ampm", (Date.now().getHours() >= 12) ? "PM" : "AM");
    squiffy.set("minutes", Date.now().getMinutes());
    squiffy.set("seconds", Date.now().getSeconds());
    squiffy.set("milliseconds", Date.now().getMilliseconds());

Which will set the relevant attributes to different parts of the current time. Just use the ones that are useful to you :)


thanks though, seem the software dont really like it as all the code just shows as a text form, might be missing something but its sitting in the test section of the game so its not going to be used for now, need to find a way to advance time anyways so it will just sit there till something gets put in place lol

thanks again XD

Edit the {@points+1} doesn't work, even tried {@points + 1} seems to be invalid and doesn't count anything up as had a path like this...

@set points  =  0

current points: {points}

[plus 1] [plus 3] [plus 5] [[total]] 


[plus 1]:

plus 1 points {@points+1}

[plus 3]:

plus 3 points {@points+3}

[plus 5]:

plus 5 points {@points+5}

[[total]]: 

total points gain: {points}

the only thing that shows up is 'null' or if set the @set points = 1 then all it shows is '1' so it seems am missing something.


Edit the {@points+1} doesn't work, even tried {@points + 1} seems to be invalid and doesn't count anything up as had a path like this...

Sorry, my bad. Think it should be {@points+=1}.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums