Need Help! Making a simple Bot

03/28/2019 00:44 Bad Head Trip#1
I just want to make a bot to trade Nicholas for GotHs in presearing. If i am being honest I have no idea how to start it. I have Autoit 3 and a bot develper as well as GWToolbox++. I just want a simple GUI, a character Select and a Start button. I am doing a simple bot to kinda learn about how to code you know? Any help or advice, hell even sources for help would be appreciated.


Thanks
Bad Head Trip
03/28/2019 11:38 rheek#2
Many of us started with editing existing bots. They usually come with a GUI to select a character, a start button and often even some statistics. So you won't have to deal with all the initialisation and GUI part, which gives you a real headstart. If you edit an existing bot, this could be a useful first bot project. If you want to start with your own GUI and want to do the init part yourself, then you will have a very hard time if you never coded before.

If you go the route I suggest, you would have to find the main function of the bot and edit that function so it does what you want. Which is basically map traveling and running to the location of Nick and then trading him. Map traveling is done via simple functions, you will have to lookup the mapids. For the running part, get coordinates for the path with either BotDeveloper or TB++. Just click to move your way to Nick like you would normally do. Take a look at how others did things similar to what you want to do, as they are probably more experienced. I dont know if theres anything to trade with Nick already. So maybe you will have to figure that one out yourself. CtoGS (Client to GameServer) Paket analysis with the Bot Developer may help there.

There will be a lot of functions in the bot that are only useful for the original bot. These can be deleted, but I would suggest keeping them until your bot is ready and tested. Then delete all the dead code and try the bot again. If it complains sth is missing, restore that function from a backup.

Good luck!

edit:
Just thinking about it you should have a look at the "Nicholas The Traveller - Farm Thread". Those bots there are really minimalistic. They port to a city, run out, follow a set path (and kill everything they see) and pick up drops. Change the mapids and path, as well as the AggroMoveToEx function to just MoveTo, so it does not try to kill every foe, and you're good for everything other than trading with Nick.
03/28/2019 13:19 Bad Head Trip#3
ok there is a bot thats been updated just a few days ago from a friend of mine @[Only registered and activated users can see links. Click Here To Register...]. The PreSearing OmniBot, Theres a function to trade Nicholas. It checks to make sure there is 26 of each item. Maybe i can find the code to trade Nick in there.
Another Question, Is there any way for Autoit to fetch information like what Nicks item is for the day? In-Game, i heard it isnt very possible, but what about fetching this information on a site/URL?

Thank you Rheek for taking the time to reply!!!
03/28/2019 14:30 rheek#4
Check this: [Only registered and activated users can see links. Click Here To Register...]
03/28/2019 16:48 Bad Head Trip#5
oh my! Is this the function? it has both pre and post!!!!! Thank you!!!

Im at a dead end @[Only registered and activated users can see links. Click Here To Register...], how do i make sure that gw.exe is selected? and that the script runs on my character?


i start the bot but nothing happens....

EDIT: The bot starts goes to portal, then after that instead of going straight it goes right and gets stuck. Is there a way to check and make sure that area is loaded before using the moveto function?
03/30/2019 02:22 rheek#6
I guess most of your last post was resolved already. Regarding your last issue:

Quote:
Originally Posted by Bad Head Trip View Post
EDIT: The bot starts goes to portal, then after that instead of going straight it goes right and gets stuck. Is there a way to check and make sure that area is loaded before using the moveto function?
Check this function here, that is already included in your code. It tries to port to an outpost and checks whether it already arrived there. Shouldn't be too hard to adapt to your needs.

Quote:
Originally Posted by Bad Head Trip View Post
Func Farm_GoStartingOutpost()
Local $MapID
If GetMapID() <> $MapID Then ;Fort Ranik
logFile("Moving to Fort Ranik")
Do
RndTravel($MapID)
rndslp(500)
Until GetMapID() = $MapID
EndIf
EndFunc
03/30/2019 19:57 Bad Head Trip#7
Yes I Added one line "WaitMapLoading(162)"

My next project is to add a status Log to the GUI. Im just going to take a look at a couple bots that include one, see what i can get out of them. Ill have to do some tweaking to the GUI. ill show the progress and post when finished.

Thanks @[Only registered and activated users can see links. Click Here To Register...]

04/03/2019 23:17 afmart#8
Quote:
Originally Posted by Bad Head Trip View Post
oh my! Is this the function? it has both pre and post!!!!! Thank you!!!

Im at a dead end @[Only registered and activated users can see links. Click Here To Register...], how do i make sure that gw.exe is selected? and that the script runs on my character?


i start the bot but nothing happens....

EDIT: The bot starts goes to portal, then after that instead of going straight it goes right and gets stuck. Is there a way to check and make sure that area is loaded before using the moveto function?
check out my pre nick farmer, that ive havent been updating here for the lack of interest [Only registered and activated users can see links. Click Here To Register...]
my current unrealeased version works a lot better, but ims still strugling with some figthg function bugs, anyways this is my current nick "trading" function and works like a charm now, if you want to avoid figting just use the MoveTo istead of the aggromove one

Code:
Func GoToSeeNick()
	If GetMapID() <> 166 Then ;Pre-Searing: Fort Ranik
		RndTravel(166)
		Sleep(5000)
	EndIf
	GoOutFin()
	_WaitMapLoadingEx(162)
	Sleep(5000)
	UseSummoningStone()
	AggroMoveToEx(22524, 5743)
	AggroMoveToEx(22501, 4741)
	AggroMoveToEx(21729, 4100)
	AggroMoveToEx(20995, 3418)
	AggroMoveToEx(19987, 3413)
	AggroMoveToEx(18984, 3471)
	AggroMoveToEx(17986, 3373)
	AggroMoveToEx(17006, 3145)
	AggroMoveToEx(16503, 4012)
	AggroMoveToEx(16565, 5014)
	AggroMoveToEx(16698, 6006)
	AggroMoveToEx(16782, 7010)
	AggroMoveToEx(17046, 7976)
	AggroMoveToEx(17210, 8963)
	AggroMoveToEx(16906, 9925)
	AggroMoveToEx(16149, 10586)
	AggroMoveToEx(15221, 10973)
	AggroMoveToEx(14419, 11578)
	AggroMoveToEx(14011, 12497)
	AggroMoveToEx(13648, 13434)
	MoveTo(14380, 14125)
	MoveTo(14735, 15065)
	MoveTo(15116, 15996)
	MoveTo(15278, 16507)
	Out("Talking to Nick")
	;GoToNPCNearestCoords(15278, 16507)
	;GoToNPC("Nicholas Sandford")
	while($iHuntsman >= GetItemCountInventory( $ID_HUNTSMAN_GIFTS))
		GoToNPC( GetNearestNPCToCoords( 15278, 16507))
		Dialog(0x85)
		Dialog(0x86)	
		Sleep(5000)
	WEnd
	$bRunning = False
	ResignAndReturn()

EndFunc