WatchNon-threaded

Forums » Advanced Editor Forum » Read Thread

Talk about it. Ask for help on it. Compliment it.

IF's and PAGETEXT's

9 years ago

 

%POPULATION := %POPULATION * 99/100
 
IF %RESEARCHPT = 0 THEN
$PAGETEXT := " You have not gained any technology yet."
 
IF %REASEARCHPT > 0 THEN
BEGIN
 
IF %COMMERCE = 1 THEN
$PAGETEXT := $PAGETEXT + " You have invested in commerce. This means that you are no longer a bartering system market. Instead you swap smaller goods to replace the bulky goods. You can use paper, metal, seashells, or anything else that is readily handy and in great quantities."
 
IF %STONETOOLS = 1 THEN
$PAGETEXT := $PAGETEXT + " Stone tools are used to make other more useful items. From animal skin pelts to the mining of ore stone tools are what gets the ball rolling to make the higher end items."
 
IF %CLOTHING = 1 THEN
$PAGETEXT := $PAGETEXT + " Clothing shields the wearer from the elements."
 
END
 
The green parts work out fine and do what is intended, the red on the other hand has been giving me problems. REASEARCHPT is a counter, whenever you research a technology it will add 1 to the PT and 1 to the variable given to the specific area of research. The page this is used on is basically a scoreboard on what you have accomplished so far. When I first made the code it would only show one block of text and skip the rest, I then tinkered a little more and with this code nothing shows up. Could really use some clarification.

Code has to:
1. be initiated by 
REASEARCHPT not being zero
2. The block of code has to check all of the variables and add all the ones you have together

Example:

 
 You have invested in commerce. This means that you are no longer a bartering system market. Instead you swap smaller goods to replace the bulky goods. You can use paper, metal, seashells, or anything else that is readily handy and in great quantities.
 
 Clothing shields the wearer from the elements.
 
that would show up if you researched both clothing and commerce

IF's and PAGETEXT's

9 years ago

Would it help if you changed your '= 1' into '> 0' ?

IF's and PAGETEXT's

9 years ago

Also - didn't you have this problem before in an older thread?

Have you tied setting the Variables to show on all pages so you can compare to see if they really = 1 at the time in question?

Setting the Variables to change with a Page Script does not take effect until exiting the page.

Setting the Variables to change with a Link or Item Script takes effect going into the page.

You could also use the %%VARIABLE%=%##%TEXT%% option right on the page if the $PAGETEXT thing isn't working quite right...

 

IF's and PAGETEXT's

9 years ago

the > 0 doesn't affect it, I made the reserchpt variable display on every page and the variables are working fine it still doesn't show up on the page. I think it might be the PAGETEXT variable buggin out, its weird because it works for all the other pages. I didn't think that you could go that route. how would it look like if I swapped it out with the pagetexts? and would it work is the bigger question. I had another idea what might be wrong, there is no text in the document. Would a blank document affect how the text is added to it?

IF's and PAGETEXT's

9 years ago

Having a blank page might be an issue, but I'm not sure. Just put a test line in it to check it out.

You may also have a bad page save. If that is the case, you'll need to re-create the page itself, rerout all your links to the new page and delete the old one...

IF's and PAGETEXT's

9 years ago

You could also try something like this on the page itself rather than in the page Script (note that I altered your Tools Variable Name in this example):

Tech: %%RESEARCHPT%<%1%You have not gained any technology yet.%%%%RESEARCHPT%>%0%See Below.%%

Commerce: %%COMMERCE%<%1%You need to Increase your Tech first…%%%%COMMERCE%=%1%You have invested in commerce. This means that you are no longer a bartering system market. Instead you swap smaller goods to replace the bulky goods. You can use paper, metal, seashells, or anything else that is readily handy and in great quantities.%%COMMERCE%=%2%Etc…%%

Tools: %%TOOLS%<%1%You need to Increase your Tech first…%%%%TOOLS%=%1%Stone tools are used to make other more useful items. From animal skin pelts to the mining of ore stone tools are what gets the ball rolling to make the higher end items.%%%%TOOLS%=%2%Iron tools…%%%%TOOLS%=%3%Bronze tools…%%%%TOOLS%=%4%Etc…%%

Clothing: %%CLOTHING%<%1% You need to Increase your Tech first…%%%%CLOTHING%=%1%Clothing shields the wearer from the elements%%%%CLOTHING%=%2%Etc…%%

IF's and PAGETEXT's

9 years ago

IF %REASEARCHPT > 0 THEN

NOTHING BECAUSE YOU SPELLED RESEARCH WRONG

IF's and PAGETEXT's

9 years ago

Always a good idea to check the spelling of all your Scripting Variables hehe  ;)

IF's and PAGETEXT's

9 years ago

 

%POPULATION := %POPULATION * 99/100
 
IF %RESEARCHPT = 0 THEN
$PAGETEXT := " You have not gained any technology yet."
 
IF %COMMERCE = 1 THEN
$PAGETEXT := $PAGETEXT + " You have invested in commerce. This means that you are no longer a bartering system market. Instead you swap smaller goods to replace the bulky goods. You can use paper, metal, seashells, or anything else that is readily handy and in great quantities."
 
IF %STONETOOLS = 1 THEN
$PAGETEXT := $PAGETEXT + " Stone tools are used to make other more useful items. From animal skin pelts to the mining of ore stone tools are what gets the ball rolling to make the higher end items."
 
IF %CLOTHING = 1 THEN
$PAGETEXT := $PAGETEXT + " Clothing shields the wearer from the elements."
 
 
This is the cleaned up version, It still only reads commerce and ignores everything else, even though the others have been researched. I checked the misspelling and I have consistently misspelled therefore the correct grammar has no effect whatsoever. This is really getting me angry, I tried so many things yet the code refuses to spit out multiple blocks of text.

IF's and PAGETEXT's

9 years ago

It may be that you cannot stack $PAGETEXT := $PAGETEXT + "TEXT" functions.

If not, I would guess that it is because the system adds the "TEXT" part to only the displayed page itself and not to the coded $PAGETEXT. So, it goes through your stack and displays the first additional text, then drops it to display the second additional text, and so on for each block. You're never really changing the hard-coded  $PAGETEXT in the process.

You can probably still do what you want however, with the %%VARIABLE%=%99%TEXT%% Function written directly on the pages.

IF's and PAGETEXT's

9 years ago

I copied and pasted this code into a test game, and it worked. This leads me to believe that either the variables are spelled differently on the variable-page than in the code; or you forgot to actually create them; or they have not been set to 1.

IF's and PAGETEXT's

9 years ago

I stand corrected. You definitely can stack $PAGETEXT's  cheeky

IF's and PAGETEXT's

9 years ago

Why not just add some BEGINs and ENDs to chunk things out nicer.