WatchNon-threaded

Forums » Advanced Editor Forum » Read Message

Talk about it. Ask for help on it. Compliment it.

$ITEMSTATE

2 months ago

I want to make it so that when you use an item, you cannot access it again until you get to the next page. 
I tried putting on the link back to the story from the item '$ITEMSTATE01 := 0 ' where the item being used was item01, and it came up with a service error. Take that out of the 'back to story' link, and it works just fine again. 
I tried having the link back to the page from the item add a point to a throwaway variable, and then in global script if the varible = 1 then itemstate01 = 0, but it was still on the page when after using the item when I went to go test it out. 
(on global link, I have IF $CHAPTERID != 2 THEN  BEGIN  $ITEMSTATE01 := 1 END , where chapter 2 is where all the item pages outside of the story itself resides, so it'll stay missing for pages attached to the item, but come back when you move on with the story.)

One, curious as to why $ITEMSTATE01 := 0 causes a service error when you're exiting the said item. Or why neither of the things I tried worked in general.
Two, I would greatly appreciate it if someone were to let me know if there was a way to do this and how. 

$ITEMSTATE

2 months ago
Would it work to simply limit the number of uses of them item for you? Then you wouldn't have to write any script.

$ITEMSTATE

2 months ago
Pretty sure ITEMSTATE doesn't work in link scripts, only page scripts.

Could be mistaken, but I think that's a quirk of theirs.

$ITEMSTATE

2 months ago
You are correct! From the script reference page:

"Also, you can put this system variable in both page scripts and link scripts, but they cannot be changed in the link scripts (i.e. $ITEMSTATE := 1 will not work in a link script, but IF $ITEMSTATE = 1 THEN will work)."

$ITEMSTATE

2 months ago
Oh, and thinking about it a little more, if you're trying to change ITEMSTATE, then you're changing whether or not the user has the item. You could use ITEMUSED to determine if the user can use them item, so that might make more sense.

$ITEMSTATE

2 months ago
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