Resurrection Posted June 30, 2008 Posted June 30, 2008 What am I doing wrong? $Server = Iniread( "AL.ini", "Server", "", "" ) if $Server = Iniread( "AL.ini", "Server", "1", "" ) Then Sleep(1500) MouseClick("left", 512, 155, 1, 2) ElseIf $Server = Iniread( "AL.ini", "Server", "2", "" ) Then Sleep(1500) MouseClick("left", 512, 700, 1, 2) EndIf It only reads number 1 I really don't know why.
Champak Posted June 30, 2008 Posted June 30, 2008 (edited) Change "ElseIf" to "Else" and get rid of that "Then", or put that line just below "ElseIf" on the same line as "ElseIf". Untested. Edited June 30, 2008 by Champak
Resurrection Posted June 30, 2008 Author Posted June 30, 2008 $Server = Iniread( "AL.ini", "Server", "", "" ) if $Server = Iniread( "AL.ini", "Server", "1", "" ) Then Sleep(1500) MouseClick("left", 512, 155, 1, 2) Else $Server = Iniread( "AL.ini", "Server", "2", "" ) Sleep(1500) MouseClick("left", 512, 700, 1, 2) EndIf You mean like that? Cause with that it still selects number 1.
Champak Posted June 30, 2008 Posted June 30, 2008 (edited) I believe you have the syntax wrong. You are looking for the value of what is supposed to be 1 or 2. So if I understand what you are doing, you are looking for, let's say "Dog", and if "Dog" is 1 do this, and if "Dog" is 2 do that, so you need to do this. $Server = Iniread( "AL.ini", "Server", "Dog", "" ) Sleep(1500) if $Server = 1 Then MouseClick("left", 512, 155, 1, 2) Else MouseClick("left", 512, 700, 1, 2) EndIf Edited June 30, 2008 by Champak
Resurrection Posted June 30, 2008 Author Posted June 30, 2008 (edited) That code does work for me but the problem is there are 6 servers not 2 so how can I make a different between that? EDIT: I just saw your edit ill just go try that. EDIT: That second code doesn't select any of them. Edited June 30, 2008 by Resurrection
Champak Posted June 30, 2008 Posted June 30, 2008 (edited) That's what the second example is for. So you'd do: $Server = Iniread( "AL.ini", "Server", "Dog", "" ) Sleep(1500) if $Server = 1 Then MouseClick("left", 512, 155, 1, 2) ElseIf $Server = 2 Then MouseClick("left", 512, 700, 1, 2) ElseIf $Server = 3 Then MouseClick("left", 512, 700, 1, 2) ElseIf $Server = 4 Then MouseClick("left", 512, 700, 1, 2) ElseIf $Server = 5 Then MouseClick("left", 512, 700, 1, 2) ElseIf $Server = 6 Then MouseClick("left", 512, 700, 1, 2) EndIf If it is just two options you would use "Else" like the first one, if you have multiple options like you do you would use "ElseIf" like the second one and this. Edited June 30, 2008 by Champak
Resurrection Posted June 30, 2008 Author Posted June 30, 2008 That code also doesn't work, I think the error is my ini here it is: Username= Password= Server=2
Champak Posted June 30, 2008 Posted June 30, 2008 (edited) [server] Username= Password= Dog=2 Or in your case You would look for it like $Server = Iniread( "AL.ini", "Whatever Name", "Server", "" ) and your ini would look like [Whatever Name] Username= Password= Server=2 Edited June 30, 2008 by Champak
phaze424 Posted July 1, 2008 Posted July 1, 2008 (edited) That code also doesn't work, I think the error is my ini here it is: Username= Password= Server=2That's not correct INI syntax. It should be: [Info] Server=something Password=something Username=something However, your ini doesn't have any sections. If you use this sample INI, you could use $Server = IniRead("C:\Config.ini", "Info", "Server", "") to get the server value. EDIT: Heh, Champak beat me to it. Nothing to see here. Move along. >_> Edited July 1, 2008 by phaze424
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now