Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Making a sentence depend from two variables

10 years ago

If I want to set two conditions for a sentence to be shown in a page, how should I do it?
Let's say I want the character to name either his daughter as heiress, or his son as heir (simple word being replaced), but only if he earned a demesne from the king first (the whole sentence should disappear if the character did not earn it).
I like this page a lot, but it is hard to understand the help sometimes, not being an english speaker and all.

Making a sentence depend from two variables

10 years ago

%%FEMALE%=%1%heiress%%%%MALE%=%1%heir%% - then if you don't want them to show up, add one to the variable until they earn the title, where you decrease the value to 1. If you have other areas that depend on only gender but you havn't yet earned the title, then %%FEMALE%>%1%she%%%%MALE%>%1%he%% (I think I did that correctly - if the value is greater than 1 for female, then show 'she', if the value is greater then 1 for male, then show 'he')

On page variable trick version. I'll post the $PAGETEXT version in just a moment - though that way is a bit glitchy.

Making a sentence depend from two variables

10 years ago

But those are words depending on a single variable, Taco. He's talking about using scripting to make it depend on two variables specifically, not one. I'm not 100% sure you can do that with on-page, in fact, I'm almost positive you can't.

Making a sentence depend from two variables

10 years ago

I know, but you can have one variable go for multiple different things. If female = 1, hieress. If female = 2, blank. If female > 0, she. He could have the variable value start at 2, and then when he earns the thing, lower the value to 1.

Making a sentence depend from two variables

10 years ago

Ah. Well, that's true. I'm not denying that your method works, it just doesn't work in the way s/he specifically asked for. I suppose it depends on what's easiest on a personal basis and what all you plan to do.

Making a sentence depend from two variables

10 years ago

I'll show you what I do:

Let's say my character is going on a mission. Now, in this mission, they can either try to knock out a guard or sweet talk them. What I want the text, then, to depend on would be the stats they need to succeed with either action AND the action they took. Sure, I could make multiple pages, but let's say I want it all on one page.

Well, let's make a variable to represent their choice, such as CHOICE. If CHOICE = 1, then their character is going to knock out the guard. If CHOICE = 2, then their character is going to sweet talk the guard. Let's make POWER and AGILITY for their "knock out guards" status. Let's say it takes no less than 15 points in POWER and no less than 10 points in AGILITY, and for sweet talking a guard, you need 15 points in CHARISMA and 20 points in SEDUCTION.

Got it? In the script for the page, you'd put something like this:

IF CHOICE = 1 THEN
IF POWER >= 15 THEN
IF AGILITY >= 10 THEN
BEGIN
$PAGETEXT := "You creep up behind the castle guard and bash him on the back of the head. He falls to the ground and you take his gold. <p>&nbsp;</p>
Now that you're done here, you move on to the next guard. Yay! <p>&nbsp;</p>"
END

BUT, if you want text that's written on the actual page to display, you must add + $PAGETEXT after that second quote. Also, if you want characters to talk within your scripting, you must use two single quotes, no double quotes except the ones surrounding your pagetext.

ALSO, you'll want to make an alternative text for if they don't have those stats...

IF CHOICE = 1 THEN
IF POWER < 15 THEN
IF AGILITY < 10 THEN
BEGIN
$PAGETEXT := "You creep up behind the castle guard and try to bash him on the head, but you are too slow and he catches you and runs you through. <p>&nbsp;</p>
You are dead. <p>&nbsp;</p>"
END

And so on, with sweet-talking the guard. This can be done with as many variables as you damn well please. Also, if you're wondering what <p>&nbsp;</p> means, it's a spacer so you don't wind up with a huge, ugly block of text.

Making a sentence depend from two variables

10 years ago
You know you can just do [/br] (with < and > instead of []), for a line break, right?