Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

How to prevent an item from re-appearing?

6 years ago

I've been playing around with the editor for a few hours, and thus far I've figured out how to resolve every problem I've run into!

...Except this one. Let's say that Player picks up Item A on X Page. On Y Page, Item A is replaced with Item B. If Player returns to X Page, how would I prevent Item A from appearing AGAIN?

How to prevent an item from re-appearing?

6 years ago
There's probably multiple ways but the simplest would be just checking if they've been there before, and if so sending them to another page with identical text but no item.

How to prevent an item from re-appearing?

6 years ago

Thank you for the tip!

I'm not entirely sure how to accomplish your suggestion, since I couldn't figure out a way to create a built-in check for previously visited pages (coupled with an automatic re-route). Might I have a bit more information?

How to prevent an item from re-appearing?

6 years ago
You can put a variable in whatever the relevant links are to track whether they've been to the page before, and if so use $DEST to move them to the one where they should be.

How to prevent an item from re-appearing?

6 years ago

I am very new to...well, everything. But especially scripting. xD
I'm not quite certain how to use $DEST, but it definitely sounds like what I've been looking for. Coupled with linking to duplicate pages with no item drop, I believe I'll be able to get everything sorted. Thanks a ton for your help!

How to prevent an item from re-appearing?

6 years ago
Yeah, that can be an issue. You might look for other ways around this one, like putting things in places where people won't go again.

One weird way would be to have a location for the item that the reader can literally never find. Then, when the player finds the item the first time, you would include that in the text and have a link that will manually put the item in their inventory. Then if they drop the item, it goes to a place they cannot ever get to. This would require an if statement of some kind on the page where you wanted them to find it, and perhaps a variable to indicate whether they've found it or not.

How to prevent an item from re-appearing?

6 years ago

That sounds complicated. xD
But it definitely shows that there are a number of possible workarounds for this dilemma. Thanks for the suggestion!

How to prevent an item from re-appearing?

6 years ago
Yeah, I don't know a real simple way to do that, but maybe @BradinDvorak might know an easier way.

How to prevent an item from re-appearing?

6 years ago
Just doing away with the item altogether and handling whatever it is in the story itself would be the simplest option imo, probably for the reader as well. Items are really only needed in very specific scenarios.

How to prevent an item from re-appearing?

6 years ago

The story I'm planning is focused around a game mechanic that involves quite a few items, as well as a number of instances wherein the player could be navigated away from the main story. I would definitely need some way to ensure that they're not constantly getting multiples of every item every time they're routed back to the main story. 

How to prevent an item from re-appearing?

6 years ago
There is a method you can use, which I developed to go around an old bug (where you could not change $ITEMSTATE with a link for a while).

I'll do some forum diving to see if I can find my write-up on it. Or perhaps I'll write an Article about it...

How to prevent an item from re-appearing?

6 years ago
Here's the basics of it (which is meaningless, unless you first take the time to learn how Scripting works.

Yes, this is how you turn on and off Items with Links (when the ItemState bug is still in effect).

Set an Item to be Usable 3 times.
Set $ITEMSTATEXX := 1
Set $ITEMUSEDXX := 3 to hide the Item
Set $ITEMUSEDXX := 1 to unhide the Item

Set a Global Script
IF $ITEMUSEDXX < 3 THEN $ITEMUSEDXX := 1

If you go with this method, then you will have to track uses with something other than $ITEMUSEDXX

How to prevent an item from re-appearing?

6 years ago
An even older example -

Here’s My Workaround for Script Dropping Items

If you want an Item that can be Dropped by Script:

1: Create the Item (say a Spoon, hereafter ITEM #1) and Set the Number of Uses to 2 Times

2: In the Global Page Script, add: IF $ITEMUSED1 = 1 THEN $ITEMUSED1 := 0 (this allows the Spoon to be used any number of times)

3: In Any Link (or Page) Script where you want to Script Drop the Spoon from the Inventory, add: $ITEMUSED1 := 2 (this will cause the Spoon to drop out of the Inventory when the Link (or Page) is selected)

Hope this helps until a proper code fix can be implemented =)