i need to make it so that a piece of text shows up when a variable is at a certain number and a switch is activated
MV (srd hud maker) how do i use more than one condition
Javascript/Plugin Supportit depends on whzat exactly the function expects as a return, but in case of a simple true/false logic you should be able to chain conditions with the logic AND:
(condition 1) && (condition 2) && (condition 3)
Dont't forget the () they are also important
(condition 1) && (condition 2) && (condition 3)
Dont't forget the () they are also important
JavaScript:
($gameVariables.value(n) > 5 && $gameSwitches.value(x)) ? "When true text" : "When false text"
depends how the text is show, you can do also do if show text by variable:
$gameVariables.setValue(n, "text here") on the true and false part.
which might be easier if you show text by that varariable(n).
this was what i had to do, thank you!
Just as a technical point, they're almost certainly not necessary.
In JavaScript, boolean operators have a lower order precedence than all other non-assignment operators. The only things the OP might be using where parentheses would make a difference are boolean OR and ternary operators (which aren't there, from the OP's description of the condition).
But, of course, they don't hurt anything, and I suppose it's possible the OP copied a condition from someplace that does have one of those two things. 🙂
assuming that i don't need to make another thread, i have another question that is just this but slightly different
how do i use a condition that requires two switches to be on, i tried doing this with andar's thing but it just resulted in an error
how do i use a condition that requires two switches to be on, i tried doing this with andar's thing but it just resulted in an error
Please show a screenshot of what you did. What Andar described is a correct way of doing it
then you did something wrong when writing the conditions, most likely a typo.
and please remember: we cannot help you (or anyone else) finding an error if you don't show us what you have done - which means screenshots of your entries, and possible screenshots of the error message.
Because even if you yourself don't understand an error message, it will tell a programmer what you did wrong.
as it turns out, it was a typo
i don't know what i typed in wrong but at least it works now!!
Original thread: https://forums.rpgmakerweb.com/threads/srd-hud-maker-how-do-i-use-more-than-one-condition.170045/