Dialog help please!

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Marcdk
Junior Coder
Posts: 36
Joined: Sat Sep 22, 2007 10:16 pm

Dialog help please!

Post by Marcdk » Sat Sep 29, 2007 9:54 pm

Hi again :)

I have made my script, and now i want to make a dialog to it, so it looks nice when u open the bot :)

I made one with the dialog designer, it looks like this:

Image

Well, but the messege in box 2 and 3 is invisible when i run the script, and i tried a lot to fix it :cry: but i cant, here it is:
- i think there are some bugs into this dialog too cause when i put the code in my script it says: Error in trying to create dialog:dialog1
Then i press ok, and it says: Error in EditInFile Command.


Dialog>Dialog1
Caption=Marcdk's Advanced Abuse Bot
Width=411
Height=263
Top=212
Left=148
Label=Choose Your Settings:,16,16,true
Label=Game Mode:,24,56,true
Label=Race:,112,56,true
Label=Language,184,56,true
ListBox=Race,104,72,49,60,Human%CRLF%Orc%CRLF%Undead%CRLF%Nightelf
ListBox=Game,24,73,57,30,Invite%CRLF%Accept
ListBox=Language,184,72,49,30,English%CRLF%German
Button=Start Bot,280,24,75,25,0
Label=Stop Bot: Press Alt + Escape,256,56,true
Button=Read This,280,80,75,25,0
Edit=msEdit1,216,120,145,Hi, gl hf
Edit=msEdit2,216,152,145,Please leave, we next :D
Edit=msEdit3,216,184,145,Okay u next !
Label=Messege 1,160,128,true
Label=Messege 2,160,160,true
Label=Messege 3,160,192,true
EndDialog>Dialog1

---------------------------------------------------------------------------------------

This was just one of my problems, here comes the next! :/

I have readed much of the readme for the program, but i still cant get this to work!

I want when "at accept" is chosen, and a Race, and a language, and u press Start bot, it goes to a label, but i have much of labels, i have a main label, and labels for one single race (human, orc, nightelf and so on)

In the main label i have this:

Label>start
MouseMove>735,619
wait>1
Lclick
wait>0.5
GetPixelColor>453,126,color
If>color=3735552
Goto>Human
endif
Goto>start

- As u can see it goes to Human Label, but if Orc is chosen in the dialog how do i make a variabel that says it must go to the Orc Label?

I hope anyone understands this, and give some help :/ I would really apreciate that :) thx!

//Marcdk

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sun Sep 30, 2007 6:24 am

Hi,
Your message 1 and 2 appear empty when predefined within your dialog block because you have a comma (,) in the edit object string in a position that tells the script that you want to include a password character (see dialog help). And in this case the password character is a space character so the field appears empty but actually contains several spaces. This will only be a problem for your predefined text. One way to solve this is to set the comma character to a variable then use the variable in the predefined text.

Code: Select all

Let>comma=,

Dialog>Dialog1
Caption=Marcdk's Advanced Abuse Bot
Width=411
Height=263
Top=212
Left=148
Label=Choose Your Settings:,16,16,true
Label=Game Mode:,24,56,true
Label=Race:,112,56,true
Label=Language,184,56,true
ListBox=Race,104,72,49,60,Human%CRLF%Orc%CRLF%Undead%CRLF%Nightelf
ListBox=Game,24,73,57,30,Invite%CRLF%Accept
ListBox=Language,184,72,49,30,English%CRLF%German
Button=Start Bot,280,24,75,25,3
Label=Stop Bot: Press Alt + Escape,256,56,true
Button=Read This,280,80,75,25,4
Edit=msEdit1,216,120,145,Hi%comma% gl hf
Edit=msEdit2,216,152,145,Please leave%comma% we next Very Happy
Edit=msEdit3,216,184,145,Okay u next !
Label=Messege 1,160,128,true
Label=Messege 2,160,160,true
Label=Messege 3,160,192,true
EndDialog>Dialog1
A partial answer to your second question is look for the variable "dialog1.race" to be equal to the text Orc.

If>dialog1.race=Orc
goto>Orc
EndIf


Of course you need to have a label called Orc for this to work.

More of the answer is that your buttons are not defined completely. At the end of button object definitions there is a number, that number lets the script know when a button has been selected. Both of your buttons have a "0" at the end, this means that they are non functional. Notice in the rewritten script I placed in a 3 and a 4 at the end of your button definitions.

There are two ways to display a dialog using the Show> function. One way makes the dialog modal, the other way makes the dialog non-modal. Using the modal method as an example, your Show> function will have two parts. the dialog name (followed by a comma) then a variable. When a button is pressed in a dialog the variable will capture the value of the button number.

Therefore:
Show>dialog1,result1

Will pause the script (modal) and the script will not continue until a button is picked OR the upper right hand "X" is picked to close the dialog window. At the time of one of these events occurring, the value of the variable result1 will become the number at the end of the pressed button OR 2 if the "X" is selected.

Therefore you can control the script by using the value of the variable result1

If>result1=2,end
If>result1=3,start
If>result1=4,ReadThis


See help for dialog then study and understand the examples of modal and non-modal dialogs. Dialogs are one of the most outstanding features of Macro Scheduler. It pays to understand how they work.
- i think there are some bugs into this dialog too cause when i put the code in my script it says: Error in trying to create dialog:dialog1
Then i press ok, and it says: Error in EditInFile Command
The answer to this question is probably that you have your dialog block in a loop so the dialog block is called a second time. A dialog block that is called once is defined, calling the block again will result in the errors you have described.

Marcdk
Junior Coder
Posts: 36
Joined: Sat Sep 22, 2007 10:16 pm

Post by Marcdk » Sun Sep 30, 2007 8:36 am

Okay, i haven't tried out what u just posted, but oh my god!

Thx for reply, SO fast, and SO good, i understand this much better now! Thx :D

Damn, thx for your time to help me man, damn i apreciate that :)

Marcdk
Junior Coder
Posts: 36
Joined: Sat Sep 22, 2007 10:16 pm

Post by Marcdk » Sun Sep 30, 2007 9:52 am

Okay, sorry for double post :P

I got messege 2+3 to show :) Nice

Well, but i have a bug, i cant fix that, and im still a total noob to this

Here is my script..
Let>comma=,
Dialog>Dialog1
Caption=Marcdk's Advanced Abuse Bot
Width=411
Height=263
Top=212
Left=148
Label=Choose Your Settings:,16,16,true
Label=Game Mode:,24,56,true
Label=Race:,112,56,true
Label=Language,184,56,true
ListBox=Race,104,72,49,60,Human%CRLF%Orc%CRLF%Undead%CRLF%Nightelf
ListBox=Game,24,73,57,30,Invite%CRLF%Accept
ListBox=Language,184,72,49,30,English%CRLF%German
Button=Start Bot,280,24,75,25,1
Label=Stop Bot: Press Alt + Escape,256,56,true
Button=Read This,280,80,75,25,2
Edit=msEdit1,216,120,145,Hi%comma% gl hf
Edit=msEdit2,216,152,145,Please leave%comma% we next!
Edit=msEdit3,216,184,145,Okay u next !
Label=Messege 1,160,128,true
Label=Messege 2,160,160,true
Label=Messege 3,160,192,true
EndDialog>Dialog1


Label>MainLoop
Show>Dialog1,result
If>result=2,Credit
If>result=1,StartBot


Srt>StartBot
Goto>start
End>StartBot

Srt>Credit
MessageModal>Thanks To Naga For Help With This Bot!
End>Credit

Goto>MainLoop

Label>start
WindowAction>open,Warcraft III
MouseMove>735,619
wait>1
Lclick
wait>0.5
GetPixelColor>453,126,color
If>color=3735552
If>dialog1.race=Human
goto>Human
endif
If>dialog1.race=Orc
goto>Orc
endif
If>dialog1.race=Undead
goto>Undead
endif
If>dialog1.race=Nightelf
goto>Nightelf
EndIf
Goto>start
When i try to run this it says: Missing else/endif

As you can see i have a Label for each races, but i really dont know if this is the right way to code it :P

Another problem is that if i hit the "X" at the corner of the bot to close it, the subrotine Credit is running, how do i fix that?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Sep 30, 2007 9:57 am

1. You have no Endif to match this line:

If>color=3735552

2. 2 is the value returned by the dialog when you close it using the close button at the top right (X). But you have also used 2 as the value that triggers your "Credit" routine. Solution: Use a different value for the button that starts the credit routine:

Button=Read This,280,80,75,25,20

..
..

If>result=20,Credit

3. Prevent the loop continuing if close (X) is pressed:

If>result2
Goto>MainLoop
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Marcdk
Junior Coder
Posts: 36
Joined: Sat Sep 22, 2007 10:16 pm

Post by Marcdk » Sun Sep 30, 2007 10:41 am

Thx again for the fast reply, but its not working :/

If i close the bot, at the (X) it runs Label>start
- Bwah this is so frustrating, dialogs is harder then i thought
And another thing, take a look at this code:
Label>start
WindowAction>open,Warcraft III
MouseMove>735,619
wait>1
Lclick
wait>0.5
GetPixelColor>453,126,color
If>color=3735552
endif
If>dialog1.race=Human
goto>Human
endif
If>dialog1.race=Orc
goto>Orc
endif
If>dialog1.race=Undead
goto>Undead
endif
If>dialog1.race=Nightelf
goto>Nightelf
EndIf
Goto>start
I want, that when the pixelcolor is true, it has to go to one of the Labels, the label that is chosen in the dialog ofcause (human, Orc etc.) But how do i code that right? because as it is now, it just runs the human label, and the pixelcolor thing doesn't work..
Any soluttions to this?

Edit:


Please Someone delete all these posts, i hit the quot button instead of edit button, sorry :(

Marcdk
Junior Coder
Posts: 36
Joined: Sat Sep 22, 2007 10:16 pm

Post by Marcdk » Mon Oct 01, 2007 4:16 pm

Nobody who can help? Sorry but i need this bot to be finished soon :/ Im gratefull for all your help, so now i pray for someone who can help me with this.

Please help someone :/ thx!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Oct 01, 2007 4:21 pm

Put a label right at the very end of the script:

Label>endit

If the result of the dialog is 2 (the user cancelled - clicked X) go to this label:

If>result=2,endit
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Marcdk
Junior Coder
Posts: 36
Joined: Sat Sep 22, 2007 10:16 pm

Post by Marcdk » Mon Oct 01, 2007 5:10 pm

Sorry but i dont understand this :/

if i make this line:

If>result=2,endit

then i need a subroutine like this:

Srt>endit
bla bla, close bot
End>endit

or am i wrong? bwah, i dont understand this, and to my first question, which is a bit more important for me right now, how do i code this?

Label>start
WindowAction>open,Warcraft III
MouseMove>735,619
wait>1
Lclick
wait>0.5
GetPixelColor>453,126,color
If>color=3735552
endif
If>dialog1.race=Human
goto>Human
endif
If>dialog1.race=Orc
goto>Orc
endif
If>dialog1.race=Undead
goto>Undead
endif
If>dialog1.race=Nightelf
goto>Nightelf
EndIf
Goto>start

I have a main label, and then some others.. The "start" label is the one that starts when the start button in the dialog is pressed, then the mousemoves to a sertain spot, and press left mouse button down,
- The window will change, and then, i need to code which of the following labels the bot will use: Human, Orc, Undead, Nightelf, these labels is selected by the user in the dialog,

as u can see in my code, it waits for a pixelcolor before it runs the next (which is a label chosen in the dialog: Human, orc, undead etc. etc.)

If this is written too complicated, please look in the script, :P i think u will understand it,

I just need a way to code this, any help? please, i need it so much :)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts