questions about this loop script

Ask for Help on Using the Language With Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

questions about this loop script

Postby SpeedWing » Sun Aug 23, 2009 12:09 am

I know it looks like a enormous text, but please read it, else you might not understand how it works, ( or if you can understand it without reading the descriptions, I am impressed :D )


I wanted to make a script for a tool I'm working on, but I am pretty lazy.
The game has a value for each map, this also means each floor of a cave.
you can teleport to the next floor of a cave by going to a certain X & Y) location, this location can change( about 2 Y or 2 X more). that is why I wanted to make this loop. ( I want to go there automaticly,

too lazy to scroll my mouse at the dropcombo, and look ingame if the game is loading to get to the next floor).

okay now you've read this small amount of text, let's start explaining it.

this is for a cave called "Siros", It has 4 floors.( actually 5 but I never go to there so it isn't needed)

I actually don't know the values of the maps yet, but that will come later.

Let's say I start outside siros that value would be 0.
floor 1 = 1, floor 2 = 2, floor 3 = 3 and so on..


and now the question, I want to be sure that this loop will not eat up my memory and if it could be smaller( I have one cave with 14 floors), at least this was quite clear to me.


Code: Select all
//externs
extern struct H{//X value on the map
   BYTE bBuffer[0x22E];
   DWORD dwValue;      
} * hBase = {"", 0x67CF48};

extern struct V{//Y value on the map
   BYTE bBuffer[0x236];
   DWORD dwValue;      
} * vBase = {"", 0x67CF48};

extern struct Map{// Map value...
   BYTE bBuffer[0x206];
   DWORD dwValue;      
} * mapBase = {"", 0x67CF48};


byte Floor;//this will be the floor that will be chosen ( this will be done with the dropcombo), the dropcombo function will start siros1()
//for example I choose floor 3 at the dropcombo so the variable "Floor" will be 3




void siros1(){
   if(mapBase->dwValue == 0){//this will check if you are at the right map to go to the Siros Cave
   hBase->dwValue = 17002;
   vBase->dwValue = 17317;
   Sleep(50);
   siros2();
   }else{
   siros1();
   Sleep(20);
   }


//to siros 2
void siros2(){
   if (mapBase->dwValue => Floor){
   //I wonder if this would be correct, I wanted to stop the loop.
   }else{
   siros2s();
   }

//to siros 2 loop
void siros2s(){
   if(mapBase->dwValue== siros1/*siros1 value*/){
        hBase->dwValue = 17147;
        vBase->dwValue = 17241;
   Sleep(50);   
   siros3();
   }else{
   //repeat the loop until you are at floor
   siros2s();
   Sleep(20);   
   }
}



//to siros 3
void siros3(){
   if (mapBase->dwValue => Floor){
   //stop the loop
   }else{
   siros3s();
   }

//siros 3 loop
void siros3s(){
   if( mapBase-> dwValue==2){
      hBase->dwValue = 17150;
      vBase->dwValue = 17264;
   Sleep(50);
   siros4();
   }else{
   //repeat the loop until you are at floor 2
   siros3s();
   Sleep(20);
   }
}



//to siros 4
void siros4(){
   if (mapBase->dwValue => Floor){
   //stop the loop
   }else{
   siros4s();
   }

//siros 4 loop
void siros4s(){
   if( mapBase-> dwValue==3){
      hBase->dwValue = 17150;
      vBase->dwValue = 17264;   
   }else{
   //repeat the loop until you are at floor 3
   siros4s();
   Sleep(20);
   }
}


sorry if I made a mistake.
User avatar
SpeedWing
Defragler
 
Posts: 2031
Joined: Tue Jan 01, 2008 1:00 am
Location: If there is a Will there is a Solution.

Postby L. Spiro » Sun Aug 23, 2009 8:25 am

There is nothing significantly wrong or slow regarding the loops.

If you feel it is too heavy on your CPU, increase the sleep times.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron