Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Picky Item Effects

7 years ago

I'm pretty sure this uses scripting, and if it does, please refer me to what article it's in (I might ask about it after rereading the article because it's confusing for me, mostly) or just write out the script for me (thanks), but I need to know:

In Item Effects, you can say that if you use Item5 on Page 20, it'll bring you to Page 21 (which is only accessible this way). However, Page 20 is still accessible once you leave Page 21, so Item5 can be used again on Page 20 to get to Page 21. I want to make it so that you can only access Page 21 once from Page 20 using Item5 but not have to drop/consume the item, and if Item5 were to be used again on Page 20, the person will be brought to a different page.

Picky Item Effects

7 years ago
Item scripting:
http://chooseyourstory.com/help/articles/article.aspx?ArticleId=66

All you need to do is make a variable to keep track of if the player has gone to the page before. If they have, change $DEST to the new destination in the item script, which will override the normal functionality of the item.

I'll let you try to work out the code as a learning experience (you can post it here and ill tell you if it's right or not).

Picky Item Effects

7 years ago

Great answer. Post your code and we'll help you make it better if it isn't perfect.

Picky Item Effects

7 years ago
%TARLSNU is the variable that keeps track of if the player has gone to Page 21 before.

Item Script (?):

IF $DEST = @P20 THEN
.....IF %TARLSNU = 0 THEN
..........$DEST := @P21
..........%TARLSNU := 1
.....ELSE
..........$DEST := @P22

(..... is to represent an indent.)

Picky Item Effects

7 years ago

I'm not totally clear on what you want to accomplish but shouldn't your first line check the $PAGEID not the $DEST? You want them item to do something if the player is on page 20, right?

Picky Item Effects

7 years ago
Yeah. ^^; I'm not very familiar with system variables. >~< Would the other two $DEST be correct then?

Picky Item Effects

7 years ago

$DEST is the destination that the player will be sent to if they click a link or use an item, etc. $PAGEID is the current page that they're on. The two other $DESTs seem correct because you want to determine where the player is sent, but the first one should be a $PAGEID check because you're checking if the player is on a certain page.

Picky Item Effects

7 years ago
Okay. Thank you! ^-^

Picky Item Effects

7 years ago

Don't forget to use blocks; basically, if an IF THEN is supposed to execute more than one statement, surround the statement with BEGIN and END.

# Single statement
IF %B > %A THEN %B := %A

# Multiple statements
IF 1D2 = 1 THEN BEGIN
    %A := 1D10
    %B := 1D10
END

Picky Item Effects

7 years ago
So, in the above situation, would it be:

IF $PAGEID = 20 THEN
.....IF %TARLSNU = 0 THEN BEGIN
..........$DEST := @P21
..........%TARLSNU := 1
.....END
.....ELSE
..........$DEST := @P22

I don't think I did it correctly though. xD

Picky Item Effects

7 years ago
You don't have to check the pageid if the normal functionality is that the item is used on that page. You're also doing this is a rather odd way.

Put:
%TARLSNU := 1

In the page script of Page 21. Once the player goes to page 21, it's recorded in the variable. Then just put:

IF %TARLSNU = 1 THEN $DEST := @P22

In the item script. When the item is used on page 20, the normal item effects will activate. If %TARLSNU is 1 (AKA - If you've already gone to page 21), then the script above will override the normal destination, instead bringing them to page 22 rather than 21.

You don't have to make the item itself make all the checks and changes.

Picky Item Effects

7 years ago

That makes sense. :/ Thanks! :D It's hard for me to wrap my head around the way these scripts can work. ^^;

Also, the Item can be used in different places—it's a cloak—hence the PageID check. :S Unless it's unnecessary anyway.

Picky Item Effects

7 years ago
Hmm, in that case yeah, your first check would probably be needed. I thought it was only the one page it could be used on.

Picky Item Effects

7 years ago

Alright, thanks. :D