Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

[Answered] Variables linked with chapters.

14 years ago

In order to give chapters some actual meanings, I was wondering if there is a way to have variables be linked to them. Such as if HEALTH reaches 0 in one chapter, a page appears stating that you died, but what I would like to see is that you could have that if the reader is on a certain chapter and HEALTH goes to 0, then it goes to page X, if it is on another chapter, then it goes to page Y. Follow me? I would also like to see it possible to select that a variable is only visible during one chapter. Such as a boss battle and then the chapter that is that boss battle can have the bad guy's health visible, in all other chapters, it is not visible.

[Answered] Variables linked with chapters.

14 years ago

It's possible with scripting. I'll wait for JJJ or Zikara to get back to this because I haven't scripted in years, but it is definitely possible, doing something along the lines of "if health = 0 and chapter = 5 then go to this page" and then just do a different script for each chapter (or use ELSE if you want something different for every other chapter).

 

[Answered] Variables linked with chapters.

14 years ago
Yea, October's mostly got it right.


For the first one with the health leading to different places dependant on what chapter they're on you'd do something like this in the Global Link script:


IF $CHAPTERID = @C1 THEN
BEGIN
IF %HEALTH = 0 THEN
$DEST := @P32
END
IF $CHAPTERID = @C2 THEN
BEGIN
IF %HEALTH = 0 THEN
$DEST := @P71
....
etc.




Plus you can use the Global Page to show variables only on specific chapters, so put this into the global page script:


IF $CHAPTERID = @C1 THEN
$PAGETEXT := $PAGETEXT + "Boss health: " + %BOSSHEALTH
IF CHAPTERID = @C4 THEN
$PAGTEXT := $PAGETEXT + "You are under water. You have " + %AIR + "more choices before you drown."



This is why scripting is awesome. I suggest you read the articles on it and try it out. If you need any help, just let me know.

[Answered] Variables linked with chapters.

14 years ago

Does C1 chapter 1 no matter what he is named or will I have to type the name of the chapter if he is named? Same question for P32.

[Answered] Variables linked with chapters.

14 years ago

If you enable scripting, each page will have an ID assigned to it. In scripting you would write: "P(PAGE ID NUMBER)" so if it was page ID 43 it would be P43. Same goes for chapters.

[Answered] Variables linked with chapters.

14 years ago

In other words, you don't have to type the name of the chapter or page, you use the ID number instead.

[Answered] Variables linked with chapters.

14 years ago
As October said, you just need the numbers.

Set scripting to advanced in the Editor features (can be found in story game properties) then look for these things:



The top number that is circled is where you find the Chapter ID, and the bottom on is the Page ID.

[Answered] Variables linked with chapters.

14 years ago

Thanks. I think I got it now.

[Answered] Variables linked with chapters.

14 years ago
Zikara, how do you embed pics like that?

[Answered] Variables linked with chapters.

14 years ago
October has a good article about it here: Uploading Pictures

[Answered] Variables linked with chapters.

14 years ago
IF %PROBLEMS > 0 THEN
BEGIN
IF %ZIKARA > 0 THEN
BEGIN
%PROBLEMS := 0
END
END

That about sums up how I feel.

[Answered] Variables linked with chapters.

14 years ago
Hahahaha! I like that.

[Answered] Variables linked with chapters.

14 years ago

Does this mean Zikara can solve any scripting problem? I'm sorta confused, I'm not well read on scripting.

[Answered] Variables linked with chapters.

14 years ago
It means, if there's a problem and Zikara is around, the problem ceases to exist.