Jump to content
AC Tool Forums

The WABBIT

Moderators
  • Content Count

    547
  • Joined

  • Last visited

Everything posted by The WABBIT

  1. I have one question. What Windows are you running it on? And are you using the Classic Windows theme?
  2. are those test being done with Divide's window being smaller than the full screen? And is the image from the d_screen.bmp or from a screen capture of the window only, from another program?
  3. Okay, try this. with Divide opened and not Maximized. resize the window so that it is not full screen. The redo the test and see if you can see a difference. And go ahead and post the full image here.
  4. If you compare what you see in the image. Is it the same as what you actually see on the desktop with Divide's window?
  5. Update: Okay after testing v0.4.2 and trying to find Divide's own icon. I had found a few issues. I fixed the issue of using SetActiveWindow causing Divide's Maximized window, and quite possibly others, to return to Normal window state. I fixed a problem/error with the CreateObject that I had fond. And in the process made it better with code that I was working on for the next version. And I think that I found what the problem is with the IsObject. And I have corrected it. Well, I think I did anyways. Now, I have to ask you do some for me. I need you to run your test code, from before, for a test. (Actually, I need to do two tests.) And yes, I do need you to perform the tests in the version of Divide that you have. The first test: Once Divide is running, load in, or type in, the script from before. From the menu select Script > Test Mode and click on Save Bitmaps from Color Commands. If you were to look at this option again, it should be checked. Run your script as it. Don't worry if Divide is not Maximized. Go to the directory that you have Divide installed in. In this directory, there should be a bmp file with the name of d_screen.bmp (or d_screen if you can't see file extensions). I need you to look at this image. In Windows 7 you can view the image by Right-clicking on it, and selecting Preview. I am not sure on how to do it in Windows 8.x or 10. Examine Divide's window in the image. Does the window look okay? Do you see everything for the window? Including it's borders around the window? Jot down what problems, if any, that you see. The second test: Keeping the window with the d_screen.bmp image open. Maximize Divide's window. Run your script again. Return Divide's window to normal. Bring the window showing d_screen.bmp. Examine Divide's window in the image. Does the window look okay? Do you see everything for the window? Including it's borders around the window? At this point, I need you to tell me what problems, if any, that you have seen in the image for both tests. You do not need to post the image. Just describe to me what you see. It shouldn't take you more than a few minutes to do this. I'll be logged into the forums until about 1AM MTD (UTC -6) tonite. So, I'll be available until then.
  6. Alright, I don't what's going with the IsObject and CreateObject. But, I am working on them right now.
  7. okay. Now the object that you are looking for in the script above. Is it in the game itself? Or is it someplace on the web browser?
  8. Okay, I have to ask. what game is this for? And what exactly are you trying to find? Are you trying to find it in the game? or in something else?
  9. First of all, the test coordinates are not the same as what you had in your original code that you posted. There you had: if IsObject('d', 1041, 123) then And Second, in AC Tool, unless you are checking for an object that is on your desktop. You have to set the window for the Application/Game as the active window. Before you check for any objects. It is the same for Divide. Unless you are checking for something on your Windows Desktop. You have to set the Application's/Game's window as the active window. Then you check for the object. Example: Uses Classes, Divide; var MyObject: TDivObject procedure initMyObject; begin // code to initialize the object goes here. end; begin { Initialize the object } MyObject; { set the window as the active window } SetActiveWindow('Window Name/Title'); { Delay for 2 seconds to allow the window to become the active window. This delay is necessary, because even on the same system. It can take from a fraction of a second to 2 seconds for the window to be brought forward and become the active window. And the amount of time is different each time. } Delay(2, 'sec'); { No we test for the object } if IsObject(SomeObject, 0, 0) then TimeStamp('Object found.') else TimeStamp('Object not found'); end;
  10. To help show you the proper coding style. I edited your script to the following: uses Classes, Divide; var d: TDivObject; procedure dd begin d := TDivObject.Create; with d do begin Def.Add('128=0,0|128=0,2|128=0,4'); Def.Add('212=2,0|212=2,2|212=2,4'); Def.Add('128=4,0|128=4,2|128=4,4'); end; end; begin dd; if IsObject(d, 1041, 123) then begin timestamp ('cave'); delay (3000); end else begin timestamp ('notcave'); delay (3000); end; end; Other than that, I don't see anything wrong. And since you said it works. I didn't bother to do more than a glance at it.
  11. @minimxWell, I hope that the new information will help you.
  12. There is a couple of problems with the code. And both problems are because of the information given in the help file. Problem 1: Even though the information to declare and initialize the DivObject is present. You had failed to initialize the DivObject. Solve 1: See Objects in Divide in the Help file. The information given here is not complete. But, it does give you the information to properly initialize the DivObject. Problem 2: The syntax given in the Help file for the IsObject function is wrong. And the code given in the Example should be better than what's there. Solve 2: I have been working on the Help file for that last several weeks. Trying to catch problems like this. And to make it better by giving better examples. Examples that actually work if you copy and paste the code into Divide. Although I had not gotten to redoing the IsObject page in the Help file. I went ahead and done so, so that I can post the proper information here for you. IsObject: IsObject Description: IsObject is a function that will check to see if a object, defined in a DivObject, is present on the screen. Then it will return a value of True or False as to whether or not the object was found. More information on how to use Object in Divide. See Objects In Divide Syntax: IsObject(objectName: TDivObject, XCoord: Integer, YCoord: Integer):ReturnValue; Parameters: Parameter Description ObjectName The name of the TDivObject to search for. X Is the X coordinate to start searching for the DivObject at. Y Is the Y coordinate to start searching for the DivObject at. Return value: Value Description Boolean True = the DivObject was found. False = the DivObject was not found. Examples: Example 1 uses Classes, Divide; var objMyTestObject: TDivObject; //declaration of the TDivObject { the procedure to initialize the object that we will be using. } procedure InitMyTestObject; begin objMyTestObject := TDivObject.Create; with objMyTestObject do begin Def.Add('128=0,0|128=0,2|128=0,4'); Def.Add('212=2,0|212=2,2|212=2,4'); Def.Add('128=4,0|128=4,2|128=4,4'); end; end; begin { call the InitMyTestObject procedure to initialize the objMyTestObject so that we can use it. } InitMyTestObject; { Now lets check to see if we can find the object. } if IsObject(objMyTestObject, 583, 256) then TimeStamp('The Object was found.') else TimeStamp('The Object was not found.'); end; Although the example code is complete, proper and will run without any errors. You will not see the TimeStamp in the True block of the if statement. That is because the values used in the definition of the DivObject was just thrown together. But, it is code that you can look at and see the proper way of doing things.
  13. Although I checked the forums multiple of times yesterday. I just now seen your post. So my response is... Okay, after just looking at the code I can see what the problem is. But, running the script verified my findings. And it gave me the chance to post what the error message you should have been getting. And to explain it. When you ran the script above. You should have been getting the RunTime Error shown in the image below: This is one of the Standard RunTime Error messages. As you can see it has a lot of information. But the information that you will need from this error message, is the file/library name, the method/command, and where in the source code to find the problem code. These three things can be found in the following: The file/library name can be found on the second line after 'File Library'. The method/command can be found on the fourth line, It is toward the end of the line surrounded by single quotes (') just before the closing parentheses. And you get the placement in the source code, by looking at the sixth line "Source position". This has the line number and character position of the code causing the problem within the file/library named in the second line. And line five can give you a hint as to what is wrong. And sometimes it doesn't make sense. So, with the above information. We can try to figure out the problem with your script. Okay, so have have a problem with IsObject command/method on line #23 of the Unit1 file/library. And from what it looks like from line five. A parameter being used in IsObject is empty (Null, or nil). And sure enough looking at the code that you have posted. You are passing a wrong parameter to IsObject. But, the problem isn't because of a mistake on your part. It is a mistake on my part. Because after looking at the Help file. For what I have for the IsObject function. I have found that I had given the wrong information. This one is on me. So, I'll post the information in the next post.
  14. @EgoYou might want to read the OP and the rest of the thread again.
  15. Okay, You did great with the formatting. And it is good that you finally got the script to work. But, your formatting can use a tiny bit more work. So, look at the following of your last script: uses divide; begin if 10 > 11 then begin delay(1000); MousePos(646, 359); delay(5000); end else begin bell; if 5 > 6 then begin MousePos(1081, 396); delay(1000); end else begin if 8 > 6 then begin MousePos(28, 411); delay(5000); end else begin delay(1000); end; end; end; delay(1000); MousePos(325, 553); end; Now it you compare this script with yours, you should see the differences. But if not, then here are the differences: I removed the Line comments. And I removed the semi-colon (';') from the end of the end statements that are on the lines before the else statements. This follows the rules for IF statements as laid out in Pascal, and in Divide. You had Delay commands with extra spaces in the command. You placed extra spaces before the ( and after the ). As examples: Delay (1000); Delay (5000) ; You do not need to put extra spaces in like that. And I have properly indented the code to reflect the four different levels. If you can't tell the 4 levels of indentation, then see the following: So You need to start formatting your code like this. And don't forget about the rules for IF statements, as I had already told you in my previous post.
  16. Now the second part of what's wrong with your IF statements. As I mentioned in the previous post. You need to place the keywords begin and end around a block of code that belongs to a IF statement. But in your IF statements, you begin each IF statement code block with a begin. But, you never end the code blocks with an end. That is why you are getting the error message. Divide's script engine is expecting to find an end before it finds an else, just like in Pascal. Now in Pascal, and in Divide, IF statements can be written in several different ways. The first way of writing a IF statement. Is an IF statement that has code that is only executed if the conditional expression is TRUE. Example 1: If HP <= 43 then begin TimeStamp('We need to heal.'); MousePos(65, 258); end; Now, we will look at a IF statement that will execute code if its conditional expression is TRUE and if it is FALSE. Example 2: if HP <= 43 then begin TimeStamp('We need to heal.'); MousePos(65, 258); end else begin TimeStamp('We do not need to heal.'); Delay(500); end; Here we will look at at IF statement that will execute code only if its conditional expression is TRUE. But it only has one statement. Example 3: if HP = 0 then TimeStamp('I'm sorry, but we are dead.'); And here we will look at a IF statement that will execute code if its conditional expression is TRUE and if it is FALSE. But, it only has one statement in both the TRUE block and the FALSE block. Example 4: if IsObject(TestObject, 34, 185) then TimeStamp('The object was found.') else TimeStamp('The object was not found.'); Now in Pascal, as well as Divide, the statement right before an else, within a IF statement, does not end with a semi-colon (';'). And as you can see from Example 2 and Example 4. The statement just before the else does not end with a semi-colon. In Example 2 the statement just before the else is the end. And in Example 4, the line before the else is the TimeStamp('The object was found.'). Guess what? You can mix IF statements with single statements and a block of statements. Example 5: for HP <= 43 then begin TimeStamp('We need to heal.'); MousePos(65, 258); end else TimeStamp('We do not need to heal.'); Example 6: if HP = 0 then TimeStamp('I'm sorry we are dead!') else begin TimeStamp('Do we need to heal?'); CheckHeal; end; And of course, you can nest a IF statement within a IF statement's TRUE and/or FALSE block. if conditional_expression then begin if conditional_express then begin // TRUE code block end; end else begin // FALSE code block. end; As you can see. There is lots of ways to write a IF statement. You can use any one of, or any combination, of the examples above to create your if statement(s). As long as you follow the rules about using begin and end. And that you also follow the rules about the statement just before the else. Otherwise you will get a
  17. Now, for the issues with the IF statements in your script. There is two things wrong with your IF statements. I'll talk about the first one here: The first issue is the conditional expression being used for each IF statement. With the conditional expression for the first IF statement. The second IF statement will never be executed. Then if by some miracle the second IF statement is evaluated. Then MousePos(1081, 396) statement will never be executed. And with the third statement. The delay(1) statement will never be executed. That is if I have read that portion of your code correctly. It is so hard to read that section of the script because of the formatting. That is why I suggested that you go and reformat the script in Divide. To make it more readable for others. What I would suggest is that when you start a IF statement. That you first do the if and its conditional expression. Then open the code block with the begin on the very next line. And then immediately put the closing end on the next line. Then after your open and close the code block. Add in the code that is to be executed in that code block.
  18. Now, I'll talk about code blocks. In Pascal, and Divide, code blocks are blocks of code that belong to a Procedure/Function or to a statement. These code blocks start with the begin key word. And they end with the end keyword. Example: Procedure and Function - procedure SomeProcedure begin // Code block end; function SomeFunction begin // Code block end; Example: FOR statement - for i := 0 to 5 do begin // code block b := 13 * i; TimeStamp('b: '+IntToStr(b)); end; Example: WHILE statement - while i < 32 do begin // code block end; Example: IF statement - if myString = 'This is a test' then begin // code block end; Now, there are certain statements (like repeat...until, case statements, etc) where you do not use a begin, or a end, or both a begin and a end, statement. There is also one exception to beginning and ending a block of code with the begin and end keywords. The exception to this, is when the code in the cold block is a single statement. Then you do not have to use the begin and end keywords. Example: FOR statement - for i := 1 to 15 do TimeStamp('i: '+IntToStr(i));
  19. I'll talk about the semi-colon here. In Pascal, and Divide, the semi-colon signals the end of a statement. And as such you must place a semi-colon at the end of a statement or line of code. There are exceptions to this. Those exceptions are: Comment blocks, you do not put a semi-colon at the end of each line in a comment block. Comment blocks are comments that can be on a single line. Or they can span multiple lines. There are two types of Comment blocks: Those start with { and end with }. And those that start with (* and end with *). Line Comment, is a comment on a single line. It can be by itself on a line. Or it can be after a statement. Like the following: // This is a Line comment. MousePos(23, 35); // This is a Line comment after a statement. You do not put a semi-colon at the end of a line/statement if the line/statement only has, or ends with, of one of the following keywords: uses var const begin then do else of (There might be others, but at the moment I can't think of them.) Now, when you place a Line Comment at the end of a statement. Unless the statement ends with any of the previously mentioned key words. You must use a semi-colon before you start the Line Comment. See the Line Comment examples above.
  20. Well, it is very hard to read. I can't tell what goes with what IF statement. And it is the main reason for the error that you are getting. So I would suggest that you reformat the code in the Divide before posting it. Remove all empty lines. In the Main block remove all the spaces at the beginning of each line. And use the Tab key to indent each line. Use the Tab key to indent each level of block of code. Like the following. begin // Level 0 begin // Level 1 begin // Level 2 begin // Level 3 // Level 4 end; // Level 3 end; // Level 2 end; // Level 1 end; // Level 0 And so on... and so forth... If for some reason Divide it auto-indenting the blocks of code to something like the above. Then just go and fix it by performing #2 and #3 above. If the Tab key still does not give the proper indenting. Then use the Space key to perform the indenting. Use either 2 spaces for each Tab, or use 4 spaces for each Tab. Divide is set to use 2 spaces for each Tab.
  21. While I await for your answer to the question in my previous post. Three this about the posted code sticks out. you defined a variable x, but then you didn't use it. you are not ending those lines of code that require it with the semi-colon (';'). and you are not using the IF statements correctly.
  22. Now, I have a question. Does your code look like what you posted above? With the same formatting and all?
  23. try saving each unit in the project with its own name, File > Save As. Then re-save the project and File > Close All. Once you have done that. Try reloading the project. Both of the Unit tabs should show the name of the Unit file. And your second Unit file should be as it was saved. If not, close Divide and rerun it. Then try to see if the project loads up as it should.
  24. Alright then. In Unit2 remove the addition libraries from the Uses clause. And other then formatting, in both units, I don't see anything problems with what you got.
  25. Ok, three things. Try Ctrl+A and then Ctrl+C to copy and paste. When you post your code. Plz use the Code block to post them. In the post editor, the code block looks like the <> or </> on the menu bar. (depending on the Theme you are using.) Once you have placed your code in then code editor. On the lower right hand side of the Code editor, you will see ComboBox with HTML selected. Click on the ComboBox and select 'No Syntax Highlighting'. Then Click on Insert Into Post button. Your unit2 is missing some code. Specifically the Uses clause. Now if you are not using Unit2. Select the Unit2 tab. Click on File > Close File. And then remove Unit2 from the Uses clause in your Main script file. And then remove the line with MouseMove2 from the Main Block. And while you are at it. Go ahead and remove the MouseMove procedure and the line with MouseMove in the Main Block.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and to our Privacy Policy.