Category: calculation
Suggested name: formula
What I want:
Hey there i have made a advanced formula skript but i think it could be done more efficiently.
What it needs to do is calculating multiple binary values to 1 binary result.
Calculation posibilties:
* = and
+ = Or
`=not
()=bracketing
0=binary 0
1=binary 1
Let me explain what these posibilities can do.
if you look at the formula 1*1+1 this will result in a 1 Why? a*(and)b+(or)c = ? so a and b both need to be 1 to go trough OR only c needs to be 1. so 1*0+0=0, 1*1+0=1, 0*1+0=0, 0*1+1=1, 0*0+1=1.
Another value is the not value. The not value just inverts the value so 1`*1=0 because of the not it is actualy 0*1=0.
These formula's are still very basic and can get quite big like this one. a*b+c*d*e`*f+g.
But now i want to add bracketing. Bracketing is the same as math. Brackets go first. so things like this: a*(b*(c*d+e*f)*g*(h+i*j)).
Hope someone understands and is in for a challenge!
Uhm if you need a direct here you have a piece of code that does all the features except bracketing.
Ideas for commands:
command /fomula <text>:
Ideas for permissions:
<none>
When I'd like it by: A reasonable time
Suggested name: formula
What I want:
Hey there i have made a advanced formula skript but i think it could be done more efficiently.
What it needs to do is calculating multiple binary values to 1 binary result.
Calculation posibilties:
* = and
+ = Or
`=not
()=bracketing
0=binary 0
1=binary 1
Let me explain what these posibilities can do.
if you look at the formula 1*1+1 this will result in a 1 Why? a*(and)b+(or)c = ? so a and b both need to be 1 to go trough OR only c needs to be 1. so 1*0+0=0, 1*1+0=1, 0*1+0=0, 0*1+1=1, 0*0+1=1.
Another value is the not value. The not value just inverts the value so 1`*1=0 because of the not it is actualy 0*1=0.
These formula's are still very basic and can get quite big like this one. a*b+c*d*e`*f+g.
But now i want to add bracketing. Bracketing is the same as math. Brackets go first. so things like this: a*(b*(c*d+e*f)*g*(h+i*j)).
Hope someone understands and is in for a challenge!
Uhm if you need a direct here you have a piece of code that does all the features except bracketing.
Code:
command /formula <text>:
trigger:
set {_val} to arg 1
replace every "0`" with "1" in {_val}
replace every "1`" with "0" in {_val}
set {_l::*} to {_val} split at "+"
loop {_l::*}:
if loop-value doesn't contain "0":
message "1"
stop
message "0"
Ideas for commands:
command /fomula <text>:
Ideas for permissions:
<none>
When I'd like it by: A reasonable time