setting variable to an arithmetic

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Iowa

Member
Jun 4, 2017
1
0
0
23
Skript Version: Skript 2.2-Fixes-V8b
Skript Author: me
Minecraft Version: 1.8.8
---
Full Code:

variables:
{kills.%player%} = 0
{deaths.%player%} = 0
{streak.%player%} = 0
{worthv5.%player%} = ({kills.%player%} / {deaths.%player%}) * 5


the error is in the worth line and i cant quite get what the problem is, am i not allowed to have an equation as a variables value?
basically im doing this so i dont have to set worthv5 to kills/death x 5 everytime they check /stats or get a kill.
 
@aescraft your code doesn't work for me.

@Iowa why are you trying to set variables with %player% here? There's no %player% being filled in so all your variables are just {variable.<none>}.

Also, what do you mean by "im doing this so i dont have to set worthv5 to kills/death x 5 everytime they check /stats or get a kill."? Defining a variable in the variables section doesn't make it magically update itself. You still need to update {worthv5.%player%} every time they get a kill.

If you mean that you don't want to write this line multiple times in a script then use options. Example:

code_language.skript:
options:
    worthv5.%player%: ({kills.%player%} / {deaths.%player%}) * 5

#then when you use {@worthv5.%player%} it will replace it with ({kills.%player%} / {deaths.%player%}) * 5
 
Status
Not open for further replies.