Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

[Answered] Show text based on item state

17 years ago
I know this has been suggested before, but there seriously should be a way to make variables become visible. For example, if you find a weapon, it has its own ammo counter. Before you got the weapon, this ammo counter didn't appear, but now that you have the weapon, the counter appears. I'm mainly suggesting this because of Primal Instincts, but it can also help quiz makers. (At the end of the quiz, the score will be revealed, as it was hidden while you answered the questions.)

[Answered] Show text based on item state

17 years ago

Just use the advanced editor. Instead of adding scripts to each page, use the Global Page script.

Just add to the script, so it checks if your item is held. If it is, it tacks the text "Ammo Counter: 100 / 100" to the end, where %AMMO is how much current ammo you have, and %MAXAMMO is the total ammo you could have. Or something like that. This way, it only shows it on the page, at the bottom, if you have the item.

IF ITEMSTATE1 = 1 THEN 
BEGIN
$PAGETEXT := $PAGETEXT + "<br>Ammo Counter:" + %AMMO + " / " + %MAXAMMO
END

You would need to make it so that on the item, when it is used, it subtracts 1 from the ammo variable.

As for score - why, you just add to the text of your last page,

Your final score is %%SCORE%%.

[Answered] Show text based on item state

17 years ago
Excellent Answer! (Moving to Advanced Editor)

[Answered] Show text based on item state

17 years ago
This is all in the scripting articles. In solostrike's intermediate and my scripting with items articles. Good on you if you've already read it and you didn't understand, but if you haven't bothered to read the articles before posting this then shame on you.

Anyway, always try and find a way with scripting. Never doubt how much it can do.

[Answered] Show text based on item state

17 years ago
Thanks everyone!

[Answered] Show text based on item state

17 years ago
In the scripting Paul wrote, is the <br> where the name of the weapon goes?

[Answered] Show text based on item state

17 years ago
sorry, I should explain things more. <br> means Line Break in HTML. It means it will write the text on a new line, instead of attaching it to the last sentence on the page. You can type the name of the weapon after the <br> if you want to show it. If you want more space between the page text and the ammo line, put two or more <br> in, so it's like pressing the Enter key multiple times.

[Answered] Show text based on item state

17 years ago
Wow, Paul. You know a lot about Scripting! Thanks for the help, man. PI's gonna be sweet!

The only reason I asked was because BR = Battle Rifle. But it looks like it's good I asked.

[Answered] Show text based on item state

17 years ago
Oh, and Paul, did you leave out a few quotation marks after your $PAGETEXT variable?

[Answered] Show text based on item state

17 years ago
Oh no, nevermind. I just looked at it closer. I realised variables don't need quotation marks. The space between quotations and other things looks a bit weird on my computer.

[Answered] Show text based on item state

17 years ago
But I did leave out a $ before Itemstate. Oops. Should be $ITEMSTATE1