Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

[Answered] Giving Items with Scripting

14 years ago
Greetings all. I have been pouring over the few help files on scripts, highlighting what seems most relevant, taking notes.... but I'm still struggling with them.

I need to give an item to Julie.

Step 1. Create "rose" as an item.
Page Found On: "Garden"
Number of uses: Unlimited
Can be Dropped: NO
Item Effects: none
Item Script: none

Step 2.
Create "Give rose" page. That describes the giving.

Step 3.
Create "Julie" page.
Add a link here called "Give rose to Julie" that requires the rose item (stop sign) and Drops the rose" (bag) when selected.

Result. The rose drops out of inventory (that's good). Revisit garden and the Rose item appears there despite the "Can be Dropped: No" in description of rose (that's bad).

I have tried the script (:-) for "Give rose to Julie" instead of the "Drop rose":

$ITEMSTATE1 = 0

...as indicated on the "Scripting: Items" help file (Which states "...And the simple way of putting items in your inventory", using the zero to indicate that it is no longer in the inventory). The item ID is 1. And get the "Could not save script due to errors" message. %ITEMSTATE1 = 0 results in the same "Cannot save" message.

If I ever get to the point where I know my way around the complexities of Chooseyourstory, I'm going to combine the various "help" files on scripts into a single document for newbies like me. Right now there are many gaps, too few examples, and contradictory advice. I really appreciate the work of those who submitted those help files, but I think that information could use some updating and expansion.

I have a suspicion that many of the help files are no longer accurate because of a change in the underlying program. Geeze, there has to be a simple way of giving or dropping an item so that it doesn't automatically reappear at its starting point.

Not many writers reading this forum now. Those who are here, HELP!

Chuck

[Answered] Giving Items with Scripting

14 years ago

I'd love to help you, but I don't understand squat about Scripting. I can say that if you set the item use to 1 time and use it only on "Julie" then it will take you to "Give Rose to Julie." Other than that, you'll have to wait. Sorry.

[Answered] Giving Items with Scripting

14 years ago

I misunderstood your entire post. Why not create two garden pages (or for that matter, a special page for picking the rose) and add a variable change for when you give her the rose and either restrict the special rose page or restrict the first garden and activate the second garden page. I'm sorry, ignore my above post. I did not fully understand your post.

[Answered] Giving Items with Scripting

14 years ago
Yea, Jeff. I could manage the issue by using variables only. But by giving the player "items" (in the code), the items show up on the screen to let them know what they have. Thanks for replying. If all items are magically transported to the page of origin when they are dropped (i.e., given to someone) then I'll have to abandon the use of items and do it all with variables.

[Answered] Giving Items with Scripting

14 years ago
On this page:

http://chooseyourstory.com/help/articles/article.aspx?ArticleId=46

you can clearly see that itemstate = 0 means that the item is:

"Not in the inventory and is on the original page."

So that's not what you should do to get around this problem. What I'd do is create a separate rose garden page (identical to the first one in all ways) where you send the player back to when you don't want them to re-find the rose.

[Answered] Giving Items with Scripting

14 years ago
Woh, Jeff. Good taste in advice.

[Answered] Giving Items with Scripting

14 years ago

I guess this is a compliment, but mine should basically be used as last resort. Ehh.

[Answered] Giving Items with Scripting

14 years ago
Thanks. I didn't recognize the "...and is on the original page" part of the directions. But I could never get the itemstate1 = 0 script to even work. So I must be typing it wrong.

I have been using the double pages based on variable changes for other parts of the story.

Chuck

[Answered] Giving Items with Scripting

14 years ago
Greetings all.

Solved the problem using both the item and a variable. Allowed me to create only one page, not two.

VariableZ starts at 0 with a max of 1.

"Page A" has two identically worded links titled "Back" (leaving the location).

One "Back" on Page A goes to an item giving page (Page B) with a link "Back" to Page C. This "Back" has two restrictions: VariableZ = 0 and item restriction is "not has" AND one Variable Change of VariableZ +1.

The other "Back" on Page A goes directly to Page C with the variable restriction of VariableB = 0.

I think this will work but I haven't tested it several times. It's a little head spinning as I reread this post. It's possible that going to Page B and not taking the item might eliminate visiting it again. This item is not critical to the story, so not taking the item is no big deal. Don't take it... miss out on the non critical triggers it might have.

[Answered] Giving Items with Scripting

14 years ago
Just checked this. Visiting Page B and NOT TAKING the item will prevent the player from ever returning to Page B to get the item. I think this possible problem could be solved by tweaking the code, but at this point in my story it's more of a feature than a problem. Not taking something is viewed as "it's not important."

Chuck

[Answered] Giving Items with Scripting

14 years ago
An interim works too, good idea.

[Answered] Giving Items with Scripting

14 years ago
moved to the AEF