Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Adding text to a page

11 years ago

Hey guys, how can I add particular text to a page after an item is used? I'd also like a blank line between each additionfrown

Adding text to a page

11 years ago

I'm not sure if you can do that or not. Usually people just make it so that when you use an item it just takes you to another page, but I could be wrong. I don't know all the Advanced Editor tricks yet.

Adding text to a page

11 years ago

Page scripts. OR have another page with said text change using variables to determine which one the player can reach.

Adding text to a page

11 years ago

what is the script?

Adding text to a page

11 years ago

Upgrade to the advanced editor.

Enable scripting.

Adding text to a page

11 years ago

$PAGETEXT := $PAGETEXT + "What you want to add"

In the script. You'll have to add some logic, so it appears when you want it to (we can help with that if you're specific with how it will work).

Adding text to a page

11 years ago

Thanks dude.

You have a notebook which when used takes you to a blank page.

Throughout the game you collect tons of notes.

I want it so when the player is on the notebook page and uses a note item then text is added to the page.

When they use another note there would be blank line put after the previous text and new text added.

Each time they return to the notebook the text would still be there in the same order.

Adding text to a page

11 years ago

Hmm. If I'm not mistaken the line I wrote adds a blank line by default (it starts a brand new paragraph).

Do you want the player to actually USE the notes, or does simply having the notes in their inventory suffice?

Because if its the latter, we can just do a check to see if we have a note, and if we do add the text to the page. If it's the former it's still doable, just will take a bit of extra work.

Adding text to a page

11 years ago

I'd like them to actually use the item

Adding text to a page

11 years ago

Ah, well as it turns out it's just as simple lol. I had forgotten we actually had a variable by default that keeps track of the number of times an item is used.

Anyway:

IF $ITEMUSED1 > 0 THEN

$PAGETEXT := $PAGETEXT + "Words you add to the page for item 1"

Is what the script consist of. The ITEMUSED1 is the number of times the item with the label #1 (if you go to your items page they all have numbers), has been used. In this check we see if it's been used more than zero times (in case the person accidentally uses it twice or something.

After than, you just copy and paste that multiple times, replacing the number for the item used to correspond with the number of your item (again, on the item page). So the finished product may look like this:

IF $ITEMUSED1 > 0 THEN

$PAGETEXT := $PAGETEXT + "Words you add to the page for note 1"

IF $ITEMUSED2 > 0 THEN

$PAGETEXT := $PAGETEXT + "Words you add to the page for note 2"

IF $ITEMUSED3 > 0 THEN

$PAGETEXT := $PAGETEXT + "Words you add to the page for note 3"

The page would look something like this (assuming its a blank page by default):

Words you add to the page for note 1

Words you add to the page for note 2

Words you add to the page for note 3

The order you put the logic is the order the page will be put together. So the notes you want at the top of the page, should be added to the page first, etc, etc. This would all be done in the Page Script part of your page (which is the := button beside the title of the page when you go into edit mode).

And...yeah, that should work.

Adding text to a page

11 years ago

Thanks a ton! Haven't tried it yet but this looks like exactly what I want! Much love <3

Adding text to a page

11 years ago

Np. Good luck with it.

Adding text to a page

11 years ago

*Cough* 3J, this man needs some points. ^^

Adding text to a page

11 years ago

*cough*

Adding text to a page

11 years ago

Excellent. haha

Adding text to a page

11 years ago

Alright sweet, but a couple of problems.. I'm not getting a blank line for some reason.

Also is there anyway to make the text appear in the order the notes were used?

EDIT: Also the only way I can get this to work is by making it so using an item on notebook sends them to notebook otherwise it says "Item cant be used"

Then the player has to hit the previous page link for every note they added. Any way to script it to allow item use without going to a page?

Adding text to a page

11 years ago

Just add:

  + "</br>"

At the end of each one. So:

$PAGETEXT := $PAGETEXT + "Words you add to the page for note 1" + "</br>"

And that should take care of the lines.

There is a way, but it'd be significantly more complicated, as you'd have to save the order in which each note was used, then order the page based on that (so two extra steps). It would involve creating a variable for each item you have (for their order), and then a pretty long set of conditions to check. You'd have a bunch of IF statements at the top of the page, for setting the order the notes were used, then another section for making the page, based on those orders.

Still doable, but tbh I think it'd be more effort than it's worth. Is there any reason in particular you want to do it that way?

Adding text to a page

11 years ago

There is, but I'll live. Definitely doesn't sound worth the effort, so I'm good. Also thanks a ton for all this help man, any answer for that last question i edited in?

Adding text to a page

11 years ago

I was editing in the answer to that, but you posted too fast lol.

Are you using the link "previous page" to get out of your journal? If so that's what's causing the issue (since it's thinking the "previous page" is itself).

In which case, you'd have to save the page you were last on (before that page), and then set the back link to go back to that page (can show you how if that is what's happening).

Adding text to a page

11 years ago

Yes thats what happening laugh

Adding text to a page

11 years ago

K, first you'll need to make a variable called lastpage.

Then you'll need to go to the global script (final the scripts tab in your storygame editor), and inside the Global Page script, put this:

IF $PAGEID != 10 THEN
%LASTPAGE := $PAGEID

Now, I have 10 here because the page I used this for is the page 10. Find out the page number your journal is, and replace 10 with that number. Where you see the list of pages is where it will be shown, beside the title of the page.

Then, you need the LINK script, of your "go back" link on your journal page. The link script is just like the page script; beside the name of the link will be a := button.

In there, put this:

$DEST := "@P" + %LASTPAGE

This will change the destination of the link, to where-ever you were before the journal, regardless of how many times you've added notes to the page.

Adding text to a page

11 years ago

Yup. Perfect. You're amazing. heart

Adding text to a page

11 years ago

Your username makes your adoration spectacularly hilarious.

"Booze loves the killa_robot"

Adding text to a page

11 years ago

Lol.

Adding text to a page

11 years ago

This wasn't even the first time. Killa always comes to the rescue when I have a question. smiley

Adding text to a page

11 years ago

Np yes

Adding text to a page

11 years ago

Your explanations are exceptionally cogent.

Adding text to a page

11 years ago

Thanks.

Adding text to a page

11 years ago

Oh no! New issue! crying

The script makes the notebook go back to previous page with one click. But then any Previous Page buttons on that page dont work.. Killa to the rescue again? sad

EDIT: They work. But they send you back to notebook. Surely I dont have to put script on every back button..?

Adding text to a page

11 years ago

Or you could just avoid using previous page links when you know which page they're meant to go to anyway.

Adding text to a page

11 years ago

Due to the way I made the game there are many cases when previous page links are necessary. I could fix a great deal of them that do always lead to the same page but tons of them do not and would be game breaking if someone used the notebook at that time.. crying

Adding text to a page

11 years ago

I would just edit the target of each previous page link to be the correct page using Killa's script.

Adding text to a page

11 years ago

But it doesn't work twice in a row because then the last page was the notebook. Maybe there's a way to make the variable not change on the notebook page?

Adding text to a page

11 years ago

How many pages are you working with in your story, where you could bring up the journal?

Adding text to a page

11 years ago

The journal is in the inventory so you can bring it up any time.

Adding text to a page

11 years ago

The journal is an item

Adding text to a page

11 years ago

3J is saying to not use previous page links except for in the notebook. If you can't find another work around disallow the items use on problem pages or inform readers of the potential error.

Adding text to a page

11 years ago

Disallowing item on problem pages will work. How do I do this?

Adding text to a page

11 years ago

I'll shamefully admit I don't know. I haven't played around with items very much. I think it can be done though.

Adding text to a page

11 years ago

Or just do what 3J is saying.

Adding text to a page

11 years ago

I'm saying, add a link script on all previous page links in order to stop that from happening. As in, set them so their $DEST is your last page variable, don't use the built in 'previous page' function.

Adding text to a page

11 years ago

Im sorry Im having so much trouble understanding..

Are you saying put "$DEST := "@P" + %LASTPAGE" on every back link?

When I do that the one to get out of notebook works but the next one doesnt lead anywhere.

EDIT: Wait.. I need a separate variable for each one don't I..? indecision

I misunderstood the script but I think I understand now.. And this seems like it gonna be a ton of work too. Ima need script links, global links and variables for each page I think.. Does anyone know how to disallow item use on particular pages? Sounds like best option unless Im misunderstanding script still

 

Adding text to a page

11 years ago

To restrict an Item from use on a page, just set a Script in the Item Script that redirects to another page, where you explain that the item cannot be used there.

EX:

IF $PAGEID = 5 THEN
  $DEST := @P200
IF $PAGEID = 10 THEN
$DEST := @P200
IF $PAGEID = 15 THEN
$DEST := @P200

The above sends the user to page 200 (where you can say whatever) if they Use the Item on page 5, 10, or 15
 

 

Adding text to a page

11 years ago

You can also use this to tell an Item where to send the user from any page to any page. Not just to restrict the Use. It's much easier and quicker to use this than to manually set all the links in the GUI

Adding text to a page

11 years ago

You know what? I'm going to guarantee this has an easy fix and normally, I'd be so onboard to help you but I've been doing calculus since 1:30 today my brain is kind of fried so sorry I haven't come up with it yet. If there's no solution, I'll look into it tomorrow.

Adding text to a page

11 years ago

TBH I can't think of any legitimate reason to have back buttons rather than just linking it to the page.

I mean the only real reason at all would be you have multiple links leading to the same place, and you want the player to always return to where they came from, but that brings up the question:

Why can't they go to any of the other pages linked to the page they went to?

So you'd need to explain a bit more the reasoning behind using back over real links, as using real links is by far the simplest answer to this.

Adding text to a page

11 years ago

Awesome write up for the whole process. This page is golden!

Adding text to a page

11 years ago

Adding text to a page

11 years ago

*Left Justify

I had a similar problem in my Dungeon Stompage game, where Using an Item had to have a Pervious Page Link on it because you could use it anywhere (Potion of Healing for example).

I also had 1 or 2 Items that you could also use anywhere, but were multi-paged (XP/Stat Boost Page & The Magic Whisk).

As long as you always opened either from the page you want to go back to, it worked fine. But if you opened the XP Item from inside the Potion, you got stuck in a loop. Basically you heal yourself, but don’t immediately go back to the Previous Page, rather Opening the XP Item first – page through that and then hit the ‘Return to Game’ Link (a %LASTPAGE Link) and it takes you to the place you opened the Item from – right after you healed. Now you’ve screwed the pooch, because the Previous Page Link is now set to go back to your last page – the XP Item page.

You shouldn’t ‘double-nest’ your %LASTPAGE Links, but there may still be a way to do it. I avoided having to though because it was too much work compared to folks just not doing it in the first place.

Here’s a spitball idea that might help…

For the sake of reference, let’s say using your Notebook takes you to Page 10.

Do not allow players to open the Notebook off Note Pages. Instead:

1. Allow players to open Notes from the Notebook (page 10), but using Note Items from that page loops you to Page 10 again, Deletes the Note Item, and adds the Item’s text to the Notebook Page.

2. Allow players to open Notes from other Pages, which takes you to a page you can read the note text (say page 201, 202, 203, etc) – but – make the Link off that page say: 'Add Note to Notebook' and direct it to page 10 as if the Note had been used like the Above.

Then, remove this from the Global Script:
IF $PAGEID != 10 THEN
 %LASTPAGE := $PAGEID

Go to your Items and in ITEM Scripts, add:

TO NOTEBOOK Item:
%LASTPAGE := $PAGEID

TO all NOTE Items:
IF $PAGEID != 10 THEN
 %LASTPAGE := $PAGEID

On Notebook Page 10, and all Item Pages (201, 202, 203, etc) Previous Page Link, add:
$DEST := "@P" + %LASTPAGE

This should work – I’m 75% sure of it… (Good Luck)