It looks like you're new here. If you want to get involved, click one of these buttons!

jay_
Posts: **5**Member, BASIC

Hi guys,

I have some logic in place at the moment that works pretty well which basically detects when a player has successfully reached a certain point with no mistakes, however its quite weighty with stacks of rules. All I want is when player reaches a point display text saying x2, x4, etc. I'm pretty sure there is a way of doing the whole with expression editor in the text behaviour. It could look something like this " i know this is wrong but need help fixing it" (game.score≥5 and ≤10)and("x2")or(0),(game.score≥11 and ≤20)and("x4")or(0) ...

any ideas would be great thanks

0

## Comments

10,782Member, Sous Chef, PRO, Senior Sous-ChefCan you provide a screenshot of your current rule(s) for this? I'm unclear whether you're asking how to create a rule condition or how to display text using a complex expression.

5Member, BASICYeah sorry could of worded this better, the rules I have in place just display text, i.e

when game score is ≥ 10

when game score is ≤ 20

Display text "x2"

if i did this for x4,x6,x8 its a lot of rules

I would prefer to do this all with the display text expression editor i'm just bit stuck with the math. This is what i tried buts its not working...

12,540Member, PROWhat are the conditions for x4, x6 and x8 ?

1,890MemberIf you are asking whether you can have the conditions and result in one and the same expression box, then the short answer is no.

Doing it for x4, x6 and x8 means three sets of rules? That doesn't seem like particularly that much...

12,540Member, PROIf there is a mathematical relationship between the conditions and the result then you could encapsulate that in a single expression. (if I understand the question)

1,890MemberYes, that is true. If it isn't arbitrarily set, but there is a mathematical relationship between the two, it's possible.

5Member, BASICok so if I can only use one condition in the text expression, say.. the x2. in my example I attached, It only says when the score = 5, i've tried inputing an in-between like ≥10 ≤20, but I can't seem to get the math right this is what I write but I have no luck with it.

(game.comboStreak=≥10≤20)and("2")or("0"))

Is it possible to do this ?

12,540Member, PROIf it is possible, then the maths will be specific to your particular set up.

What are the conditions for x4, x6 and x8 ?

1,890MemberIf it is set arbitrarily, then no, you need the separate conditions (Rules). I still don't understand what your problem is to have several of them.

What you can do in the expression editor, is to use a

mathematicalrelationship.For example --

`set: game.multiplier to: floor(game.comboStreak/10)*2`

This will give you a x2 multiplier for 10-19 Streak, a x4 multiplier for 20-29 Streak, a x6 multiplier for 30-39 Streak, etc.

10,782Member, Sous Chef, PRO, Senior Sous-ChefWhat you can do is set up a table with rows like this:

[text]

x2

x4

x6

x8

...

Then in your Display Text expression figure out a mathematical way to determine which row to use in a tableCellValue function. @pHghost's example right above might do the trick.

In that example, it might look something like this:

Display Text: tableCellValue(tableName, floor(game.comboStreak/10), 1)

Edit:and if all you actually need to display is "x2" or "x4" and nothing else, you don't even need a table:Display Text: "x"..floor(game.comboStreak/10)

I guess that's what @pHghost was suggesting with game.multiplier which would then go in your Display Text expression.

2,697Member, Sous Chef, PRO@jay_

Yes you can do this. The expression would be something like:

`Change Attribute: game.myDisplayText To: (((game.score>5)and(game.score<10))and"x2")or((( game.score >11)and(game.score <20))and"x4")or"0"`

Be sure to use the pull down menu to specify game.score. (Don't just type it in. And don't copy/paste the above expression.)

Hopefully you can extrapolate what you want from the above expression. But if not, just give us the intended logic and I am sure we will be able to build a functional expression for you.

Edit:

I could not get GameSalad to accept the symbols "≤" or "≥" (at least on my keyboard). You may be stuck using "<" and ">" instead.

4,382Member, PROThis might help.