Setting a byte based on time

If you are having problems finding or using cheats for an Emulator (particularly MAME/MESS) or have found a trick that you wish to share this is the place to do it. But please read the Cheat FAQ first.
Post Reply
Lurendrejer
Posts: 51
Joined: Sat Sep 03, 2005 5:52 pm
Location: Denmark

Setting a byte based on time

Post by Lurendrejer »

I'm having trouble. I'm changing the vertical height a person is flying when uppercutted or super-piledrivered. I've found the values but an unwanted sideeffect is that when the person is flying to the ground after the hit, the values reaches 01 again, and he's off into the air again.

I should've seen this comming - but i didn't....

Can i set it so that a value is modded maximum once each 5 seconds? This would allow the person to land and become zeroed.

what i need to get from this is setting the Param to eg. 20 - this will make the person fly into the air at height 20 when he reached the original 01.

<action condition="maincpu.pb@010E85F8==01">maincpu.pb@010E85F8=Param</action>
<action condition="maincpu.pb@010E7278==01">maincpu.pb@010E7278=Param</action>
<action condition="maincpu.pb@010E9978==01">maincpu.pb@010E9978=Param</action>
<action condition="maincpu.pb@010EACF8==01">maincpu.pb@010EACF8=Param</action>


Thank you in advance
Lurendrejer
Posts: 51
Joined: Sat Sep 03, 2005 5:52 pm
Location: Denmark

Re: Setting a byte based on time

Post by Lurendrejer »

<action condition="maincpu.pb@010E85F8==01">maincpu.pb@010E85F8=Param</action>
<action condition="maincpu.pb@010E7278==01">maincpu.pb@010E7278=Param</action>
<action condition="maincpu.pb@010E9978==01">maincpu.pb@010E9978=Param</action>
<action condition="maincpu.pb@010EACF8==01">maincpu.pb@010EACF8=Param</action>
<action condition="maincpu.pb@010E85F8==02">maincpu.pb@010E85F8=0</action>
<action condition="maincpu.pb@010E7278==02">maincpu.pb@010E7278=0</action>
<action condition="maincpu.pb@010E9978==02">maincpu.pb@010E9978=0</action>
<action condition="maincpu.pb@010EACF8==02">maincpu.pb@010EACF8=0</action>

would fix the issue - but looks odd :(

+ It destroys every move made from the turnbuckle (the fighter just land on the ground as if he was hit mid-air)
User avatar
Pugsy
Posts: 3675
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 15 times
Contact:

Re: Setting a byte based on time

Post by Pugsy »

The frame parameter would allow you determine how often to poke, but perhaps you could do it with temp variables.
If you are only after poking when x=01 when it was previously 0 then perhaps this would work?

Code: Select all

<action condition="maincpu.pb@010E85F8==01 AND temp0 LT 1">maincpu.pb@010E85F8=param</action>
<action condition="maincpu.pb@010E7278==01 AND temp1 LT 1">maincpu.pb@010E7278=param</action>
<action condition="maincpu.pb@010E9978==01 AND temp2 LT 1">maincpu.pb@010E9978=param</action>
<action condition="maincpu.pb@010EACF8==01 AND temp3 LT 1">maincpu.pb@010EACF8=param</action>
<action>temp0=maincpu.pb@010E85F8</action>
<action>temp1=maincpu.pb@010E7278</action>
<action>temp2=maincpu.pb@010E9978</action>
<action>temp3=maincpu.pb@010EACF8</action>

BTW, ideally it should be "param" not "Param"
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.264 XML cheat collection (3 APRIL 2024) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/SxsQUJoT#jBdz6GLm_ ... QzFGSMms2c (ZIP Archive 3.8 MB)
Lurendrejer
Posts: 51
Joined: Sat Sep 03, 2005 5:52 pm
Location: Denmark

Re: Setting a byte based on time

Post by Lurendrejer »

I'm just staring blindly into what you just wrote.

I'll figure it out some day :)

Followup question, would it be possible to use the frame-parameter to poke +1 multiple times instead of just rocketing the fighters height to 20?

example: 01 + 1 + 1 + 1 + 1 - would make a soft bow when flying. 01 + 09 doesn't.

--

Just tried your cheat out - works more or less perfect. What does the LT do?
User avatar
Pugsy
Posts: 3675
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 15 times
Contact:

Re: Setting a byte based on time

Post by Pugsy »

It will run each action command below in this order every frame - the order is important as we update the previous value of the address only AFTER we've used it in the condition.

<action condition="maincpu.pb@010E85F8==01 AND temp0 LT 1">maincpu.pb@010E85F8=param</action>
<action condition="maincpu.pb@010E7278==01 AND temp1 LT 1">maincpu.pb@010E7278=param</action>
<action condition="maincpu.pb@010E9978==01 AND temp2 LT 1">maincpu.pb@010E9978=param</action>
<action condition="maincpu.pb@010EACF8==01 AND temp3 LT 1">maincpu.pb@010EACF8=param</action>
<action>temp0=maincpu.pb@010E85F8</action>
<action>temp1=maincpu.pb@010E7278</action>
<action>temp2=maincpu.pb@010E9978</action>
<action>temp3=maincpu.pb@010EACF8</action>

Ok let us take lines 1 + 5 above as an example.....

1. First time through the loop (as soon as you turn the cheat ON all temps will be initialised to 0 so temp0 will be 0).

2. If BOTH conditions are TRUE (the current data at the address (10e85f8) = 1 AND the previous data (temp) at the address (10e85f8) is < 1 (or = 0 if you prefer)) then it will poke it with param, then at action line 5 above it will then update temp0 with the current contents at the address. Goto Step 5

3. If ONE condition is TRUE (the current data at the address (10e85f8) != 1) then at action line 5 above it will update temp0 with the current contents at the address.

4. Goto Step 2

5. Next time through the loop temp0 will be GT 0 so the condition will be false and it won't poke the address.

6. Goto 5 until 010E85F8 has returned to 0, once it's returned to 0 goto Step 2
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.264 XML cheat collection (3 APRIL 2024) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/SxsQUJoT#jBdz6GLm_ ... QzFGSMms2c (ZIP Archive 3.8 MB)
User avatar
Pugsy
Posts: 3675
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 15 times
Contact:

Re: Setting a byte based on time

Post by Pugsy »

Basic comparison terms

LT = Less Than
GT = Greater Than
EQ or '==' = Equal To (use == as standard)
NEQ or '!=" = Not Equal To (use != as standard)
LE = Less Than or Equal To
GE = Greater Than or Equal TO

We avoid using > and < because it can bugger things up in XML
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.264 XML cheat collection (3 APRIL 2024) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/SxsQUJoT#jBdz6GLm_ ... QzFGSMms2c (ZIP Archive 3.8 MB)
User avatar
Pugsy
Posts: 3675
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 15 times
Contact:

Re: Setting a byte based on time

Post by Pugsy »

Yes it's possible with to jack up the value gradually using frame and temp variables - but it would need a lot of "knife and forking" to get it working properly and reliably.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.264 XML cheat collection (3 APRIL 2024) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/SxsQUJoT#jBdz6GLm_ ... QzFGSMms2c (ZIP Archive 3.8 MB)
Lurendrejer
Posts: 51
Joined: Sat Sep 03, 2005 5:52 pm
Location: Denmark

Re: Setting a byte based on time

Post by Lurendrejer »

Thank you very very much.

I just found out that the height is controlled by four bytes, not two. The ones i found was the first two. Meaning that a soft bow would have to be made of thousands of pokes. I was missing the "tens" and "ones", i only found the houndreds.

But thanks again :)
User avatar
Pugsy
Posts: 3675
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 15 times
Contact:

Re: Setting a byte based on time

Post by Pugsy »

No problem

I doubt it would require thousands of pokes...just poking the hundreds could possibly be conceived as being quite smooth - though I've not seen it in action.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.264 XML cheat collection (3 APRIL 2024) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/SxsQUJoT#jBdz6GLm_ ... QzFGSMms2c (ZIP Archive 3.8 MB)
Lurendrejer
Posts: 51
Joined: Sat Sep 03, 2005 5:52 pm
Location: Denmark

Re: Setting a byte based on time

Post by Lurendrejer »

It does look odd.

The game seems to calculate some hits based on these movements. For instance some turnbuckle jumps fail when moving too fast. (the character just shakes and falls to his back as if he were hit mid-air)


Some type of "Param+9 until Param=0FFF" thing would be ideal.
Lurendrejer
Posts: 51
Joined: Sat Sep 03, 2005 5:52 pm
Location: Denmark

Re: Setting a byte based on time

Post by Lurendrejer »

Is it possible to always add X to anything the cpu sets this value to? That would in this case just make everything during that match more "high-flying".

I can see a thing like this being pretty cpu-intensive - but if you were willing to do anything to add to the fun?
User avatar
Pugsy
Posts: 3675
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 15 times
Contact:

Re: Setting a byte based on time

Post by Pugsy »

Something along the lines of this should add the value of param anytime the contents of a memory location has increased:-

Code: Select all

    <script state="on">
      <action>temp0=maincpu.pb@010E85F8</action>
      <action>temp1=maincpu.pb@010E7278</action>
      <action>temp2=maincpu.pb@010E9978</action>
      <action>temp3=maincpu.pb@010EACF8</action>
    </script>
    <script state="run">
      <action condition="maincpu.pb@010E85F8 GT temp0">maincpu.pb@010E85F8=(maincpu.pb@010E85F8)+param</action>
      <action condition="maincpu.pb@010E7278 GT temp1">maincpu.pb@010E7278=(maincpu.pb@010E7278)+param</action>
      <action condition="maincpu.pb@010E9978 GT temp2">maincpu.pb@010E9978=(maincpu.pb@010E9978)+param</action>
      <action condition="maincpu.pb@010EACF8 GT temp3">maincpu.pb@010EACF8=(maincpu.pb@010EACF8)+param</action>
      <action>temp0=maincpu.pb@010E85F8</action>
      <action>temp1=maincpu.pb@010E7278</action>
      <action>temp2=maincpu.pb@010E9978</action>
      <action>temp3=maincpu.pb@010EACF8</action>
    </script>
  </cheat>
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.264 XML cheat collection (3 APRIL 2024) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/SxsQUJoT#jBdz6GLm_ ... QzFGSMms2c (ZIP Archive 3.8 MB)
Lurendrejer
Posts: 51
Joined: Sat Sep 03, 2005 5:52 pm
Location: Denmark

Re: Setting a byte based on time

Post by Lurendrejer »

You are the best! :D
Post Reply