Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

More About Hidden Text

18 years ago
You know how you go %%VARIABLE%=%1%% or something like that (can't remember off the top of my head)? Is there a way (with scripting or without, it doesn't really matter to me) if you can get text to show between certain numbers? Like if you want to show text saying it is night if TIME is between 20 and 24, can you do that? Also, can you make it so it doesn't work in between 5 and 20?

More About Hidden Text

18 years ago

I hope some of this helps you. In a script, you could say:

IF %TIME >19 THEN
BEGIN
    IF %TIME < 25 THEN
    BEGIN
        $PAGETEXT := $PAGETEXT + "This text is added to the page, if time is between 20 and 24."
    END
END

Note, when mentioning a variable in a script, you simply put one % in front of it, to say it is a variable. Also, if you want to see if 'A' equals 'B', you use the = sign. But if you want to make 'A' equal 'B' you must type := instead, not just =.

If you type the page text as you want it, as you normally would in the page editor's text box, you can then use a script saying $PAGETEXT := $PAGETEXT + "more text" to add the words "more text" onto the END of the page. If you want the "more text" to be at the start, or in the middle of the page, then you need to script all of the words of the page's text.

So, you would need to have a script that read something like:

$PAGETEXT := "type all your beginning text here. Use <br> to start new paragraphs, and html code <b> </b> etc, for formatting your text."

IF %TIME >19 THEN
BEGIN
    IF %TIME < 25 THEN
    BEGIN
        $PAGETEXT := $PAGETEXT + "This text is added to the page, if time is between 20 and 24."
    END
END

IF %TIME >4 THEN
BEGIN
    IF %TIME < 21 THEN
    BEGIN
        $PAGETEXT := $PAGETEXT + "This text is shown instead, if time is between 5 and 20."
    END
END

$PAGETEXT := $PAGETEXT + "Type all the text that comes after your 'variable text' here."

More About Hidden Text

18 years ago
A bit confusing, but I sort of only payed three quarters of my attention, so I'll read over it again. I'm planning to put this on nearly every page.

Thanks Paul.


Tsm.

More About Hidden Text

18 years ago
Also, how do I get it to reset when the counter reaches three and time is at its max of 24? Is there a script I can use to make it rest to zero when the counter reaches three while time is on 24?

More About Hidden Text

18 years ago

IF %COUNTER := 3 THEN
BEGIN
     IF %TIME := 24 THEN
     BEGIN
          %COUNTER := 0
          %TIME := 0
     END
END

Simply check if the first variable is what you want, then insert a check to see if the second variable is what you want, then write what you want it to do. You could keep inserting checks on more and more variables if you wanted. For example, if counter = 3, and if time = 12, and if weather = 3, then show text "it is raining in the middle of the day."

If this is relating to the "changing variables when clicking on a link" question you posted earlier, you would add the above script to your Global Links script.

More About Hidden Text

18 years ago
Also, do you have to include all the tabs, because I've noticed the further down you go, it goes out and in. Do I have to do that? The way you did it was:

IF %COUNTER := 3 THEN
BEGIN
IF %TIME := 24 THEN
BEGIN
%COUNTER := 0
%TIME := 0
END
END

Would it be okay if I just did:

IF %COUNTER:= 3 THEN
BEGIN
IF %TIME := 24 THEN
BEGIN
%COUNTER := 0
%TIME := 0
END
END

More About Hidden Text

18 years ago
Sorry, yeah you don't have to put the tabs in. It works fine without the spaces. I do it by habit, since it makes it easy to see what's going on in the script. (Especially if there's five or more variables being checked, with more than one of them doing stuff.)

More About Hidden Text

18 years ago
Do tabs make a difference to the script at all? Can I put them wherever I want?

More About Hidden Text

18 years ago
Actually, in the editor, TAB doesn't work - in internet explorer, it moves the cursor to the next active window or object. So, I've got to press the space bar three or four times to indent things. Groups of spaces don't make any difference to the script. You can also press ENTER to put gaps between lines, as much as you want.

More About Hidden Text

18 years ago
The thing isn't working.. you know, the hidden text. Do I need to put it on HTML or something?

More About Hidden Text

18 years ago
I got it!

More About Hidden Text

18 years ago
It isn't working.. I've got it set on the page Marsage, with this page script.

IF %TIME <12 THEN
BEGIN
   IF %TIME >6 THEN
   BEGIN
IF %WEATHER <2 THEN
BEGIN
      $PAGETEXT := "The morning air soothed Riraneit. He felt instant relief, and any worries about his amnesia disappeared easily. He looked around and saw the newborn sunlight illuminate the village into a pretty  town, like in a masterpiece of a painting. He shook his head, and just in time, too. The picture entering his mind could have kept him frozen with awe until nightfall thawed him."
   END
END
END



IF %TIME <12 THEN
BEGIN
   IF %TIME >6 THEN
   BEGIN
IF %WEATHER = 2 THEN
BEGIN
      $PAGETEXT := "The morning air soothed Riraneit. He felt instant relief, and any worries about his amnesia disappeared easily. He looked around and saw an ordinary looking town, the clouds overhead blocking any sunlight from creating beauty."
   END
END
END



IF %TIME <12 THEN
BEGIN
   IF %TIME >6 THEN
   BEGIN
IF %WEATHER = 3 THEN
BEGIN
      $PAGETEXT := "The morning air soothed Riraneit, although the pitter patter of the rain kept him from feeling any better. As the clouds spat on him, he decided that he would enter somewhere before he was drenched in water."
END
END
END


IF %TIME <16 THEN
BEGIN
   IF %TIME >11 THEN
   BEGIN
IF %WEATHER <2 THEN
BEGIN
      $PAGETEXT := "The warm afternoon sun beat down on Riraneit's back. It felt good, but if he stayed out for too long he could probably end up getting too hot in his clothes, preventing him from getting a good night sleep later on. The sun shown directly overheard, creating hardly any shadows in the town square of packed dirt."
END
END
END



IF %TIME <16 THEN
BEGIN
   IF %TIME >11 THEN
   BEGIN
IF %WEATHER = 2 THEN
BEGIN
      $PAGETEXT := "The clouds blocked out the sun from changing the temperature, keeping it the same as the morning - no notable beauty. In the town square, which was made of packed dirt, there were many buildings surrounding him. Riraneit studied them with his eyes and wondered how the village came to be."
END
END
END



IF %TIME <16 THEN
BEGIN
   IF %TIME >11 THEN
   BEGIN
IF %WEATHER = 3 THEN
BEGIN
      $PAGETEXT := "Although it was the middle of the day, it was pouring and nobody really felt like enjoying it. <i>I'd better get inside soon,</i> Riraneit thought."
END
END
END



IF %TIME <20 THEN
BEGIN
   IF %TIME >15 THEN
   BEGIN
IF %WEATHER <2 THEN
BEGIN
      $PAGETEXT := "The heat was beginning to cool off as sundown grew near. The sunset was spectacular. The sky was scatted with red, orange, pink and yellow, and the way the buildings were positioned gave him a perfect view."
END
END
END




IF %TIME <20 THEN
BEGIN
   IF %TIME >15 THEN
   BEGIN
IF %WEATHER = 2 THEN
BEGIN
      $PAGETEXT := "It was a bit cloudy, but Riraneit could just see through the clouds the sun setting in the distance. Although he could only peek at the small part he could see, Riraneit felt like he could gaze at it for hours."
END
END
END



IF %TIME <20 THEN
BEGIN
   IF %TIME >15 THEN
   BEGIN
IF %WEATHER = 3 THEN
BEGIN
      $PAGETEXT := "It was raining at the time, and Riraneit couldn't see a sunset at all. In fact, all the rain clouds made it hard to tell whether it was dusk at all."
END
END
END



   IF %TIME >19 THEN
   BEGIN
IF %WEATHER <2 THEN
BEGIN
      $PAGETEXT := "It was a clear night, and nothing disturbed the stars piercing the velvet sky. All was peaceful as everybody began to return to their homes to drift to sleep."
END
END



   IF %TIME >19 THEN
   BEGIN
IF %WEATHER = 2 THEN
BEGIN
      $PAGETEXT := "It was a cloudy night, and the darkness made the clouds look like huge lumps of coal that perched in the sky. Nearly everybody had returned to their homes by now."
END
END




   IF %TIME >19 THEN
   BEGIN
IF %WEATHER = 3 THEN
BEGIN
      $PAGETEXT := "It was extremely cold at night. The rain probably helped it. It bucketed down and didn't look like it was going to stop anytime soon. Riraneit had to get inside somewhere to keep warm, or sleep."
END
END



   IF %TIME <7 THEN
   BEGIN
IF %WEATHER <2 THEN
BEGIN
      $PAGETEXT := "The early morning didn't at all help the fact that the weather was cold. Riraneit could hardly see where he was going, let alone at all. At this point most of Marsage was probably asleep. At least he had the stars to guide him, if that helped in this town at all."
END
END



IF %TIME <7 THEN
   BEGIN
IF %WEATHER = 2 THEN
BEGIN
      $PAGETEXT := "The early morning didn't at all help the fact that the weather was cold. Riraneit could hardly see where he was going, let alone at all. At this point most of Marsage was probably asleep. He didn't even have the stars in the sky to guard him, due to the cloudiness."
END
END



IF %TIME <7 THEN
   BEGIN
IF %WEATHER = 3 THEN
BEGIN
      $PAGETEXT := "The early morning didn't at all help the fact that the weather was cold, and the rain just filled up Riraneit with it. He could hardly see where he was going, due to the fact that it was pitch black and the rain wet his hair, making him unable to brush the hair out of his eyes without getting it pushed down again. He didn't even have the stars in the sky to guard him, due to the cloudiness."
END
END

And I've got a test link on the Marsage page (I used the editing password system I made to get there, so the time is automatically at 0) which is Time +1, and another which is Weather +1 to see the different hidden text, but nothing happens when I click on the links. Have I done something wrong, because the validation didn't show up with anything.

More About Hidden Text

18 years ago

There is nothing wrong with the script. I copied and pasted your post into a blank game, with just your script on a page, and a link that added +1 time every time I click on it, and another that changed the weather variable when I clicked on it, and they both worked perfectly.

My only thought is, have you gone to the Story Properties page, and down to [Change Editor Features], and made sure that Scripting and Variables are both set to Advanced.

More About Hidden Text

18 years ago
Ah. I forgot to tick the Count Multiple box.

More About Hidden Text

18 years ago
Working great, although the:

$PAGETEXT := $PAGETEXT + "<br><br>Vitality:%%HP%%/%%MAXHP%% <br> Mentality: %%MP%%/MAXMP%%"

I put on the page script doesn't show the variables. Instead it shows the actual %%HP%% stuff.. is this supposed to happen, and is there any way of fixing it?

More About Hidden Text

18 years ago

In scripts, you always refer to variables directly, and use the format %VARIABLE.

So, in the above script, you could have:

$PAGETEXT := $PAGETEXT + "<br><br>Vitality: " + %HP + "/" + %MAXHP
$PAGETEXT := $PAGETEXT + "<br>Mentality: " + %MP + "/" + %MAXMP

I usually put things that are on different lines as their own script line, so I get an idea of the page's layout. However, you can also lump it together on one line, using another + sign, like this:

$PAGETEXT := $PAGETEXT + "<br><br>Vitality: " + %HP + "/" + %MAXHP + "<br>Mentality: " + %MP + "/" + %MAXMP

By typing the + sign, you're telling it to add whatever follows the + sign onto whatever you've typed so far. Whenever you tell it to + a variable onto $PAGETEXT, it will display the current value of that variable at that spot on the page.