Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

How do you code "and/or"?

5 years ago

So, I get that for coding for one number goes:

%%BOB%=%1%"Hi, I'm Bob!"%%

But what if it was for more than one number? Would it be:

%%BOB%=%2,3,4,5%"Who the fuck is Bob?"%%

Or:

%%BOB%=%2%3%4%5%"Who the fuck is Bob?"%%

Or would you have to do them all individually, like:

%%BOB%=%2%"Who the fuck is Bob?"%%%%BOB%=%3%"Who the fuck is Bob?"%%%%BOB%=%4%"Who the fuck is Bob?"%%%%BOB%=%5%"Who the fuck is Bob?"%%

How do you code "and/or"?

5 years ago
I don't usually do that work in the page code, but I'm pretty sure that has to be the last one, all individually.

How do you code "and/or"?

5 years ago
Yeah think you're gonna want to bust out the $PAGETEXT for this one...

How do you code "and/or"?

5 years ago

... I vaguely remember using $PAGETEXT once... But I can't for the life of me remember what it is or how it works. sad

How do you code "and/or"?

5 years ago
%%BOB%>%0%"Hi, I'm Bob!"%%

Would be for any number greater than 0.

%%BOB%<%15%"Hi, I'm Bob!"%%

Would be for any number under 15.

%%BOB%!=%7%"Hi, I'm Bob!"%%

Would be for any number that is not 7.

Etc, etc.

How do you code "and/or"?

5 years ago
Does AND not work with $PAGETEXT? Because I can't get AND working with $PAGETEXT and I feel dumb, but also annoyed. This definitely seems like a bug you should've fixed already, Killa. But seriously without AND wouldn't it be a problem with, for instance, %BOB not equaling 7 while also being lower than 15?

How do you code "and/or"?

5 years ago
No idea what you mean. Pagetext is a variable and AND is for logical comparison, so you shouldnt be using the two of them together to begin with.

On page scripting is too stupid to handle ANDs. You'd have to add logic ahead of time (with normal scripting) and make the variable a certain value to represent the logical comparison you want to make.

Next build will address you feeling stupid by having a compliment pop up whenever you make a save to a script.

How do you code "and/or"?

5 years ago
Ugh first Ogre, now you. How are we supposed to get bug fixes when both of you are always wandering around confused? I don't really use $PAGETEXT much because I prefer on page, but... IF %BOB > 0 AND %BOB < 7 THEN $PAGETEXT := $PAGETEXT + "Bob is both greater than zero and less than seven. At the same time. Imagine that." I mean if it doesn't work it doesn't work, but I don't really see how it's all that weird to expect it to when you can do the exact same thing in other places, like with link restrictions.

How do you code "and/or"?

5 years ago
IF %BOB > 0 THEN
IF %BOB < 7 THEN
$PAGETEXT := $PAGETEXT + "Bob is both greater than zero and less than seven. At the same time. Imagine that."

For some reason AND itself isn't liked by the editor, but doing this works.

How do you code "and/or"?

5 years ago
Uggggh. Well at least it does work, just not in a way I would've ever tried. I'll consult Lar on who should be blamed for the broken AND.

How do you code "and/or"?

5 years ago
I mean, i also just tried doing:

IF %A = 2 AND %B = 3 THEN
BLAH BLAH BLAH

And it worked in the editor, so...

EDIT:
Right now i remember the issues. It's that the editor doesnt like you comparing the same variable twice.

IF %A > 1 AND %A < 3 THEN
BLAH BLAH BLAH

Didn't work.

How do you code "and/or"?

5 years ago
Well that's even stupider!

How do you code "and/or"?

5 years ago

In my experience, it's that AND, OR, and NOT break unless all of their operands are either = or != comparisons. Otherwise, AND and OR return 0 and NOT returns the operand unaltered.

How do you code "and/or"?

5 years ago
Hmm, yeah it was probably that. Spent so long avoiding that problem i forgot the original reason it was breaking lol.

How do you code "and/or"?

5 years ago

Thanks Killa ^_^

Don't suppose there's anyway to do it as part of a list? Like, 1 and 3 do one thing, but 2 and 4 do something else?

How do you code "and/or"?

5 years ago
Can you add external logic so it ACTS like that? Yes.

But like I mentioned above, it's too stupid to handle ANDs/lists on its own. If you have something you're trying to do specifically and need help with it I can give advice.

How do you code "and/or"?

5 years ago

Thanks Killa... But seeing how complicated everything is, I think I'm just going to do it individually. There's only 4 numbers in the sequence anyway. cheeky

How do you code "and/or"?

5 years ago
I mean, if there's only possibilities yeah, that isn't much of an issue lol.