Main Menu
  • Welcome to The RPG Maker Resource Kit.

[Solved] Code for "and"

Started by yuyu!, September 06, 2015, 03:55:32 PM

0 Members and 1 Guest are viewing this topic.

yuyu!

Hopefully this is a quick question. ;9

I know that || is "and/or", but is there a way to just say "and" in RGSS3?




I want to use script calls to combine and simplify the conditional branches for my time events, like so:

$game_variables[12] == 8 || $game_variables[11] >= 30 || $game_variables[11] <= 40

Variable 12 = Hour and Variable 11 = Minute. So, the condition is supposed to occur between 8:30 and 8:40. The only thing not working about that is the || means "and/or" and runs the events even when all three aren't met. ;9

[Spoiler=My Games and Art]
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]

[/Spoiler]

Irock


yuyu!

Ahhhh! That's perfect, thank you!! :gracie:

I tried "&" to no avail. Didn't think about "&&". ;o

[Spoiler=My Games and Art]
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]

[/Spoiler]

Irock

Yeah it's doubled like == and || (though I never understood why > and < are single characters)

Acolyte

#4
They're doubled because single equal signs are usually used to assign variables. The other singular signs most likely have different uses as well.
In C and C++, << and >> are used as bit shifts. I don't know if it's a common thing in other languages. It seems like bitwise operations are more on the extreme technical side of things.

yuyu!

Quote from: Irock on September 06, 2015, 05:34:51 PM
Yeah it's doubled like == and || (though I never understood why > and < are single characters)

Ohhh, duh! I can't believe I missed that! :sadmoonfacefromthatthreadss:

Quote from: Acolyte on September 06, 2015, 05:52:10 PM
In C and C++, << and >> are used as bit shifts. I don't know if it's a common thing in other languages. It seems like bitwise operations are more on the extreme technical side of things.

That's right, I did notice that from my C++ class. :D I didn't know exactly what it meant until now, though.

[Spoiler=My Games and Art]
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]

[/Spoiler]

pacdiggity

you could also write 'and' if you're feeling boring
it's like a metaphor or something i don't know

yuyu!

Quote from: paccles on September 06, 2015, 11:21:53 PM
you could also write 'and' if you're feeling boring

huh? That's a thing? o.o

Just curious, but...does this mean there is also a code for just plain "or"?

[Spoiler=My Games and Art]
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]

[/Spoiler]

pacdiggity

there are some very slight differences, but yes. several english syntax words spill in to ruby syntax - 'if,' 'then,' 'wait,' 'end,' for example. conjunctions like 'and' and 'or' do exactly what you'd think. in some senses writing some lines of code can be like writing a sentence. don't expect the interpreter to understand the socio-political implications of your prose though.
it's like a metaphor or something i don't know

Roph

[fright]bringing sexy back[/fright]

yuyu!

Oh, neat! I tried "or" and it works. :-) Pretty rad!

[Spoiler=My Games and Art]
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]

[/Spoiler]