PTR 'and' condition

I’m not sure how to use the ‘and’ condition, could I have some help.

More context is needed, otherwise I can’t help you.

‘AND’ I can’t help you either.

:slight_smile:

I assume you mean the Workshop scripting thing. Mind you, I haven’t used it yet because I’m on console, but the way ‘and’ usually works in programming is that it requires two conditions to be met before the next thing will happen.

nvm, I figured out that when you have multiply conditions, they all have to be true for any action to be executed. But i’m looking for any conditions that are similar to ‘if’ and ‘else’ conditions, because I can’t find anything about it

Look at the pre-made fire doom mode.
You can see there are two conditions, one when the payers are outside the doom and one when they get back inside. It might help.

Found a intro guide on the website, but at a glance it doesn’t look like it goes over every single function in the workshop.

Forum wiki being started that will have all the functions, but not quite yet.

To work with an ‘if’ and ‘else’ conditional method you have to create 2 separate rules with at least one of them having a set condition. Though as my teacher said and I kinda agree with it, using an else could really mess up your code at times, so it’s better and safer to work with multiple if commands unless you have no choice but using an else, which is quite uncommon.

For the main condition of the rule to occur you can use multiple simple ones and have some more within the actions themselves if you’re forced to.

Being fully honest, as much as this tool is powerful, its UI sucks big time for programmers who don’t use scroll down menus, but type their code rather.
It’s definitely nice for console to have this UI, but on PC it’s just not that good, especially when you know that being able to just type your code in is much faster and much more comfortable than what the workshop currently offers.

3 Likes

AND will take in two boolean inputs (true or false values) and output true if both of those inputs are true and false if any or both are false.

I mean, don’t you always use the else statement when no other conditions are met? Like,

if x==y:
print(“X is equal to Y.”)

else if x==z:
print(“X is equal to Z.”)

else:
print(“X is not equal to Y nor Z.”)

I just find using else really useful as a backup response when the user inputs something completely different and unexpected.

It really depends on the situation you’re using this statement in (and I guess sometimes the language as well?). Using those simple mathematical conditions with an else statement in the mix is not really a big issue as it doesn’t affect anything really, but rather when you use this statement in a more complex program where this statement can cause numerous issues just by being there.

nvm, I figured out that when you have multiply conditions, they all have to be true for any action to be executed. But i’m looking for any conditions that are similar to ‘if’ and ‘else’ conditions, because I can’t find anything about it

Think of Conditions as If statements and Actions and Then statements. You’ll be able to find a lot more help in the PTR Feedback forums, that’s where all the Workshop discussion is until it comes to the live servers. Once it’s out there will be a dedicated Workshop forum.

I am working on it as fast as I can…

4 Likes

How did you get permission to film Hammond’s training regimen?

2 Likes

Basically the PTR script is a bunch of conditionals, until the Wiki on the forum is done, what I’d do is look up boolean logic. I’d recommend looking into Python as it’s pretty simple in terms of syntax for a programming language. It’s by no means perfect and if you’re trying to figure out arrays it’s not gonna be much help because arrays are lists in python and lists are different things in different languages, but the main conditionals like If, Else, And, and Or are all represented as well as == and “TRUE” and != and >= and <= things that are basically universal notations are gonna be consistent.

Ooookay so as someone who has a degree in comp sci and has worked in software for 8 years, just wanna point out that “try not to use an else” is not good advice. If and else statements are in practically every piece of code and there’s nothing wrong with the latter. Sometimes you just want to do one thing in a particular case, but any time you want two different sets of commands in opposite cases (eg: if X != 0 divide by X, otherwise do something else), an else statement is completely realistic and common.

To answer the question of how to do if/else in the workshop, you can either:
A) Make 2 rules, one triggered on each distinct case, or
B) Use skipping
Sadly there is no real way to do true else statements in this right now, but if you want to do an if statement in a series of actions, just make a “skip if” action with the inverse case, and have it skip over the number of lines after the skip that aren’t part of your “if”. So from my example above you could have actions:

  1. Skip if (X == 0, 1 line)
  2. Set variable N = 5 / X

So basically your if is “if X isn’t 0”, since you skip that code when it IS 0. Doing an else would basically require another skip for the other case right after this, but if you basically have 2 distinct code paths in the same action that are exclusive to each other, you might just want to make 2 rules.