A Demo Release

Discussions Related to Game Hacking and Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

Postby L. Spiro » Wed Nov 15, 2006 5:48 pm

esco wrote:Found something in the new version I figured I should mention... the old version auto arranged memory addresses from lowest to highest.... this one just leaves them in the order they are inputed in. This can be VERY helpful, but I just wanted to mention that it might be a good idea to also put in an option that can auto arrange them from lowest to highest also. Just a suggestion.

You can arrange them in any order as you please.
Click the column header.

The Compiler wrote:ERROR: Pos: 524 Call to undefined function or incompatible argument lists (“mapnumholders”). File: D:\Emulators\ePSXe\memhack\test.lss

You wrote function “MAPNUMHOLDERS()”, not “mapnumholders()”.


Also, this code does not go here.
It goes in the third tab on the items labeled “Script Address”.
Everything in test.lss needs to be copied there.
Double-click the item that is to have this special lock, go to the third tab, and paste.




esco wrote:Next I write a small script to declare the variables, and try to set it so that when the values in roomhoriz=0 and roomvert =2 (both these values copy from the memory adresses of 629ef0 and 629ef4) it changes the value in whipdmg to 999 ( which I then want to copy to 70b5e0).

This is what your code is already doing.

esco wrote:how do I copy the value from whipdmg BACK to 70b5e0? Does it do it automatically?

Your code is already writing the value 999 to address 0x0070B5E0 in the target process.


esco wrote:Also is there a way I can DIRECTLY WRITE back into the memory address without the var?

Or to go one step further... is there a way to just write a script that does this WITHOUT variables?

ReadProcessMemory()
WriteProcessMemory()

Once you find out how much of a hassle that is, you will praise the heavens for being able to use my variables.
This was the whole point behind my script really.
I—and everyone else—am tired of the pain-in-the-ass of having to create buffers, store local copies, call functions, etc., when trying to manipulate data in the target process.
extern variables allow you to avoid all this hassle and manipulate them as if you were manipulating any other variables.


esco wrote:<pseudocode>
if 5b6e40=3
then 7b6e3f=11
end if


Code: Select all
extern int iReadMe = { "", 0x005B6E40 };
extern int iWriteMe = { "", 0x007B6E3F };
if ( iReadMe == 3 ) { iWriteMe = 11; }



Now, if you wanted to do this without my variables, I will give you a small glimpse of the pain in the ass this will be.

Code: Select all
int iLocalCopyReadMe;
int iLocalCopyWriteMe;
if ( !ReadProcessMemory( GetCurProcessHandle(), (LPVOID)0x005B6E40, &iLocalCopyReadMe, sizeof( int ), NULL ) ) { return; }
if ( iLocalCopyReadMe == 3 ) {
    iLocalCopyWriteMe = 11;
    WriteProcessMemory( GetCurProcessHandle(), (LPVOID)0x007B6E3F, &iLocalCopyWriteMe, sizeof( int ), NULL )
}



Manually reading and writing from and to the target process only gets harder and harder for each operation you want to perform.
And if you want to follow a pointer in the target process manually, well, I hope you have a lot of patience.

My extern variables are God’s gift to you to remove this hassle, allowing you to code faster and write smaller and more readable code.

Of course, I design my language for everybody, so you still have the choice to stay old-fashioned and work manually.



esco wrote:I'm assuming that in this demo release the ability to "lock" or "change" values in memory with c scripts is done, right? Or did I just misunderstand you?

It was never not part of the scripts, in any release.
Your code is already doing it.
You just called “mapnumholders” instead of “MAPNUMHOLDERS” so it wouldn’t compile, and you put it in the wrong place.



esco wrote:how do I use this to say set a value to drop to 10 if it is OVER 10 AND and a value at another memory address =9 for example? Just as an example.

Code: Select all
extern iOther = { "", 0xOTHER };
extern iThis = { "", 0x007B6E3F };
if ( iThis > 10 && iOther == 9 ) { iThis = 10; }




Also I wanted to set it up so that the minute the process is opened (epsxe.exe) all the scripts begin executing. But so far even if I JUST leave in the memory allocating code you gave me above (with the on_openprocess), save it, load it into scripts, compile it, then load the process up... NUTHING happens at all.... why is that? It used to work fine with hotkeys.

I forgot to add the On_OpenProcess() event to the demo version.


Once you call the correct function and you copy the code to the actual item, then download the next demo which will have the hotkeys and process events, you will see things working fine and a shiver will crawl down your neck as you realize just how much you can really do from now on.





L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby L. Spiro » Thu Nov 16, 2006 12:48 am

Demo 3 with script fix and Hotkeys added.


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby esco » Thu Nov 16, 2006 4:54 pm

Hey bro... thanks for the help.... however I have found 2 HUGE glitches I think you need to know about:

1)The search engine is still busted... it still starts from 400000 no matter what I search for. But it ends with the correct value. (I think I mentioned this before)

2)when a script is put into a memory address in memhack... the memory address has to be displayed IN the memhack screen... or the script will NOT execute. In other words if you scroll up or down in memhack and scroll it offscreen it will NOT execute. This is a MAJOR problem for me, since I will have so many addresses saved with scripts, that they all obviously won't be able to fit onscreen at once.

And I wanted to thank you AGAIN for your help. The scripts in memory addresses are indeed a DREAM come true. And the help you gave me above was just what I needed to pull stuff off. The screen for the scripts for an address is kinda small and hard to read... so I just type them in notepad, test them in your compiler then paste them in. But this is ONE HELL OF A PROGRAM!!!! :D

P.S. I've gotten this program to crash too EVERY time I use get final_address (on 3 different computers in fact). What exactly is this feature supposed to do?


EDIT: TOTALLY SEPERATE NOTE: I've been using the allocate memory script you gave me. However I am having a problem with it... I have it set to work on open process. And I have it set to allocate 1000 places starting at 16d000.... all this works fine (thanks to your help) but here is the issue.

Normally.... if I save state in the game... and lets say address 5b6e40 holds a value of 3.... then I continue on, and the value changes to 4... then I decide to go back and reload my save state.... the value would of course reload at 3. With these memory locations, that's not the case. They stay the same unless I maually go in and change them or tell a script to do it (which in the case of save states is next to impossible). Is there a way I can get this to work? Or would I be better off just finding a blank bunch of space in the game and using that (since it would then reload values like it's supposed to?)
Esco.... the name says it all. New Yorikan for life.
User avatar
esco
NULL
 
Posts: 148
Joined: Mon Sep 18, 2006 2:25 am
Location: Florida, a.k.a. the US's version of hell!

Postby L. Spiro » Thu Nov 16, 2006 7:42 pm

1)The search engine is still busted... it still starts from 400000 no matter what I search for. But it ends with the correct value. (I think I mentioned this before)

You did, and it will be fixed in milliseconds.


2)when a script is put into a memory address in memhack... the memory address has to be displayed IN the memhack screen... or the script will NOT execute. In other words if you scroll up or down in memhack and scroll it offscreen it will NOT execute. This is a MAJOR problem for me, since I will have so many addresses saved with scripts, that they all obviously won't be able to fit onscreen at once.

This isn’t a bug.
I told you, this is not the proper way to lock values with scripts.
It just works if the address of the item is being obtained, which it will be while it is on the screen.


P.S. I've gotten this program to crash too EVERY time I use get final_address (on 3 different computers in fact). What exactly is this feature supposed to do?

Just what it says it does.
It gets the address of your item.
The address for the item is found using this value.
If you have no pointers and don’t override GetFinalAddress(), the final address of the item is the same as its base address.



Is there a way I can get this to work? Or would I be better off just finding a blank bunch of space in the game and using that (since it would then reload values like it's supposed to?)

It can work if you are advanced in coding.
Otherwise you need to find a spot in the game where it will load/save your custom addresses correctly.


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby esco » Fri Nov 17, 2006 2:16 am

L. Spiro wrote:This isn’t a bug.
I told you, this is not the proper way to lock values with scripts.
It just works if the address of the item is being obtained, which it will be while it is on the screen.


K... so then what is the proper way or how do I get around this so that the scripts will execute as long as the file with values is loaded into your program? On that note too, is there any way to declare a global variable that all the scripts would be able to use, rather than having to keep declaring it under each and every address? And if so, can you show me an example of how to do it and where?

It can work if you are advanced in coding.
Otherwise you need to find a spot in the game where it will load/save your custom addresses correctly.


Coo.... that's exactly what I went and did. I found a section of the game memory that appears to be blank. It should work fine like that. 8)

P.S. And YES you were right.... after looking thru some more things on c programming, you weren't kidding when you said that this scripting function would make life MUCH easier. Wow is all I can say. Nice work. :)
Esco.... the name says it all. New Yorikan for life.
User avatar
esco
NULL
 
Posts: 148
Joined: Mon Sep 18, 2006 2:25 am
Location: Florida, a.k.a. the US's version of hell!

Postby L. Spiro » Fri Nov 17, 2006 10:14 am

K... so then what is the proper way

There is no proper way yet.
This is why I told you to just do this for now.
Next release will have Script Lock which is the correct way.


is there any way to declare a global variable that all the scripts would be able to use, rather than having to keep declaring it under each and every address?

This was the whole reason I had to put so much thought into this system, slowing me down so long.
Ultimately I found that there is no safe way to connect the scripts to each other.
Imagine if you have a pool of scripting and each item goes to that same pool to get its function for getting the base address, final address, and lock.
If you change the script you change all items in some way.

This may not be bad, but then again it easily may, as it gives us more complications than helpfulness.
You can’t save the script pool then into the item file.
Because if you did, each time you saved the file to a new name you would have another copy of the script pool.
Then what? What if you load two sets of items that are meant to use the same pool?
Load both pools and merge them?
Or suddenly create two copies of the pool?
But what if you wanted your old items to use your current pool instead of the pool that was saved with them?
But what if you don’t?

What if you send it to your friend and his script pool is different from yours? He either gets wrong item script functionality, or he loses his pool in favor of yours (possibly losing some of the other values he had before), or he gets multiple pools with no way of updating them.




It was a tough decision to make but in the end it is the correct way to go.
Each item has its own individual set of scripts that will not interfere with other item scripts.

However, I already planned to solve your problem by implementing a preprocessor that would allow you to simply write one file and then #include "YourFile.h".
Then you write your code once and use the include.



1)The search engine is still busted... it still starts from 400000 no matter what I search for. But it ends with the correct value.

This has already been fixed.

P.S. I've gotten this program to crash too EVERY time I use get final_address

This has already been fixed.
The program is 100% stable but I don’t count the stability of parts that are still under construction, as this part was.
I have finished this section and with it this bug has been removed.


But I will not release until I implement the Script Lock since that is needed most right now.


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby esco » Fri Nov 17, 2006 12:26 pm

Coo, I misunderstood you bro. But this is fine for me right now, as long as my scripts will still be good in the next release (which from what you have said they will) I'll be fine. I can do the individual scripts now and merge them later.

And don't get me wrong.... I was NOT complaining at all. You have done a FANTASTIC job with this program, even at this point. So for now, I can simply limit myself to doin enough codes at once to fill the screen, and then load another set. Then once you implement the "lock" I can merge them together VERY easily. :D

As for the seach, well since I can higlight and paste, and the values up date... heh, I'll do fine with that too right now. :D
Esco.... the name says it all. New Yorikan for life.
User avatar
esco
NULL
 
Posts: 148
Joined: Mon Sep 18, 2006 2:25 am
Location: Florida, a.k.a. the US's version of hell!

Postby L. Spiro » Sun Nov 19, 2006 5:54 pm

Demo #4


RAM Watcher added.
Script Locking added.
Converter crash fix.
Menu items fixed.
Search Range fixed.
GetFinalAddress() crash fixed.
Loads .LMH files.


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby esco » Tue Nov 21, 2006 4:26 pm

L. Spiro wrote:Demo #4


RAM Watcher added.
Script Locking added.
Converter crash fix.
Menu items fixed.
Search Range fixed.
GetFinalAddress() crash fixed.
Loads .LMH files.


L. Spiro


So ummmmm question.... how does this script locking feature affect what I'm doing? So far the previous advice you gave me works fine (as for the problem of the codes not working if scrolled off the memhack screen itself, this can easily be gotten around by simply combining tons of codes into 1 entry). I see the new tab, but what exactly should I do different besides just this:

//a SMALL snippet just used as an example/
void firestormtimer2() {
extern WORD paused = { "", 0x007b6ce6 };
extern WORD drac2tag = { "", 0x0062e0c6 };
extern WORD drac2timer3 = { "", 0x005b7538 };
extern WORD drac2action = { "", 0x0062e0b0 };
extern WORD drac2atknum = { "", 0x0062e108 };
extern WORD drac2fire1vert = { "", 0x006317a6 };
extern WORD drac2fire2vert = { "", 0x00631862 };
extern WORD drac2fire3vert = { "", 0x0063191e };
extern int counter = 0;
if (drac2tag == 35 && drac2action == 5 ) { drac2timer3 = 666; }
if (drac2tag == 35 && drac2action == 4 && drac2timer3 >0 && paused == 0 ) { drac2timer3--; }
if (drac2tag == 35 && drac2timer3 > 0 ) { drac2atknum = 2; }
if (drac2tag == 35 && counter = 0) { drac2fire1vert = 13; counter++; }
}

MHS_ADDRESS GetBaseAddress() {
firestormtimer2();
return 0x005b7538;
return 0x0062e108;
return 0x006317a6;
}
Then I just click the box get_base address and I'm all set... should I use the last tab now, and if so what should I do different and what code would I use to execute it? Putting in void lock() just gives me a script compile error.

P.S. Dear god thanks SO much for fixing the search and including old saved file compatibility. Your program just gets BETTER and BETTER!!!
Esco.... the name says it all. New Yorikan for life.
User avatar
esco
NULL
 
Posts: 148
Joined: Mon Sep 18, 2006 2:25 am
Location: Florida, a.k.a. the US's version of hell!

Postby L. Spiro » Wed Nov 22, 2006 10:13 am

So ummmmm question.... how does this script locking feature affect what I'm doing?

Allows you the proper way of doing things which ultimately means predictable and reliable results.

as for the problem of the codes not working if scrolled off the memhack screen itself, this can easily be gotten around by simply combining tons of codes into 1 entry

But you still have to deal with the item not updating in some cases, and there may be more of these cases in the future.
Also, the addresses of items are not only used for updating that screen, and your setup means that getting the address of that item, for any reason, is slower than it should be.
Lock() is there for a purpose, and you always know when and why it will be called. Overloading it this way has no down sides because it is overloaded in a way that serves its actual purpose.

In the future, the return of GetBaseAddress() and GetFinalAddress() may be buffered to improved performance (although the scripts are pretty damn fast already, as you can see so far), and it will not be usable for locking at all then.



Code: Select all
MHS_ADDRESS GetBaseAddress() {
    firestormtimer2();
    return 0x005b7538;
    return 0x0062e108;     // Never reached.
    return 0x006317a6;     // Never reached.
}

You have two useless lines here.




Putting in void lock() just gives me a script compile error

Code: Select all
MHS_ADDRESS GetBaseAddress() { return 0x005B7538; }
VOID Lock( MHS_ADDRESS aAddress ) {
    firestormtimer2();
}
void firestormtimer2() {
    extern WORD paused = { "", 0x007b6ce6 };
    extern WORD drac2tag = { "", 0x0062e0c6 };
    extern WORD drac2timer3 = { "", 0x005b7538 };
    extern WORD drac2action = { "", 0x0062e0b0 };
    extern WORD drac2atknum = { "", 0x0062e108 };
    extern WORD drac2fire1vert = { "", 0x006317a6 };
    extern WORD drac2fire2vert = { "", 0x00631862 };
    extern WORD drac2fire3vert = { "", 0x0063191e };
    extern int counter = 0;     // Invalid.
    if (drac2tag == 35 && drac2action == 5 ) { drac2timer3 = 666; }
    if (drac2tag == 35 && drac2action == 4 && drac2timer3 >0 && paused == 0 ) { drac2timer3--; }
    if (drac2tag == 35 && drac2timer3 > 0 ) { drac2atknum = 2; }
    if (drac2tag == 35 && counter = 0) { drac2fire1vert = 13; counter++; }
}


This code would compile except for the “extern int counter = 0;” line.

But just a hint to improve speed, you really should only check drac2tag once.

Code: Select all
if ( drac2tag == 35 ) {
    if ( drac2action == 5 ) { drac2timer3 = 666; }
    if ( drac2action == 4 && drac2timer3 > 0 && paused == 0 ) { drac2timer3--; }
    if ( drac2timer3 > 0 ) { drac2atknum = 2; }
    if ( counter = 0) { drac2fire1vert = 13; counter++; }
}



L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby esco » Wed Nov 22, 2006 1:44 pm

Looks like you beat me to it, lol. I was gonna ask why it slows down the program a bit, but after I changed it and used the lock option... I notice NO slowdown at all now. Thanks for the help again dawg. :D

P.S. You probably know this already but... if I scroll the selection with the scripts off the screen, they STILL do not exeucte... even using the LOCK function. Not a big deal at all though.

EDIT: yeah I knew that script had errors... it was a snippet from an old script that wasn't fully done yet. But if your curious as to how I put your program to use, let me know. I'll be happy to tell you where to get EPSXE, the castlevania: sotn iso, and I can aim/msn/yahoo you the file with all the scripts for you to try.
Esco.... the name says it all. New Yorikan for life.
User avatar
esco
NULL
 
Posts: 148
Joined: Mon Sep 18, 2006 2:25 am
Location: Florida, a.k.a. the US's version of hell!

Postby L. Spiro » Wed Nov 22, 2006 2:17 pm

I assume you have checked to ensure that the items are “locked”.
Writing a Lock() function will do nothing if the item is not locked.



One more tip for speed, you should declare these extern values outside of the function.
The actual line of declaration requires a few instructions and must be done each time the function is called.
Since you already know the addresses of the extern variables, you can just declare them globally (outside of any functions) and access them from any function.

Then they will be declared once during compilation and never again, saving time in your function.

If you have extern variables that change addresses, you would make those local to the function.

For example, a typical Lock() function might do this:

Code: Select all
VOID Lock( MHS_ADDRESS aAddress ) {
    extern BYTE bThis = { "", aAddress };
    bThis = 255;
}

In this example, we don’t know the address. It is passed to the function (calculated by GetFinalAddress() by the way), but whatever the address is we set it to byte 255.
If speed is an issue and you know the address every time, you can save speed by declaring bThis as global and specifying the address you want.

Otherwise, this method is preferred because the address may change (hence the whole reason for GetBaseAddress() and GetFinalAddress(), which are typically used to follow pointers (GetFinalAddress()) or in emulators find the pointer to the ROM (GetBaseAddress()).
If your emulator ever stores the ROM image to another location in RAM, well, I guess you’ll find out for yourself.


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby esco » Wed Nov 22, 2006 3:43 pm

L. Spiro wrote:I assume you have checked to ensure that the items are “locked”.
Writing a Lock() function will do nothing if the item is not locked.


PFFFT, I'm not THAT green at this Serio. :P I checked it, and it works fine... AS LONG AS THE MEMORY ADDRESS IS DISPLAYED IN THE MEMHACK SCREEN. But let's say I have a lot of values, and I scroll down and it goes out of view... THEN it won't execute.

EDIT: on closer inspection.. it only seems to happen now if I scoll it off the TOP view of the program screen, not the bottom. I'll test it further and let you know if I'm wrong, but it seems that way as of now.

One more tip for speed, you should declare these extern values outside of the function.
The actual line of declaration requires a few instructions and must be done each time the function is called.
Since you already know the addresses of the extern variables, you can just declare them globally (outside of any functions) and access them from any function.


I mentioned doin this time to you before, but I didn't know whether or not you had implemented it yet in this release. So how exactly do I declare them globally and where? I'm assuming doin it under the lock box screen won't work, so I need to do it under the scripts box then right?

In my case, a LOT of the addresses never change... for things like individual enemy data, yes those change (based on where enemy spawns etc.), but each game the memory values are indeed the same. But there is a LOT of perm data that never changes so declaring global variables would be a huge help to me. So per say, how could I make this variable global:

MHS_ADDRESS GetBaseAddress() {
richterstart();
return 0x0070b5f6;
}
VOID Lock( MHS_ADDRESS aAddress ) {
richterstart();
}
//example script, W00T!/
void richterstart() {
extern WORD flamewhiphearts = { "", 0x0070b5f6 };
//Text.... GIGGIDY GIGGIDY GIGGIDY!/
if (flamewhiphearts == 10) { flamewhiphearts = 15;}

}

Also for some reason whenever I seem to try a while do loop, it freezes and I have to close it with task manager or by clicking the x, and then ending it as a non-responsive program. This seems to happen a lot if I declare a loop incorrectly, or it might be if it reads it as an infinite loop, rather than returning an error it freezes. But I don't know cuz I test compile it under the script editor and it returns no errors at all ( yes I made sure the script is loaded first). :)

//snippet of loops (assume) all variables declared properly/
if (richtercantmove = 5){
do {tapuptimer = 0;}
while (richterframe != 8);}
Esco.... the name says it all. New Yorikan for life.
User avatar
esco
NULL
 
Posts: 148
Joined: Mon Sep 18, 2006 2:25 am
Location: Florida, a.k.a. the US's version of hell!

Postby L. Spiro » Thu Nov 23, 2006 10:14 am

on closer inspection.. it only seems to happen now if I scoll it off the TOP view of the program screen, not the bottom. I'll test it further and let you know if I'm wrong, but it seems that way as of now.

I’ve tested it also and it works fine both ways.
Lock() has nothing to do with the screen at all.
The section that handles Lock() has no idea what items are on the screen and which are not. It won’t stop updating either way.
If you want to test it to be sure:


Code: Select all
VOID Lock( MHS_ADDRESS aAddress ) {
    extern BYTE bThis = { "", aAddress };
    bThis = Random( 256 );
}


Every time the item is updated its value with be changed to something random.
From there, just watch the value in the Hex Editor (which has real-time display) and you can see it changing at all times, whether visible or not.



how could I make this variable global

Code: Select all
MHS_ADDRESS GetBaseAddress() {
    richterstart();
    return 0x0070b5f6;
}
VOID Lock( MHS_ADDRESS aAddress ) {
    richterstart();
}
//example script, W00T!
extern WORD flamewhiphearts = { "", 0x0070b5f6 }; // Now it is global.
void richterstart() {
    //Text.... GIGGIDY GIGGIDY GIGGIDY!
    if (flamewhiphearts == 10) { flamewhiphearts = 15;}
}



I'm assuming doin it under the lock box screen won't work, so I need to do it under the scripts box then right?

You do it in the same place as where your functions are.
On the item itself either in Script Lock or Script Address (you’ve noticed they are the same section of code).



Code: Select all
//snippet of loops (assume) all variables declared properly
if ( richtercantmove =[b]=[/b] 5 ) {
    do {
        tapuptimer = 0;
    } while ( richterframe != 8 );
}


Firstly, you have an assignment operator (=), not a comparison operator (==).

Secondly, if richterframe is local, your loop will never end. It’s never changed inside the loop, so how can it ever become 8?

If richterframe is external, your loop will only end when richterframe becomes 8 in the game, AND if the code checks it at that time.
So it will freeze until the game sets richterframe to 8.


If a loop freezes, you need to examine your code.
If you want to put a simple timer into the loop to make sure it always breaks after X amount of time:

Code: Select all
DWORD dwTime = Time();
//snippet of loops (assume) all variables declared properly
if ( richtercantmove =[b]=[/b] 5 ) {
    do {
        tapuptimer = 0;
    } while ( richterframe != 8 && Time() - dwTime < 1000 );
}

This ensures your loop will never last longer than 1 second.


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby esco » Thu Nov 23, 2006 1:10 pm

L. Spiro wrote:
Code: Select all
//snippet of loops (assume) all variables declared properly
if ( richtercantmove =[b]=[/b] 5 ) {
    do {
        tapuptimer = 0;
    } while ( richterframe != 8 );
}


Firstly, you have an assignment operator (=), not a comparison operator (==).

Secondly, if richterframe is local, your loop will never end. It’s never changed inside the loop, so how can it ever become 8?

If richterframe is external, your loop will only end when richterframe becomes 8 in the game, AND if the code checks it at that time.
So it will freeze until the game sets richterframe to 8.


If a loop freezes, you need to examine your code.
If you want to put a simple timer into the loop to make sure it always breaks after X amount of time:

Code: Select all
DWORD dwTime = Time();
//snippet of loops (assume) all variables declared properly
if ( richtercantmove =[b]=[/b] 5 ) {
    do {
        tapuptimer = 0;
    } while ( richterframe != 8 && Time() - dwTime < 1000 );
}

This ensures your loop will never last longer than 1 second.


L. Spiro


Aight... let me explain what I'm tryin to do... basically when richter does a move... the value at richtecantmove = 5... the minute the move ENDS this value changes to 0.... then he start falling downward... so I'm basically tryng to set it up so until he lands and goes into his landing frame he can't do the move again.

In coding terms: I want to set it so that once the value at richtercantmove equals 5 withiin the game itself (It doesn't change because of my script, the game changes it), it executes a script freezing the value at tapuptimer to 0, UNTIL the value at richterframe = 8 or 17 or 152 or 1 (due to the game itself changing it... my script doesn't change it). Until then I want the value in uptimer to stay frozen at 0... any ideas?

here is my code (minus the variable declarations, and the returns for the value stored in tapuptimer back to the address):

if (richtercantmove == 5){
do {tapuptimer = 0;}
while (richterframe != 8 || richterframe != 17 || richterframe != 152 || richterframe != 1 && Time() - dwTime < 1000);}
Esco.... the name says it all. New Yorikan for life.
User avatar
esco
NULL
 
Posts: 148
Joined: Mon Sep 18, 2006 2:25 am
Location: Florida, a.k.a. the US's version of hell!

PreviousNext

Return to General Related Discussions

Who is online

Users browsing this forum: No registered users and 0 guests