var/totdmg
var/overallspd // diffence between dodge speed and attack speed
var/atkdmg //attackers damage "grade"
var/atkspd //attackers speed
var/defend //defenders endurance
var/defspd //defenders speed
var/atkgrade
proc/calcgrades()
if(atkdmg== "E")
atkdmg=0
if(atkdmg== "E+")
atkdmg=1
if(atkdmg== "D-")
atkdmg=2
if(atkdmg== "D")
atkdmg=3
if(atkdmg== "D+")
atkdmg=4
if(atkdmg== "C-")
atkdmg=5
if(atkdmg== "C")
atkdmg=6
if(atkdmg== "C+")
atkdmg=7
if(atkdmg== "B-")
atkdmg=8
if(atkdmg== "B")
atkdmg=9
if(atkdmg== "B+")
atkdmg=10
if(atkdmg== "A-")
atkdmg=11
if(atkdmg== "A")
atkdmg=12
if(atkdmg== "A+")
atkdmg=13
if(atkdmg== "S-")
atkdmg=14
if(atkdmg== "S")
atkdmg=15
if(atkdmg== "S+")
atkdmg=16
if(atkspd== "E")
atkspd=0
if(atkspd== "E+")
atkspd=1
if(atkspd== "D-")
atkspd=2
if(atkspd== "D")
atkspd=3
if(atkspd== "D+")
atkspd=4
if(atkspd== "C-")
atkspd=5
if(atkspd== "C")
atkspd=6
if(atkspd== "C+")
atkspd=7
if(atkspd== "B-")
atkspd=8
if(atkspd== "B")
atkspd=9
if(atkspd== "B+")
atkspd=10
if(atkspd== "A-")
atkspd=11
if(atkspd== "A")
atkspd=12
if(atkspd== "A+")
atkspd=13
if(atkspd== "S-")
atkspd=14
if(atkspd== "S")
atkspd=15
if(atkspd== "S+")
atkspd=16
if(defend== "E")
defend=0
if(defend== "E+")
defend=1
if(defend== "D-")
defend=2
if(defend== "D")
defend=3
if(defend== "D+")
defend=4
if(defend== "C-")
defend=5
if(defend== "C")
defend=6
if(defend== "C+")
defend=7
if(defend== "B-")
defend=8
if(defend== "B")
defend=9
if(defend== "B+")
defend=10
if(defend== "A-")
defend=11
if(defend== "A")
defend=12
if(defend== "A+")
defend=13
if(defend== "S-")
defend=14
if(defend== "S")
defend=15
if(defend== "S+")
defend=16
proc/defspds()
if(defspd== "E")
defspd=0
if(defspd== "E+")
defspd=1
if(defspd== "D-")
defspd=2
if(defspd== "D")
defspd=3
if(defspd== "D+")
defspd=4
if(defspd== "C-")
defspd=5
if(defspd== "C")
defspd=6
if(defspd== "C+")
defspd=7
if(defspd== "B-")
defspd=8
if(defspd== "B")
defspd=9
if(defspd== "B+")
defspd=10
if(defspd== "A-")
defspd=11
if(defspd== "A")
defspd=12
if(defspd== "A+")
defspd=13
if(defspd== "S-")
defspd=14
if(defspd== "S")
defspd=15
if(defspd== "S+")
defspd=16
proc/calculatedamage()
totdmg = defend - atkdmg
return
..()
proc/calculateevade()
overallspd = defspd - atkspd
return
..()
// Light damage = 1
// Moderate damage = 2
// Major damage = 4
// Heavy damage = 8
// Instant kill = 16
Problem description:I just want the text input to be transferred to a variable and be calculated later on
If possible contact me on discord Keishi#5713
Associative lists allow you associate a string, type, to any value. This creates key-value pairs:
You can index a list by number, allowing you to convert a number into a string by creating a lookup table:
With the above defines, you can store your stats as numbers, and then show them to the player as grade strings.
Since you are going to be working with the numbers, your game doesn't need to store everything in grades. Just use the numbers, then show the grades to the player based on the number when you build the UI.