I Know how to code, i just need a better explanation where i must add every code to work correctly.
thanks in advance.
Code:
; Float Value as Score
[state 10000, Score value]
type = varset
trigger1 = 1
fvar(0) = 123.456 - floor(123.456) ; "123.456" should be whatever value you want for your score, this is just an example
; Calculate Number of Tenths
[state 10000, Score for Tenths Place]
type = varset
trigger1 = 1
var(0) = floor(fvar(0) * 10) % 10
; Calculate Number of Hundredths
[state 10000, Score for Hundredths Place]
type = varset
trigger1 = 1
var(1) = floor(fvar(0) * 100) % 10
; Calculate Number of Thousandths
[state 10000, Score for Thousandths Place]
type = varset
trigger1 = 1
var(2) = floor(fvar(0) * 1000) % 10
Negatives numbers are as simple as adjusting the limiter and adding a negative operator when the subject variable's value is below 0. Adjusting the explods is up to you.
Hope that helps even further.
Edit:
Eh, I'm generous, so I'll add a watered-down version that displays decimals. Value is based on pos y to give an example of how it works. That's as far as I'm going with this code! Hope it's useful to you all:
Spoiler: Watered-down Version to display Decimals (click to see content)
Code:
;=========================================================================
; Scoring System by RajaaBoy
;=========================================================================
[Statedef 10000]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0, 0
sprpriority = -65536
;========================< Essential State Controllers >========================
; Blank Animations
[state 10000, Change Animation]
type = changeanim
trigger1 = anim != 9999
value = 9999
; Bind to Parent (Optional)
[state 10000, Parent Bind]
type = bindtoparent
trigger1 = 1
pos = 0, -16
; Prevent Getting Hit
[state 10000, Vulnerability]
type = nothitby
trigger1 = 1
value = SCA
time = -1
; Return to This State if Miraculously Hit
[state 10000, Hit Override]
type = hitoverride
trigger1 = 1
attr = SCA,AA,AP,AT
stateno = stateno
slot = 0
time = -1
forceair = 0
;========================< Calculate Score >========================
; Calculate Score
[state 10000, Get Score]
type = varset
trigger1 = 1
fvar(0) = -pos y
;========================< Prevent Score from Going out of Bounds >========================
; Keep Score bewteen 0 and 999
[state 10000, Limit Score]
type = varset
trigger1 = fvar(0) != [0, 999]
fvar(0) = cond(fvar(0) > 999, 999, 0)
;========================< Calculate Decimals >========================
[state 10000, Get Decimal]
type = varset
trigger1 = 1
fvar(1) = fvar(0) - floor(fvar(0))
;========================< Detect Place Values >========================
[state 10000, Score For Ones Place]
type = varset
trigger1 = 1
var(0) = floor(fvar(0) / 1) % 10 ; * 1 ; uncomment to get exact amount of ones
[state 10000, Score For Tens Place]
type = varset
trigger1 = 1
var(1) = floor(fvar(0) / 10) % 10 ; * 10 ; uncomment to get exact amount of tens
[state 10000, Score For Hundreds Place]
type = varset
trigger1 = 1
var(2) = floor(fvar(0) / 100) % 10 ; * 100 ; uncomment to get exact amount of hundreds
;========================< Detect Decimal Place Values >========================
[state 10000, Score For Tenths Place]
type = varset
trigger1 = 1
var(3) = floor(fvar(1) * 10) % 10
[state 10000, Score For Hundredths Place]
type = varset
trigger1 = 1
var(4) = floor(fvar(1) * 100) % 10
[state 10000, Score For Thousandtha Place]
type = varset
trigger1 = 1
var(5) = floor(fvar(1) * 1000) % 10
;========================< Display Score on Screen >========================
; The following code assumes your number fonts have dimensions of 8x8 and are aligned at 0,0 on the axis
; Your air file should have 10 animations that represent numbers 0 - 9 respectively.
; The animations in the air files should be numbered logically. Meaning, they must all have the same basic multiple, like this:
; Sequence A: 10000, 10001, 10002, 10003, 10004, etc
; Sequence B: 10000, 10005, 10010, 10015, 10020, etc
; If you chose Sequence A, then you would simply add the variable that corresponds to the place value for your explod to 10000, like so:
; anim = 10000 + var(2) ; ones place
; If var(2) is 1, then it will add 1 to 10000 and the animation that represents the number 1 will be played.
; If you chose Sequence B, then you would simply multiply the variable that corresponds to the place value for your explod by 5, and then you would add it to 10000, like so:
; anim = 10000 + 5 * var(2) ; ones place
; If var(2) is 1, then it will add 5 to 10000 and the animation that represents the number 1 will be played.
; For this code snippet, we will use Sequence A from above.
; Constantly destroys explods so that their animations can change.
; For Some Reason, modifyexplod doesn't allow the changing of explods' animations
[state 10000, Reset]
type = removeexplod
trigger1 = 1
[state 10000, Ones]
type = explod
trigger1 = !numexplod(0)
anim = F10000 + var(0)
ID = 0
postype = left
pos = cond(teamside = 1, 72, 248), ceil((1.33 * gameheight / gamewidth) * 0) ; top left of screen for player 1, top right for player 2
bindtime = 1
facing = 1
ownpal = 0
sprpriority = -65536
pausemovetime = -1
supermovetime = -1
[state 10000, Tens]
type = explod
trigger1 = !numexplod(1)
anim = F10000 + var(1)
ID = 1
postype = left
pos = cond(teamside = 1, 64, 240), ceil((1.33 * gameheight / gamewidth) * 0) ; top left of screen for player 1, top right for player 2
bindtime = -1
facing = 1
ownpal = 0
sprpriority = -65536
pausemovetime = -1
supermovetime = -1
[state 10000, Hundreds]
type = explod
trigger1 = !numexplod(2)
anim = F10000 + var(2)
ID = 2
postype = left
pos = cond(teamside = 1, 56, 232), ceil((1.33 * gameheight / gamewidth) * 0) ; top left of screen for player 1, top right for player 2
bindtime = -1
facing = 1
ownpal = 0
sprpriority = -65536
pausemovetime = -1
supermovetime = -1
[state 10000, Period]
type = explod
trigger1 = !numexplod(100)
anim = F10000
ID = 100
postype = left
pos = cond(teamside = 1, 77, 253), ceil((1.33 * gameheight / gamewidth) * 4) ; top left of screen for player 1, top right for player 2
bindtime = -1
facing = 1
ownpal = 0
sprpriority = -65536
scale = 0.35, 0.35
pausemovetime = -1
supermovetime = -1
[state 10000, Tenths]
type = explod
trigger1 = !numexplod(3)
anim = F10000 + var(3)
ID = 3
postype = left
pos = cond(teamside = 1, 80, 256), ceil((1.33 * gameheight / gamewidth) * 0) ; top left of screen for player 1, top right for player 2
bindtime = -1
facing = 1
ownpal = 0
sprpriority = -65536
pausemovetime = -1
supermovetime = -1
[state 10000, Hundredths]
type = explod
trigger1 = !numexplod(4)
anim = F10000 + var(4)
ID = 4
postype = left
pos = cond(teamside = 1, 88, 264), ceil((1.33 * gameheight / gamewidth) * 0) ; top left of screen for player 1, top right for player 2
bindtime = -1
facing = 1
ownpal = 0
sprpriority = -65536
pausemovetime = -1
supermovetime = -1
[state 10000, Thousandths]
type = explod
trigger1 = !numexplod(5)
anim = F10000 + var(5)
ID = 5
postype = left
pos = cond(teamside = 1, 96, 272), ceil((1.33 * gameheight / gamewidth) * 0) ; top left of screen for player 1, top right for player 2
bindtime = -1
facing = 1
ownpal = 0
sprpriority = -65536
pausemovetime = -1
supermovetime = -1
;========================< Reset Score System >========================
[state 10000, Destroy Explod]
type = removeexplod
trigger1 = time >= 65535
[state 10000, Destroy Helper]
type = destroyself
trigger1 = time >= 65535
;========================< Debug Information >========================
[state 10000, Display System]
type = displaytoclipboard
trigger1 = 1
text = "Score = %f / %f || RajaaBoy \n"
params = fvar(0), fvar(1)
[state 10000, Display System]
type = appendtoclipboard
trigger1 = 1
text = "Place Values = %d,%d,%d || %d,%d,%d,"
params = var(2), var(1), var(0), var(3), var(4), var(5)