Page 1 of 1
Settings a byte X-amount of times
Posted: Sun Sep 19, 2010 2:06 pm
by Lurendrejer
I need something that can:
do this:
<action condition="maincpu.pb@011B46A0==60">maincpu.pb@011B46A0=20</action>
<Param> amount of times.
eg. if param=3, then it should only change 60 to 20 three times and after that just let 60 skip to 68. It seems no matter what i do, it just doesn't do it right.
Re: Settings a byte X-amount of times
Posted: Sun Sep 19, 2010 4:40 pm
by Pugsy
Something like this you mean?
Code: Select all
<script state="on">
<action>temp0 =0</action>
</script>
<script state="run">
<action condition="maincpu.pb@011B46A0==60 AND temp0 LT param">maincpu.pb@011B46A0=20, temp0=temp0+1</action>
</script>
Re: Settings a byte X-amount of times
Posted: Sun Sep 19, 2010 4:45 pm
by NotAGoodName
I'm not sure what you're up to, but if you really can't find another condition to base this on, there's a way to do it. You need to have a free address handy that NOTHING uses. Good luck finding a safe one on an arcade machine.
Example:
Code: Select all
<cheat desc="Your Cheat">
<param min="0" max="999" step="1"/>
<script state="on">
<action>maincpu.pb@BEEFDEAD=00</action>
</script>
<script state="run">
<action condition="maincpu.pb@DEADBEEF==59">maincpu.pb@BEEFDEAD=(maincpu.pb@BEEFDEAD) + 1</action>
<action condition="maincpu.pb@DEADBEEF==60 and maincpu.pb@BEEFDEAD LT (param)+1">maincpu.pb@DEADBEEF=20</action>
</script>
</cheat>
In the example. BEEFDEAD is your dummy address. DEADBEEF is the real address. You add one to the loop right before the value is changed. Once the loop is complete, the cheat will never reactivate until it is reset because nothing resets the loop address at BEEFDEAD to 0.
*edit*
Or you could be smart like Pugsy and use a temp variable.
Re: Settings a byte X-amount of times
Posted: Sun Sep 19, 2010 5:01 pm
by Lurendrejer
I guess i'm not smart then, cause i have actually been fidling around with doing something like you (notagoodname) and resetting the value based on some condition that fits. I'll check your solution out pugsy, and thank you

Re: Settings a byte X-amount of times
Posted: Sun Sep 19, 2010 5:06 pm
by Lurendrejer
I ended up with this - I'll check if it works later.
Instead of free addresses to make a latter with x-amount of opponents this ought to replay the latter again, again and again until the variable check tells it not to.
The other two addresses that gets set simply changes the on-screen counter to 8 when it reaches 0 - if goes above nine or below zero, it just displays garbage.
<cheat desc="Number of RR-Opponents">
<parameter>
<item value="0x01">16</item>
<item value="0x02">24</item>
<item value="0x03">32</item>
<item value="0x04">40</item>
</parameter>
<script state="on">
<action>temp0 =0</action>
</script>
<script state="run">
<action condition="maincpu.pb@011B46A0==60 AND temp0 LT param">maincpu.pb@011B46A0=20, temp0=temp0+1</action>
<action condition="maincpu.pb@010B29E0==01">maincpu.pb@010B29E0=09</action>
<action condition="maincpu.pb@010F44C0==01">maincpu.pb@010F44C0=09</action>
</script>
</cheat>
Re: Settings a byte X-amount of times
Posted: Sun Sep 19, 2010 5:12 pm
by Pugsy
Remember though this cheat will only poke the value a maximum of param times and it will poke it no more unless you turn the cheat off and on. I can't see any situation were I'd want that - but it's what you asked for...
So you may wish to have a condition that'll reset temp0 to 0 when it's safe to do so.
Re: Settings a byte X-amount of times
Posted: Sun Sep 19, 2010 6:24 pm
by Lurendrejer
I'm using a condition-based thingie to reset the variable based on an animation played before the match starts.
I hope i'm doing it right, the syntax is : <action condition="maincpu.pb@011B4720!=00">temp0 =0</action>
right?
Re: Settings a byte X-amount of times
Posted: Sun Sep 19, 2010 8:46 pm
by Pugsy
Yes, looks fine to put in the "run" script