Non-threaded

Forums » Bugs & Problems » Read Thread

Post reports about problems or bugs in here.
This bug was closed 7/16/2012: Will be fixed in v20120627, well, partially.

[Medium] The infamous Itemstate Bug

16 years ago

Hi guys. Melike brought this Itemstate problem to my attention, and it reminded me that I had the same problem a while back. Basically, the editor isn't allowing $ITEMSTATEx := 0 (where x is the number of the item) which is used to drop an item during a script.

I'm not sure if this has been mentioned in this forum before or not, but I couldn't see it listed. (If any bug catching points are given, give them to Melike, who brought this to my attention)

Items can be picked up fine, but the only way they can be dropped is by clicking on the little bag (drop item) button beside a link, and setting it to drop an item. However, you can't write a script tha causes an item to be dropped under certain circumstances. You'd have to write a couple links, and restrict their useage so that some links don't drop the item and some do, rather than writing scripts to work it out.

I've tested $ITEMSTATE := 0 in both link and page scripts, and it errors instantly. Here's the error message displayed when after following a link, a page is reached, and the page just has this script:  $ITEMSTATE1 := 0

Server Error in '/' Application.

PostProcessed already!

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: PostProcessed already!

Source Error:

Line 34: 			case "FollowLink":
            Line 35: 				{
            Line 36: 					StoryStateReturnValues ret = State.FollowLink(int.Parse(Request.Form["pbValue"]));
            Line 37: 					switch (ret)
            Line 38: 					{

Source File: c:\Websites\ChooseYourStory\ChooseYourStory.com\Story\Viewer\Default.aspx    Line: 36

Stack Trace:

[Exception: PostProcessed already!]
            ChooseYourStory.Stories.StoryState.PostProcess() in C:\Projects\ChooseYourStory\CysWebSolution\ChooseYourStory\Stories\StoryState_PostProcess.cs:185
            ChooseYourStory.Stories.StoryState.DropItem(Int32 itemId) in C:\Projects\ChooseYourStory\CysWebSolution\ChooseYourStory\Stories\StoryState_PublicInterface.cs:361
            ChooseYourStory.Stories.Scripting.ItemExpression.AssignValue(Object value, StoryState state) in C:\Projects\ChooseYourStory\CysWebSolution\ChooseYourStory.Stories.Scripting\ItemExpression.cs:112
            ChooseYourStory.Stories.Scripting.AssignmentStatement.Execute(StoryState state) in C:\Projects\ChooseYourStory\CysWebSolution\ChooseYourStory.Stories.Scripting\AssignmentStatement.cs:38
            ChooseYourStory.Stories.Scripting.ParsedScript.Execute(StoryState state) in C:\Projects\ChooseYourStory\CysWebSolution\ChooseYourStory.Stories.Scripting\ParsedScript.cs:26
            ChooseYourStory.Stories.StoryState.Scripting_ExecutePageScripts() in C:\Projects\ChooseYourStory\CysWebSolution\ChooseYourStory\Stories\StoryState_Scripting.cs:114
            ChooseYourStory.Stories.StoryState.PostProcess_Scripts() in C:\Projects\ChooseYourStory\CysWebSolution\ChooseYourStory\Stories\StoryState_PostProcess.cs:172
            ChooseYourStory.Stories.StoryState.PostProcess() in C:\Projects\ChooseYourStory\CysWebSolution\ChooseYourStory\Stories\StoryState_PostProcess.cs:192
            ChooseYourStory.Stories.StoryState.FollowLink(Int32 linkId) in C:\Projects\ChooseYourStory\CysWebSolution\ChooseYourStory\Stories\StoryState_PublicInterface.cs:256
            ASP.story_viewer_default_aspx.OnLoad(EventArgs e) in c:\Websites\ChooseYourStory\ChooseYourStory.com\Story\Viewer\Default.aspx:36
            System.Web.UI.Control.LoadRecursive() +101
            System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2588
            


Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832

 

[Medium] The infamous Itemstate Bug

16 years ago
The exact same thing happened to me. I've posted it before, I think. Or I told someone about it. One or the other, but this happened to me and that's why my progress on a certain storygame has been halted much to my dislike. But yes, this is an annoying problem, thanks for bringing it up again.

[Medium] The infamous Itemstate Bug

16 years ago

I get the same thing when using this:

%GOLD := %GOLD + 1D10
%EXP := %EXP + 1D10
IF
%QUEST1 = 1
THEN
BEGIN
$ITEMSTATE8 := 1
%QUEST1 := 2
$PAGETEXT := $PAGETEXT + "<br><b>You found Horace's Shield!  (Check inventory)  He'll probably reward you if you return it to him!"
END

(Note:  this is from a Scripting Test where I'm trying out scripting, NOT from UR:  An Astronaut)

[Medium] The infamous Itemstate Bug

15 years ago

Bump. Could this be your first priority when you return Alex? Not to be pushy but tsmpaul's been waiting on it for I don't know how long and there's been at least a year and a bit on my behalf. I can't continue writing my storygame until it's fixed.

[Medium] The infamous Itemstate Bug

12 years ago

I found a way for this to work. Basically, have a variable (ITEM05) and put in the global page:

 

IF %ITEM05 = 1 THEN
BEGIN
$ITEMSTATE05 = 1
END

 

Then, increase the ITEM05 variable by 1 on the link you want ITEMSTATE05 to become 1. For some reason, the service error does not occur if the command to alter the itemstate originates from the global page instead of a link. I tried it and it works.

[Medium] The infamous Itemstate Bug

12 years ago
Does it work the other way? Can you make them drop the item in that way? That is the problem people are encountering.

[Medium] The infamous Itemstate Bug

12 years ago

Yes. Just do the same thing, only decrease the variable (and have the global page script state that if the variable = 0 then the itemstate = 0.).

[Medium] The infamous Itemstate Bug

12 years ago

Okay, just tested this to see if it works - fine for putting items into the inventory but you get the same old $ITEMSTATE bug when you try and take items out of the inventory.

[Medium] The infamous Itemstate Bug

12 years ago

Oh? That's strange. I did, in global page:

IF $ITEMSTATE15 = 1 THEN
BEGIN
$ITEMSTATE16 := 1
END

IF $ITEMSTATE15 = 0 THEN
BEGIN
$ITEMSTATE16 := 0
END

And it worked on both ends (item 16 follows the state of item 15). This is what motivated me to seek the alternative stated above, so as it worked with making itemstate := 1, I assumed it worked as well as the one where the item follows another item).

But you can use the icon that looks like a bag to drop items at links (and then any variables that are supposed to affect that would have to be involved in restrictions to the link, if the item is supposed to drop depending on variables or items, then you should just have two links and provide restrictions). Does this not include what you want to accomplish?

[Medium] The infamous Itemstate Bug

12 years ago

Has this every been resolved or worked around in any way whatsoever?

Can you drop an Item through Scripting in ANY Manner?

SindriV suggests that you can, but it is unclear how he suggests doing it and I have been unable to implement it successfully. I also wonder if new changes to the site may have stepped on SindriV's workaround for new games.

[Medium] The infamous Itemstate Bug

12 years ago

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  =)

[Medium] The infamous Itemstate Bug

12 years ago

Just implemented this and it works like a charm. Thanks so much for sharing your solution!

[Medium] The infamous Itemstate Bug

12 years ago

I closed your feature request, but I didn't realize it was that big of a deal.

But fine, i took a quick look, and think i figured out how to hack it in. Does $ITEMSTATE := 1 work? It didn't for me, so I guess I can fix that, too.

[Medium] The infamous Itemstate Bug

12 years ago

Itemstate := 1 works fine for me.

[Medium] The infamous Itemstate Bug

12 years ago

On a link script?

I just get the "cannot post process" error.

[Medium] The infamous Itemstate Bug

12 years ago

On a page script it works fine, but on a link script it doesn't.

[Medium] The infamous Itemstate Bug

12 years ago

OK, that makes sense... thanks. So here's the thing.

You've seen that I don't test very thoroughly, and as such, features go missing or break. Like, the "My rating " thing on existing storygames. But that's ok... easy to add back.

That said, the StoryEngine was pretty convoluted and when scripting was added in circa '07, it made it even more complicated. This means that it's very delicate, and breaks in very subtle ways. Hence my The Advanced Testing StoryGame - Help Needed thread.

Now I think I can get $ITEMSTATE := 0 working exactly the way $ITEMSTATE := 1 works, but it's just going to keep being broken in links. I'm still afraid to do this... so, a test case would be great:

  • Existing
    • assignment:
      • ITEMSTATE := 0 works nowhere
      • ITEMSTATE := 1 works ???
    • comparison
      • ITEMSTATE = 0 works
      • ITEMSTATE = 1 works
      • etc..
  • Fixed
    • assignment
      • ITEMSTATE := 0 works on Page Scripts and ???, but not link scripts
      • ITEMSTATE := 1 works ???
    • comparison
      • ...

If you guys can help with this, I can make the code changes; it's a trivial change, but I'm afraid of breaking other stutff

[Medium] The infamous Itemstate Bug

12 years ago

I was referring to ITEMSTATE := 1, not := 0, so it's:

  • Assignment
    • ITEMSTATE := 0 works no where
    • ITEMSTATE := 1 works on page scripts, does not work on link scripts
  • Comparison
    • Does not seem to be any issue with comparisons

[Medium] The infamous Itemstate Bug

12 years ago

OK -- I'll do a push tonite (hopefully) that will patch this. Seems the main risk is that using ITEMSTATE := 0 may cause odd behavior on the page, but maybe not. Sinec it doesn't work now I guess any behavior is better than crashing.

[Medium] The infamous Itemstate Bug

12 years ago

Sweet! I look forward to seeing how it turns out!

*crosses fingers*

[Medium] The infamous Itemstate Bug

12 years ago

I don't think ITEMSTATE Changes are necessary with Links, as long as they work in Page Scripts.