bvr Posted January 19, 2005 Share Posted January 19, 2005 this is part of the code to a d2 bot. I am having problems with "non"array variables. take a look and point out some other problems, and show me how to fix it. thanks. non-array varable it says $attack[0] expandcollapse popupFunc Attack() $D2attack = StringSplit(StringTrimRight($attack, 1), ";") Local $mouseButton For $i = 1 to $attack[0] $currentAttack = StringSplit($attacks[$i], ",") ;$currentAttack[1] is the hotkey ;$currentAttack[2] is the # of repeats ;$currentAttack[3] is the mouse button ;$currentAttack[4] is the delay If ($currentAttack[3] = 1) Then $mouseButton = "left" ElseIf ($currentAttack[3] = 2) Then $mouseButton = "right" EndIf SendHotKey($currentAttack[1]) Sleep($MouseClick) ;begin attack sequence If ($currentAttack[2] = "H") Then MouseMove($attackX, $attackY, 15, 12, $mouseSpeed) MouseDown($mouseButton) Sleep($currentAttack[4]) MouseUp($mouseButton) Else For $n = 1 to $currentAttack[2] If ($currentAttack[3] = 0) Then;forces a delay if mouse button is 0 Sleep($currentAttack[4]) ElseIf ($currentAttack[3] = 1) Then Send("{SHIFTDOWN}") Sleep(20) MouseClick($mouseButton, $attackX, $attackY, 15, 12, $mouseSpeed) Send("{SHIFTUP}") Else MouseClick($mouseButton, $attackX, $attackY, 15, 12, $mouseSpeed) EndIf Sleep($currentAttack[4]) Next EndIf Next EndFunc Link to comment Share on other sites More sharing options...
JSThePatriot Posted January 19, 2005 Share Posted January 19, 2005 this is part of the code to a d2 bot. I am having problems with "non"array variables. take a look and point out some other problems, and show me how to fix it. thanks.non-array varable it says $attack[0]expandcollapse popupFunc Attack() $D2attack = StringSplit(StringTrimRight($attack, 1), ";") Local $mouseButton For $i = 1 to $attack[0] $currentAttack = StringSplit($attacks[$i], ",") ;$currentAttack[1] is the hotkey ;$currentAttack[2] is the # of repeats ;$currentAttack[3] is the mouse button ;$currentAttack[4] is the delay If ($currentAttack[3] = 1) Then $mouseButton = "left" ElseIf ($currentAttack[3] = 2) Then $mouseButton = "right" EndIf SendHotKey($currentAttack[1]) Sleep($MouseClick) ;begin attack sequence If ($currentAttack[2] = "H") Then MouseMove($attackX, $attackY, 15, 12, $mouseSpeed) MouseDown($mouseButton) Sleep($currentAttack[4]) MouseUp($mouseButton) Else For $n = 1 to $currentAttack[2] If ($currentAttack[3] = 0) Then;forces a delay if mouse button is 0 Sleep($currentAttack[4]) ElseIf ($currentAttack[3] = 1) Then Send("{SHIFTDOWN}") Sleep(20) MouseClick($mouseButton, $attackX, $attackY, 15, 12, $mouseSpeed) Send("{SHIFTUP}") Else MouseClick($mouseButton, $attackX, $attackY, 15, 12, $mouseSpeed) EndIf Sleep($currentAttack[4]) Next EndIf Next EndFunc<{POST_SNAPBACK}>You should include the code atleast that sets that variable. If I dont know how that variable is set or what is in it there is no way I can help you.Let me know about: $attack, $attacks[]Those are just the few I spotted off the bat. One of which happens to be the one in question.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Developers Jos Posted January 19, 2005 Developers Share Posted January 19, 2005 this is part of the code to a d2 bot. I am having problems with "non"array variables. take a look and point out some other problems, and show me how to fix it. thanks.<{POST_SNAPBACK}>$D2attack = StringSplit(StringTrimRight($attack, 1), ";")Local $mouseButtonFor $i = 1 to $D2attack[0] $currentAttack = StringSplit($D2attacks[$i], ",") SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
SlimShady Posted January 19, 2005 Share Posted January 19, 2005 $D2attack = StringSplit(StringTrimRight($attack, 1), ";")Local $mouseButtonFor $i = 1 to $D2attack[0] $currentAttack = StringSplit($D2attacks[$i], ",")<{POST_SNAPBACK}>As JdeB pointed out, it was really obvious.Can't people take a 10 min break and then look at the code carefully? Link to comment Share on other sites More sharing options...
bvr Posted January 19, 2005 Author Share Posted January 19, 2005 Think I got that fixed, now I get this error MouseClick($mouseButton, $attackX, $attackY, 15, 12, $mouseSpeed) Error Incorrect number of parameters in function call Here is my total source. expandcollapse popup$D2Path = iniRead("Settings.ini", "Main", "D2Path", "") $D2Exe = iniRead("Settings.ini", "Main", "D2Exe", "") $D2Parameters = iniRead("Settings.ini", "Main", "D2Parameters", "") $Account = iniRead("Settings.ini", "Main", "Account", "") $Password = iniRead("Settings.ini", "Main", "Password", "") $D2Location = iniRead("Settings.ini", "Main", "D2Location", "") $Attack = iniRead("Settings.ini", "Main", "Attack", "") $pauseButton = IniRead("Settings.ini", "Main", "PauseButton", "{PAUSE}") $attackX = IniRead("Settings.ini", "Main", "AttackX", "602") $attackY = IniRead("Settings.ini", "Main", "AttackY", "138") $D2Load = iniRead("Settings.ini", "Delays", "D2Load", "") $D2Login = iniRead("Settings.ini", "Delays", "D2Login", "") $D2Select = iniRead("Settings.ini", "Delays", "D2Select", "") $D2GameWait = iniRead("Settings.ini", "Delays", "D2GameWait", "") $D2ScriptStart = iniRead("Settings", "Delays", "D2ScriptStart", "") $D2PickUp = iniRead("Settings.ini", "Delays", "D2Pickup", "") $MouseClick = IniRead("Settings.ini", "Delays", "MouseClick", "300") $mouseSpeed = IniRead("Settings.ini", "Delays", "MouseSpeed", "1") LoadD2() ActivateD2() D2Login() D2Location() D2Create() D2Pindle() Attack() Func LoadD2() Run($D2Path & '\' & $D2Exe & ' ' & $d2parameters, $D2Path ) WinWait ( 'Diablo II' ) WinActivate ( 'Diablo II' ) Sleep ( 500 ) WinMove ( 'Diablo II', '', 0, 0 ) Sleep ($D2Load) EndFunc Func ActivateD2() WinActivate("Diablo II", "") Sleep(5000) EndFunc Func D2Login() Send("{TAB}") Sleep(1500) Send($Account) Sleep(1500) Send("{TAB}") Sleep(1500) Send($Password) Sleep(1500) Send("{ENTER}") Sleep($D2Login) EndFunc Func D2Location() Select Case $D2Location = 1 Send("{Enter}") Case $D2Location = 2 Send("{Right}") Send("{ENTER}") Case $D2Location = 3 Send("{Down}") Send("{ENTER}") Case $D2Location = 4 Send("{Down}") Send("{Right}") Send("{ENTER}") Case $D2Location = 5 Send("{Down}") Send("{Down}") Send("{ENTER}") Case $D2Location = 6 Send("{Down}") Send("{Down}") Send("{Right}") Send("{ENTER}") Case $D2Location = 7 Send("{Down}") Send("{Down}") Send("{Down}") Send("{ENTER}") Case $D2Location = 8 Send("{Down}") Send ("{Down}") Send("{Down}") Send("{Right}") Send("{ENTER]") Sleep(500) EndSelect EndFunc Func D2Create() WinActivate ( 'Diablo II' ) WinWaitActive ( 'Diablo II' ) MouseClick( "left", 601, 482 ) Sleep ( 1500 ) $Name = Random ( 100000, 900000 ) $Pass = Random ( 100000, 900000 ) Send ( $Name & '{TAB}' ) Sleep ( 250 ) Send ( $Pass & '{ENTER}' ) Sleep ( $D2GameWait + 250 ) EndFunc Func ExitGame() WinActivate ( 'Diablo II', ',' ) Sleep ( 250 ) Send ( '{ESC}' ) Sleep ( 250 ) Send ( '{UP}' ) Sleep ( 250 ) Send ( '{ENTER}' ) Sleep ( 5000 ) Return EndFunc Func D2Pindle();pindleskin script ;Walk To Portal Sleep($D2ScriptStart) MouseMove(148, 519) MouseClick("left") Sleep(2500) MouseMove(183, 493) MouseClick("left") Sleep(2500) MouseMove(227, 564) MouseClick("left") Sleep(2500) MouseMove(218, 561) MouseClick("left") Sleep(2500) MouseMove(202, 553) MouseClick("left") Sleep(4500) MouseMove(143, 188) MouseClick("left") Sleep(5000) MouseMove(386, 267) MouseClick("left") Sleep(4000) ;walk to Pindle MouseClick("left", 475, 127) Sleep(500) MouseClick("left", 608, 149) Sleep(500) MouseClick("left", 689, 197) Sleep(500) MouseClick("left", 627, 145) Sleep(500) EndFunc Func SendSkillKey($SendSkillkey) Select Case $skillkey="F1" Send("{F1}") Case $skillkey="F2" Send("{F2}") Case $skillkey="F3" Send("{F3}") Case $skillkey="F4" Send("{F4}") Case $skillkey="F5" Send("{F5}") Case $skillkey="F6" Send("{F6}") Case $skillkey="F7" Send("{F7}") Case $skillkey="F8" Send("{F8}") Case $skillkey="F9" Send("{F9}") EndSelect EndFunc Func Attack() $attack = StringSplit(StringTrimRight($attack, 1), ";") Local $mouseButton For $i = 1 to $attack[0] $currentAttack = StringSplit($attack[$i], ",") ;$currentAttack[1] is the hotkey ;$currentAttack[2] is the # of repeats ;$currentAttack[3] is the mouse button ;$currentAttack[4] is the delay If ($currentAttack[3] = 1) Then $mouseButton = "left" ElseIf ($currentAttack[3] = 2) Then $mouseButton = "right" EndIf SendHotKey($currentAttack[1]) Sleep($MouseClick) ;begin attack sequence If ($currentAttack[2] = "H") Then MouseMove($attackX, $attackY, 15, 12, $mouseSpeed) MouseDown($mouseButton) Sleep($currentAttack[4]) MouseUp($mouseButton) Else For $n = 1 to $currentAttack[2] If ($currentAttack[3] = 0) Then;forces a delay if mouse button is 0 Sleep($currentAttack[4]) ElseIf ($currentAttack[3] = 1) Then Send("{SHIFTDOWN}") Sleep(20) MouseClick($mouseButton, $attackX, $attackY, 15, 12, $mouseSpeed) Send("{SHIFTUP}") Else MouseClick($mouseButton, $attackX, $attackY, 15, 12, $mouseSpeed) EndIf Sleep($currentAttack[4]) Next EndIf Next EndFunc Func SendHotKey($hotkey) If (StringLeft($hotkey, 1) = "F") AND (StringLen($hotkey) > 1) Then Send("{" & $hotkey & "}") ElseIf ($hotkey = "NULL") Then ;don't send a hotkey Else Send($hotkey) EndIf EndFunc Link to comment Share on other sites More sharing options...
bvr Posted January 20, 2005 Author Share Posted January 20, 2005 any suggestions? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 20, 2005 Developers Share Posted January 20, 2005 Think I got that fixed, now I get this errorMouseClick($mouseButton, $attackX, $attackY, 15, 12, $mouseSpeed)Error Incorrect number of parameters in function call<{POST_SNAPBACK}>Well what do you think looking at the syntax in the helpfile?MouseClick ( "button" [, x, y [, clicks [, speed ]]] )i count 5 parameters... and how many do you have ????? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
pcdestroyer Posted January 20, 2005 Share Posted January 20, 2005 (edited) dude ... that's rishodi's pindle bot and the function is MyRmouseClick not just mouse click ... i kinda made a pindle bot and i used some of Rishodi's stuff ... about the mouse click u need a few functions here they are: Func MyRMouseClick($button, $x, $y, $xFactor, $yFactor, $speed) MyRMouseMove($x, $y, $xFactor, $yFactor, $speed) MouseClick($button) EndFunc Func MyRMouseMove($x, $y, $xFactor, $yFactor, $speed) MyMouseMove(Random($x - $xFactor, $x + $xFactor), Random($y - $yFactor, $y + $yFactor), $speed) EndFunc Func MyMouseMove($x, $y, $speed) MouseMove($x, $y, $speed) EndFunc Edited January 20, 2005 by pcdestroyer Link to comment Share on other sites More sharing options...
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