News:

MFG's Character of the Month: October 2026 Voting

Main Menu

Time detection problems...

Started by FerchogtX, April 10, 2008, 06:03:00 PM

Previous topic - Next topic

FerchogtX

Hi again folks!

Well, I'm here now with a new thing to solve... in my main "permanent" helper everything goes well now, except that I need to detect some time issues.

using a DisplaytoClipboard sctrl I discovered that root's time is detected only from 1 to above (for example time = 1, 2, 3, etc...), I'm wondering if there is a way to detect root's time = 0 and time = -1 (if posible this last one) in the helper, it's active all the time so that is not the problem by now :D

Any help will be much apreciated.

Thanks in advance.

See ya!!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

Bastard Mami

I hope this comes helpful, becuase I can't look into your current problem currently.

mugen's code will be executed like this.

once a tick starts.
First any helper code will be checked, in ID order, once the helpers are done it starts with the players, again in Id order.
the code by itself is checked like this.
first st-3, then st-2, then st-1, then the current state, if that state changes to another state that state is checked imediately whitout re-checking any negative states.

FerchogtX

Maybe that can help... if you can point me out more stuff I will grateful.

Reading this... maybe if I place the main helper in statedef -3... the helper can chech root, time = 0 or time = -1?

See ya!!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

Bastard Mami

time= 0 does not exist for negative states, but -1 kind of does. you have to be knowledgeable about your character's code and guess what will the next state can be; that does not seem to be the problem with you.

trying to explain the next part more in detail.

first st-3, then st-2, then st-1, then the current state, if that state changes to another state that state is checked imediately whitout re-checking any negative states that is when time = 0; after that the checking restarts and the first time the -X states see your current state is when time = 1.

You might have to use parent, animtime=0 to detect when time is going to be 0, since you know the parent will change to the next state when animtime=0 ( the next state being state 0,50, etc...).

FerchogtX

Well... seems logical, maybe that can be useful to get the time = 0 for the helper, because the way I have the code, for example fails on counting hits when hitpausetime < anynumber below 10...

If there is something more specifical... I will be glad, maybe posting my code should help a bit:
; =================================================================================== ;
;            Full Game Features Section (DO NOT OVERRIDE unless you know              ;
;            what are you doing. This will add extra features to your                 ;
;            chars. THANKS TO: Messatsu for discovering this.                         ;
; =================================================================================== ;

; ========================================================================
;Main System Helper (Controls many aspects for a full game)
[StateDef 1337000000]
anim = 1337000000
ctrl = 0

[State MS - X, IX]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible

[State MS - 01]
type = turn
trigger1 = facing != root, facing

;;;;;;;;;;;;;;; Feature 1: Combo Messages ;;;;;;;;;;;;;;;;
; --------------------------------------------------------
; Original by Ryou Win - Used vars for this feature: 5
; - var(1) *** Special var for First Attack (avoids var reset if intro skipped)
; - var(2) *** Ground Hit Count
; - var(3) *** Aerial Hit Count (buggy)
; - var(4) *** Danger Var
; - var(5) *** PlaceHolder for Counter and Danger vars
[State -4, FA - Initial Value]
type = VarSet
trigger1 = (var(1) != 1) && (roundstate <= 2)
trigger2 = (var(1) = 1) && (roundstate < 2)
var(1) = -1

[State -4, FA - Active]
type = VarSet
trigger1 = (NumExplod(9500)) && (var(1) = -1)
var(1) = 0

[State -4, FA - Done]
type = VarSet
trigger1 = (var(1) = 0) && (roundstate >= 2)
trigger2 = (enemynear, MoveHit) && (var(2) = -1)
var(1) = 1
;----------------------------

[State -4, HitCount PlaceHolder]
type = VarSet
trigger1 = var(2) >= 3
trigger2 = (var(2) = -1) && (root, MoveHit || partner, MoveHit)
var(5) = 1 + (var(2) > 4) + (var(2) > 5) + (var(2) > 7) + (var(2) > 9) + (var(2) > 29) + (var(2) > 49) + (var(2) > 69) - (var(2) = -1)

[State -4, Aerial HitCount PlaceHolder]
type = VarSet
triggerall = root, var(17) = [20, 21]
trigger1 = var(3) > 1
var(5) = 10

[State -4, Danger On]
type = VarSet
trigger1 = (var(4) != 1) && (roundstate = 2) && (root, life = [1, 250])
var(5) = 9
;----------------------------

[State -4, FA - Danger Sound]
type = PlaySnd
triggerall = (var(2) = -1) && (!NumExplod(9500))
trigger1 = (var(5) = 9) && (var(4) = 0) && (root, life > 0)
trigger2 = (var(2) = -1) && (root, MoveHit || partner, MoveHit)
value = f(ifelse((root, var(17) = [10, 11]), 230, 9500)), 0
volume = 255

[State -4, Combo Sounds]
type = PlaySnd
trigger1 = (!NumExplod(9500)) && (var(2) = 0 && var(5) != 0)
value = f(ifelse((root, var(17) = [10, 11]), 230, 9500)), ifelse(var(5) > 9, 11, var(5))
volume = 255

[State -4, Combo Message (left)]
type = Explod
triggerall = TeamSide = 1 && !NumExplod(9500)
trigger1 = var(2) = 0 && var(5) != 0
trigger2 = (var(2) = -1) && (root, MoveHit || partner, MoveHit)
trigger3 = (var(5) = 9) && (var(4) = 0) && (root, life > 0)
anim = f((ifelse((var(17) = [10, 11]), 230, 9500)) + ifelse(var(5) > 9, 30, var(5)))
ID = 9500
postype = left
pos = 0, 80
ontop = 1
ownpal = 1
bindtime = -1
removetime = 60
supermovetime = 60
pausemovetime = 60
scale = 0.5,0.5

[State -4, Combo Message (right)]
type = explod
triggerall = TeamSide = 2 && !NumExplod(9500)
trigger1 = var(2) = 0 && var(5) != 0
trigger2 = (var(2) = -1) && (root, MoveHit || partner, MoveHit)
trigger3 = (var(5) = 9) && (var(4) = 0) && (root, life > 0)
anim = f((ifelse((var(17) = [10, 11]), 240, 9510)) + ifelse(var(5) > 9, 21, var(5)))
ID = 9500
postype = right
pos = -1, 80
ontop = 1
ownpal = 1
bindtime = -1
removetime = 60
supermovetime = 60
pausemovetime = 60
scale = 0.5,0.5
;----------------------------

[State -4, Main HitCount]
type = VarAdd
trigger1 = (enemynear, time = 1) && (enemynear, HitShakeOver = 0)
var(2) = 1 + (var(2) = -1)

[State -4, Main HitCount (Aerial Rave)]
type = VarAdd
triggerall = (Root, HitDefAttr = A, NA, SA, HA) || (Partner, HitDefAttr = A, NA, SA, HA)
trigger1 = (enemynear, time = 1) && (enemynear, Hitshakeover = 0) && (enemynear, statetype = A)
var(3) = 1

[State -4, Reset HitCount]
type = VarSet
trigger1 = var(2) != -1 && (p2movetype != H || enemynear, ctrl)
trigger2 = (var(2) = -1) && (root, MoveHit || partner, MoveHit)
trigger3 = (enemynear, MoveHit) && (var(2) = -1)
var(2) = 0 - (var(1) = -1)

[State -4, Reset HitCount (Aerial Rave)]
type = VarSet
trigger1 = var(2) != -1 && (p2movetype != H || enemynear, ctrl)
trigger2 = ((Root, HitDefAttr = SC, NA, SA, HA) || (Partner, HitDefAttr = SC, NA, SA, HA)) && (enemynear, statetype != A)
var(3) = 0

[State -4, Reset PlaceHolder Var]
type = VarSet
triggerall = NumExplod(9500)
trigger1 = (var(2) = 0) || (var(3) = 0) || (roundstate > 2)
var(5) = 0

[State -4, Danger Indicator]
type = VarSet
trigger1 = var(4) = 1 && roundstate != 2
trigger2 = var(4) = 0 && root, life <= 250
var(4) = (roundstate > 1)
; --------------------------------------------------------

;;;;;;;;;;;;; Feature 2: K.O. for Simul Mode ;;;;;;;;;;;;;;
; --------------------------------------------------------
; Used vars for this feature: 1
; - var(6) *** Detects whenever root or partner had been defeated in roundstate 2 when in simul mode.
[State -4, VarSet]
type = VarSet
triggerall = (var(6) = 0) && !(root, Alive)
trigger1 = (root, time = 1) && !(root, HitShakeOver)
var(6) = 1

[State -4, Special K.O. Effect if defeated in simul mode (roundstate = 2)]
type = Helper
triggerall = !NumHelper(1337000001)
trigger1 = var(6) = 1
name = "Finish!"
ID = 1337000001
stateno = 1337000001
ownpal = 1
persistent = 0

[State -4, VarSet]
type = VarSet
trigger1 = var(6) > 0
trigger2 = (var(6) = 0) && !(partner, Alive)
var(6) = -1
; --------------------------------------------------------

;;;;;;;;;;;;;; Feature 3: Hyper Background ;;;;;;;;;;;;;;;
; --------------------------------------------------------
; Used vars for this feature: 2
; - var(7) *** Detects Hyper Combo Finish
; - var(8) *** Detects Normal Finish
[State -4, Hyper Combo Finish Varset]
type = VarSet
triggerall = root, var(17) >= 10
triggerall = var(7) = 0
triggerall = (root, WinKO) && (root, MoveHit)
triggerall = !NumExplod(9400)
trigger1 = root, stateno = [3000, 3999]
var(7) = 1

[State -4, Normal Finish Varset]
type = VarSet
triggerall = var(8) = 0
triggerall = var(7) = 0
trigger1 = root, WinKO
var(8) = 1

[State -4, Hyper Background Helper]
type = Helper
triggerall = root, var(17) >= 10
triggerall = !NumHelper(1337000002)
trigger1 = root, stateno = [3000, 3999]
name = "Hyper Background"
ID = 1337000002
stateno = 1337000002
pos = 0,0
postype = back
ownpal = 1
supermovetime = 9999999999
pausemovetime = 9999999999

[State -4, HCF Varset]
type = VarSet
triggerall = root, var(17) >= 10
triggerall = var(7) = 1
trigger1 = Helper(1337000002), NumExplod(9400)
var(7) = -1

[State -4, Reset Vars]
type = VarSet
trigger1 = Roundstate = [0, 2]
var(7) := var(8) := 0
; --------------------------------------------------------

[State MS - M, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "F.Attack: %d, H.Count: %d, A.Rave: %d, Danger: %d, D.Holder: %d\n"
params = var(1), var(2), var(3), var(4), var(5)

[State MS - M, AppendToClipboard]
type = AppendToClipboard
trigger1 = 1
;text = "Root: %d, Partner: %d, R.StateNo: %d, P.StateNo: %d"
text = "E.Helper(1337000002): %d, P.Helper(1337000002): %d"
;params = (Root, ID), (Partner, ID), (Root, StateNo), (Partner, StateNo)
params = (enemynear, NumHelper(1337000002)), (partner, NumHelper(1337000002))

[State MS - END] ;ctrl a tick ago
type = Null
trigger1 = var(0) := root, ctrl

; ========================================================================
; Feature Helpers:
; This sections contains the helpers that are called back in the main
; system helper, most are self-explanatory
; ========================================================================

; ========================================================================
;K.O. Helper (for simul mode)
;This one is called in roundstate 2 when one of the two chars in the team
;die.
[StateDef 1337000001]
anim = 1337000000
ctrl = 0

[State FX, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible

[State FX-1, PlaySnd]
type = PlaySnd
triggerall = root, var(17) = [20, 21]
trigger1 = time = 0
value = f20000, 0
volume = 200

[State FX-2, Explod]
type = Explod
triggerall = root, var(17) >= 20
trigger1 = time = 0
anim = f9900
pos = 160, 120
postype = back
removetime = -2
supermovetime = 999999
pausemovetime = 999999
scale = 0.5, 0.5
facing = -1
ownpal = 1
ontop = 1

; ------------------------------
[State FX-3a, Pause]
type = Pause
triggerall = root, var(17) = [10, 11]
triggerall = (time % 1) = 0
trigger1 = root, stateno = [5000, 5050]
trigger2 = root, stateno = [6000, 6999]
time = 1
; ------------------------------

; ------------------------------
[State FX-3b, Pause]
type = SuperPause
triggerall = root, var(17) = [20, 21]
trigger1 = time = 0
anim = -1
time = 60
; ------------------------------

[State FX-4, Exit]
type = DestroySelf
trigger1 = ifelse((root, var(17) = [20, 21]), time >= 0, (root, Stateno = [5100, 5150]))


; ========================================================================
; Hyper Background Effects (includes DHC Bg Changers)
; This is a very basic version, if you need to fit some custom needs, you
; must override this helper.
[Statedef 1337000002]
anim = 1337000000
ctrl = 0

; Here you must stablish the Hyper Cancel Var for each char, depending on
; the char, will be the var number, for example mvc2kfm uses var(11) for
; this feature, others may use another free var.
[State HBG, Hyper Cancel VarSet]
type = VarSet
trigger1 = 1
var(0) = 1 ;Here you can stablish the HC var by using root, var(X) format.
           ;In which X represents the var number. for example:
           ;Var(0) = root, var(40) if var(40) is used for HC.

[State HBG, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible

; Thanks to _nabeshin_ for the Hyper BG Sprites.
[State HBG, DHC]
type = AssertSpecial
triggerall = root, var(17) >= 10
trigger1 = root, stateno = [3000, 3999]
flag = noBG
flag2 = noFG

;Hyper BG Changer (for HC)
;------------------------------
; Level 2
[State HBG, Hyper BG Right]
type = Explod
triggerall = root, var(17) = [20, 21]
triggerall = root, time = 1
triggerall = var(0) = 2
trigger1 = root, stateno = [3000, 3999]
removetime = 52
anim = f9203
ID = 9203
pos = -161, 0
postype = right
sprpriority = -5
facing = -1
bindtime = -1
supermovetime = 51
removeongethit = 1

[State HBG, Hyper BG Left]
type = Explod
triggerall = root, var(17) = [20, 21]
triggerall = root, time = 1
triggerall = var(0) = 2
trigger1 = root, stateno = [3000, 3999]
removetime = 52
anim = f9203
ID = 9213
pos = 160, 0
postype = left
sprpriority = -5
facing = 1
bindtime = -1
supermovetime = 51
removeongethit = 1

; Level 3
[State HBG, Hyper BG Right]
type = Explod
triggerall = root, var(17) = [20, 21]
triggerall = root, time = 1
triggerall = var(0) = 3
trigger1 = root, stateno = [3000, 3999]
removetime = 52
anim = f9204
ID = 9204
pos = -161, 0
postype = right
sprpriority = -5
facing = -1
bindtime = -1
supermovetime = 51
removeongethit = 1

[State HBG, Hyper BG Left]
type = Explod
triggerall = root, var(17) = [20, 21]
triggerall = root, time = 1
triggerall = var(0) = 3
trigger1 = root, stateno = [3000, 3999]
removetime = 52
anim = f9204
ID = 9214
pos = 160, 0
postype = left
sprpriority = -5
facing = 1
bindtime = -1
supermovetime = 51
removeongethit = 1

;Hyper BG (Color may change if HC var is active)
;-----------------------------------------------
[State HBG, HBG R]
type = Explod
triggerall = root, var(17) >= 10
triggerall = !NumExplod(9200)
trigger1 = root, stateno = [3000, 3999]
trigger1 = root, time >= 52
anim = f(ifelse((root, var(17) = [10, 11]), 400, 9200) + (ifelse((root, var(17) = [20, 21]), (var(0) - 1), 0)))
postype = right
ID = 9200
sprpriority = -5
supermovetime = 500
removetime = -1
pos = ifelse((root, var(17) = [10, 11]), 0, -161), 0
bindtime = -1
facing = -1

[State HBG, HBG L]
type = Explod
triggerall = root, var(17) = [20, 21]
triggerall = !NumExplod(9210)
trigger1 = root, stateno = [3000, 3999]
trigger1 = root, time >= 52
anim = f(9200 + (var(0) - 1))
postype = left
ID = 9210
sprpriority = -5
supermovetime = 500
removetime = -1
pos = 160,0
bindtime = -1

; Remove Effects
; --------------------------------------
[State HBG, Remove Hyper BG (right)]
type = RemoveExplod
trigger1 = root, stateno != [3000, 3999]
trigger2 = root, stateno = [3000, 3999]
trigger2 = root, time = [0, 52]
trigger3 = NumExplod(9400) != 0    ; Hyper Combo Finish is active
id = 9200

[State HBG, Remove Hyper BG (left)]
type = RemoveExplod
trigger1 = root, stateno != [3000, 3999]
trigger2 = root, stateno = [3000, 3999]
trigger2 = root, time = [0, 52]
trigger3 = NumExplod(9400) != 0    ; Hyper Combo Finish is active
id = 9210

[State HBG, Remove Hyper BG Changer (level 1, right)]
type = RemoveExplod
trigger1 = root, stateno != [3000, 3999]         ; If player isn't in H.States
trigger2 = NumExplod(9400) != 0    ; Hyper Combo Finish is active
id = 9203

[State HBG, Remove Hyper BG Changer (level 1, left)]
type = RemoveExplod
trigger1 = root, stateno != [3000, 3999]         ; If player isn't in H.States
trigger2 = NumExplod(9400) != 0    ; Hyper Combo Finish is active
id = 9213

[State HBG, Remove Hyper BG Changer (level 2, right)]
type = RemoveExplod
trigger1 = root, stateno != [3000, 3999]         ; If player isn't in H.States
trigger2 = NumExplod(9400) != 0    ; Hyper Combo Finish is active
id = 9204

[State HBG, Remove Hyper BG Changer (level 2, left)]
type = RemoveExplod
trigger1 = root, stateno != [3000, 3999]         ; If player isn't in H.States
trigger2 = NumExplod(9400) != 0    ; Hyper Combo Finish is active
id = 9214

;-------------------------------------------------------
; Hyper Combo Finish
; Thanks to Erradicator for the Hyper Combo Finish BG!!!
[State HCF, HCF Varset]
type = VarSet
trigger1 = 1
var(7) = Helper(1337000000), var(7)

[State HCF, HCF Varset]
type = VarSet
trigger1 = 1
var(8) = Helper(1337000000), var(8)

[State HCF, 1 as_EX]
type = AssertSpecial
triggerall = root, var(17) >= 10
triggerall = (var(7)) && (!var(8))
trigger1 = NumExplod(9400)
flag = NoBG
flag2 = NoBarDisplay
flag3 = NoFG

[State HCF, 2 as_EX]
type = PlaySnd
triggerall = root, var(17) >= 10
trigger1 = (var(7) = 1) && (!var(8))
value = f(ifelse((root, var(17) = [10, 11]), 8550, 20000)), (ifelse((root, var(17) = [10, 11]), 0, 1))
volume = 200
persistent = 0

; Hyper Combo Finish BG (thanks to Erradicator)
[State HCF, 3 as_EX]
type = Explod
triggerall = root, var(17) >= 10
trigger1 = (var(7) = 1) && (!var(8))
ID = 9400
anim = f(ifelse((root, var(17) = [10, 11]), 500, 9400))
postype = back
pos = 0, 0
bindtime = -1
removetime = -2
sprpriority = -5
persistent = 0

[State HCF, DestroySelf]
type = DestroySelf
trigger1 = root, stateno != [3000, 3999]

As you can see is the Messatsu's Main Helper method for full game features, It comes really in handy (most of my char's vars are free now), so the explanation is this:
The Main Helper (1337000000) is intended to be all the time since the fight begins (from roundstate 0 to 4) and checks everithing, so the main hitcount control for combo messages (MVC2 type) is active all the time, seing what the char does, and counting hits when necesary, also calls helper 1337000001 that is for simul mode special KO finish when in roundstate = 2 and the hyper BG (this version is very generic, in some cases you must override this one, but is another history).

As you can see, in the counting vars (var(2) and var(3)) time is = 1, but that fails when the pausetimes in the hitdef are lower than 7 (for example pausetime = 0, 7 <-- this value matters for the helper... fails if pausetime = 0, 5 [Misses some hits if multiple hit move] or pausetime = 0, 1 [Misses allways])

So, root, animtime = 0 cannot be set here, because the first state is a gethit one, that interrupts another state that it was executing before... I hope that I explained this correctly :P

Almost forgot... I'm also looking for Winane's Training mode detection code... but I'm unable to find it... where is it now? XD

Thanks in advance for the help

See ya!!!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

Bastard Mami

Well, while one method involves looking at the future, another method would involve placing your code in the future, but it might be ahrder to implement, especially in the way you are using the helper as it would require you to code the character as a helper and code the helper's routines as the character, so the helper's code happens after the character's.

FerchogtX

Well, that can be the solution, except that this character uses also a tag system (like in marvel games) so this can give me a lot of trobles with the selfstate codes that are used in statedef -3 in the character... Oh god... I hope there is a hack or something realted for this, otherwise I will need to use (again) some root vars to detect what I want... but may be not too reliable.

I hate this time lag :(

BTW, do you know where is the Winane's training mode detection code? because I'm searching for it with no luck :( Thanks in advance

See ya!!!!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

FerchogtX

Well... I solved my problem... not the way I spected, but hey! Is solved! XD

Now I have a question, whenever I see, my vars are reseted between rounds (the helper vars), so that's really deseperating for my scoring system... Is there a way to avoid mugen from reseting my helper vars whithin rounds?

Thanks in advance.

See ya!!! :D

P.D. Still waiting for Winane's training mode detection code :(
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

Bastard Mami

Oh, I think sepp deleted the winane code form the board.

About reseting vars, I think there is no work around , so non-perishable vars should be kept in the character.
The only thing that occcurs me is using the character as a compressed storage medium and use the helper as the proper coding. reading on bitwise operators should help you on how to compress the vars, in this case  posting the codes you want to compress seems to be the better option.

FerchogtX

Quote from: Satou Sei on April 14, 2008, 11:43:39 PM
Oh, I think sepp deleted the winane code form the board.

About reseting vars, I think there is no work around , so non-perishable vars should be kept in the character.
The only thing that occcurs me is using the character as a compressed storage medium and use the helper as the proper coding. reading on bitwise operators should help you on how to compress the vars, in this case  posting the codes you want to compress seems to be the better option.
Well here what I wanted to do, first this is added to the master helper
;;;;;;;;;;;;;;;; Feature 5: Score Control ;;;;;;;;;;;;;;;;
; --------------------------------------------------------
; Used Vars for this feature: 1
; - var(11) ** Score counting and bookeeping
[State -4, Score Var]
type = VarAdd
triggerall = (root, var(17) >= 10) && (root, var(58) < 1)
trigger1 = ifelse(NumEnemy = 2, ((enemy(0), time = 1 || enemy(1), time = 1) && (enemy(0), HitShakeOver = 0 || enemy(1), HitShakeOver = 0)), ((enemynear, time = 1) && (enemynear, HitShakeOver = 0)))
trigger1 = ifelse(NumEnemy = 2, (enemy(0), MoveType = H || enemy(1), MoveType = H) && ((enemy(0), StateNo != [150, 155]) && (enemy(1), StateNo != [150, 155])), (enemynear, MoveType = H) && (enemynear, Stateno != [150, 155]))
trigger2 = (var(2) = -1) && ifelse(NumEnemy = 2, (enemy(0), MoveType = H || enemy(1), MoveType = H) && ((enemy(0), StateNo != [150, 155]) && (enemy(1), StateNo != [150, 155])), (enemynear, MoveType = H) && (enemynear, Stateno != [150, 155]))
trigger3 = roundstate = 4 && ((root, time = 1) || (partner, time = 1)) && ((root, stateno = [180,189]) || (partner, stateno = [180,189]))
var(11) = (ceil((root, stateno) || (partner, stateno) / 5) * var(2)) + ((var(1) = -1) * 500) + (ifelse((roundstate = 4), ((root, life) + (partner, life)), 0))

[State -4, Score Helper]
type = Helper
triggerall = RoundState > 1
trigger1 = !NumHelper(1338000002) && (root, var(17) >= 10)
trigger1 = (root, var(58) < 1) && (GameTime % 10) = 0
name = "Score Helper"
stateno = 1338000002
ID = 1338000002
pos = 0,0
postype = left
bindtime = -1
ownpal = 1
pausemovetime = 999999999
supermovetime = 999999999

[State -4, Press Start Label]
type = Explod
triggerall = !NumExplod(9800) && (root, var(17) >= 10)
trigger1 = (root, life != 0) && (root, var(58) > 0) && (GameTime % 60) = (root, ID)
anim = f(ifelse((root, var(17) = [10, 11]), 220, 9800))
ID = 9800
pos = (ifelse((TeamSide = 1), 35, 190)) - (ifelse((root, var(17) = [10, 11]), 20, 0)), ifelse((root, var(17) = [10, 11]), 4, 2)
postype = Left
removetime = 30
bindtime = -1
ownpal = 1
ontop = 1
scale = 0.50, 0.50
supermovetime = 999999999
pausemovetime = 999999999
The important part here is the score control, (var(11) and Helper 1338000002) I changed some number conventions for the helpers... but that's another hystory.
; ========================================================================
; Score Helper
[Statedef 1338000002]
anim = 1337000000
ctrl = 0

[State S, 0]
type = Varset
trigger1 = 1
var(0) = parent, var(11)

[State S, Units]
type = Explod
trigger1 = !NumExplod(9600)
anim = f(ifelse((root, var(17) = [20, 21]), 9600, 250)) + (var(0) - var(0) / 10 * 10)
ID = 9600
postype = left
pos = 114 + 160 * (teamside = 2), 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, Dozens]
type = Explod
trigger1 = !NumExplod(9601) && var(0) > 9
anim = f(var(0) / 10 - var(0) / 100 * 10) + (ifelse((root, var(17) = [20, 21]), 9600, 250))
ID = 9601
postype = left
pos = 114 + 160 * (teamside = 2) - 8, 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, Hundreds]
type = Explod
trigger1 = !NumExplod(9602) && var(0) > 99
anim = f(var(0) / 100 - var(0) / 1000 * 10) + (ifelse((root, var(17) = [20, 21]), 9600, 250))
ID = 9602
postype = left
pos = 114 + 160 * (teamside = 2) - 16, 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, Thousands]
trigger1 = !NumExplod(9603) && var(0) > 999
type = Explod
anim = f(var(0) / 1000 - var(0) / 10000 * 10) + (ifelse((root, var(17) = [20, 21]), 9600, 250))
ID = 9603
postype = left
pos = 114 + 160 * (teamside = 2) - 24, 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, Ten Thousand]
trigger1 = !NumExplod(9604) && var(0) > 9999
type = Explod
anim = f(var(0) / 10000 - var(0) / 100000 * 10) + (ifelse((root, var(17) = [20, 21]), 9600, 250))
ID = 9604
postype = left
pos = 114 + 160 * (teamside = 2) - 32, 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, Hundred Thousand]
trigger1 = !NumExplod(9605) && var(0) > 99999
type = Explod
anim = f(var(0) / 100000 - var(0) / 1000000 * 10) + (ifelse((root, var(17) = [20, 21]), 9600, 250))
ID = 9605
postype = left
pos = 114 + 160 * (teamside = 2) - 40, 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, Millions]
trigger1 = !NumExplod(9606) && var(0) > 999999
type = Explod
anim = f(var(0) / 1000000 - var(0) / 10000000 * 10) + (ifelse((root, var(17) = [20, 21]), 9600, 250))
ID = 9606
postype = left
pos = 114 + 160 * (teamside = 2) - 48, 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, Ten Million]
trigger1 = !NumExplod(9607) && var(0) > 9999999
type = Explod
anim = f(var(0) / 10000000 - var(0) / 100000000 * 10) + (ifelse((root, var(17) = [20, 21]), 9600, 250))
ID = 9607
postype = left
pos = 114 + 160 * (teamside=2) - 56, 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, Hundred Million]
trigger1 = !NumExplod(9608) && var(0) > 99999999
type = Explod
anim = f(var(0) / 100000000 - var(0) / 1000000000 * 10) + (ifelse((root, var(17) = [20, 21]), 9600, 250))
ID = 9608
postype = left
pos = 114 + 160 * (teamside = 2) - 64, 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, Billions]
trigger1 = !NumExplod(9609) && var(0) > 999999999
type = Explod
anim = f(var(0) / 1000000000 - var(0) / 10000000000 * 10) + (ifelse((root, var(17) = [20, 21]), 9600, 250))
ID = 9609
postype = left
pos = 114 + 160 * (teamside = 2) - 72, 2
bindtime = -1
removetime = 10
sprpriority = 2
ownpal = 1
facing = facing
scale = ifelse((root, var(17) = [20, 21]), 0.5, 1), ifelse((root, var(17) = [20, 21]), 0.5, 1)

[State S, DestoySelf]
type = DestroySelf
trigger1 = time = 0
The score helper itself, this is original code from Ryou Win, but this was heavily modified by me to get the helper working. The porblem is that var(11) should be persistent with it's value ALWAYS, so you add more points to your score as you face more matches.

I'll be thankfull if you teach me how to compress vars (I have no idea what does that mean in this context) to get this working properly.

Thanks in advance man, and thanks for all the help you are giving to me right now :D

See ya!!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

FerchogtX

Hi again...

I'm still trying to get this working... but no results, how is that stuff about compresing vars or something you mentioned?

Thanks in advance man.

See ya!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

Bastard Mami

You posted the code you use to keep the score, to save a var you would just use a code to copy the helper's vars in the parent's vars.

something like:

[state helper dies on round over]

type=parent varset
var30= var30

to save the var, then

[state create helper]
type=varset
var30=parent,var30

The compression is using bitwise expressions to save more than one var in just one var, it is completely dependant on the range of values of the var you are going to save.

Next, please post teh vars you want to save in the parent, and their allowed values.

FerchogtX

Well by now, the only one could be the score var (var(11)), but supposing I need to save more, maybe it can be:

var(11) - Score itself
var(12) - Maybe life remaining and partner's (if any)
var(13) - how many perfects I have in battle...

How to compress this on a var?

Thanks in advance man :D

See ya!!!!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

Bastard Mami

Which is the allowed range of values?

var(11) - Score itself
  from 0 to what ?
var(12) - Maybe life remaining and partner's (if any)
  0 to 1000 i guess
var(13) - how many perfects I have in battle...
  0 to 100 maybe?

FerchogtX

var(11) can go from 0 to 9 999 999 999 (max value)
var(12) from 0 to 1000 + partner life if any (2000)
var(13) from 0 to 100 max.

That can be the values.

Thakns in advance

See ya!!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

Bastard Mami

It looks like you need two vars to compress that data, one for score and another for the other parameter, but the score looks fundamentally broken unless you are using fvars as ints only take values up to 2 billions and your scoring goes all the way to 9 billions so it would not fit on a single var anyway.

as far as this goes:

var(12) from 0 to 1000 + partner life if any (2000)
var(13) from 0 to 100 max

;first reset the memory var on time=0.
type=parentvarset
varX = 0

;then we save the parent's life
type=parentvarset
varX = (parent,varX)| (parent,life)

;then we save the partner's life, since life can be from 0 to 1000 we use the next bigger power of 2
type=parentvarset
varX = (parent,varX)| ( (partner,life)* 1024)

;then we save the helper's var13,, since var13 can be from 0 to 100 we use the next bigger power of 2
; and since we are already displaced 1024 we also use that value
type=parentvarset
varX = (parent,varX)| ( (partner,life)* 128*1024)

This is just bit shifting, Ideally we would use the >> operator but mugen does not support it and makes the code more unreadable.

I am waiting for your doubts as you might not be acquainted with bitwise operators.

FerchogtX

Quote from: Satou Sei on April 18, 2008, 08:21:30 PM
It looks like you need two vars to compress that data, one for score and another for the other parameter, but the score looks fundamentally broken unless you are using fvars as ints only take values up to 2 billions and your scoring goes all the way to 9 billions so it would not fit on a single var anyway.

as far as this goes:

var(12) from 0 to 1000 + partner life if any (2000)
var(13) from 0 to 100 max

;first reset the memory var on time=0.
type=parentvarset
varX = 0

;then we save the parent's life
type=parentvarset
varX = (parent,varX)| (parent,life)

;then we save the partner's life, since life can be from 0 to 1000 we use the next bigger power of 2
type=parentvarset
varX = (parent,varX)| ( (partner,life)* 1024)

;then we save the helper's var13,, since var13 can be from 0 to 100 we use the next bigger power of 2
; and since we are already displaced 1024 we also use that value
type=parentvarset
varX = (parent,varX)| ( (partner,life)* 128*1024)

This is just bit shifting, Ideally we would use the >> operator but mugen does not support it and makes the code more unreadable.

I am waiting for your doubts as you might not be acquainted with bitwise operators.

OK, so the firts parentvarset resets the var to zero, then you compress the data with the next 3 controlers (that I suppose they should have a trigger1 = 1... or not?) the part i don't understand is the *128*1024... looks bit confusing... and also I don't see var(13), how are you saving its data?

Thanks for the patience and help man :D

See ya!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork

Bastard Mami

that's not exact mugen code, substitute varX for the proper vars, and add the necesary triggers. Try and post some code that does that and we will fix it up.

for you *128 doubts, just read a bit on binary operations or pwers of two, I think wikipedia has enough info on that.

FerchogtX

So... something like:

var(12) from 0 to 1000 + partner life if any (2000)
var(13) from 0 to 100 max

;first reset the memory var on time=0.
type=parentvarset
trigger1=time = 0
var(12) = 0

;then we save the parent's life
type=parentvarset
trigger1 = 1
var(12) = (parent,var(12))| (parent,life)

;then we save the partner's life, since life can be from 0 to 1000 we use the next bigger power of 2
type=parentvarset
trigger=1
var(12) = (parent,var(12))| ( (partner,life)* 1024)

;then we save the helper's var13,, since var13 can be from 0 to 100 we use the next bigger power of 2
; and since we are already displaced 1024 we also use that value
type=parentvarset
trigger1 = roundstate > 2 && matchover
var(13) = (parent,var(12))| ( (partner,life)* 128*1024)


This should work, isn't it? This is intended to save the partner and parent life data allways (update allways) and then save the perfect match data when the round is over (KO)

Thanks for the help.

See ya!!! :D
This is the era in which we will see reason triumphing against brutality... May be better to open your mind to the future.
------------------------------------------------------
<- [Clicky - Clicky]
Current Universal War Official Artwork