Page 1 of 5

Routing between mosk_dun02 and mosk_dun03

Posted: 30 Apr 2011, 09:21
by sofax222
I play on twRO.
I make effort on the routing between mosk_dun02 and mosk_dun03 fields.
I modify the portals.txt file as :

Code: Select all

mosk_dun01 207 276 mosk_dun02 165 30 0 c c r0
mosk_dun02 168 28 mosk_dun01 201 269 0 c c r0
mosk_dun02 268 117 mosk_dun03 32 135 0 c c r0
mosk_dun03 27 131 mosk_dun02 262 118 0 c c r0
The openkore bot smoothly routes between mosk_dun01 and mosk_dun02.
But not between mosk_dun02 and mosk_dun03.
Even, I rebuild the portalsLOS.txt file.
Only, The openkore bot route from mosk_dun02 to mosk_dun03.
The openkore bot could not route from mosk_dun03 back to mosk_dun02.
I get the wrong routing message as :

Calculating lockMap route to: 深森林洞穴(mosk_dun02)
Cannot calculate a route from mosk_dun03 (32,135) to mosk_dun02 (,)


I am very sure the mosk_dun03 27 131 is a npc (actually, it is a stone).
Because, I could manually move the bot nearby the (27, 131) of mosk_dun03 (such as: 28, 131),
and then do the command : "talknpc 27 131 c c r0", then the bot warp back to the mosk_dun02.

What is this problem ?

I trace in the programes.
I found out the rteun of "$pathfinding->run($solution);" is -1.
The "$pathfinding->run($solution);" is in "sub getRoute" of src/Task/Route.pm file.


But, I did not get the problem, because the "run" of "$pathfinding" is Python program.

Re: Routing between mosk_dun02 and mosk_dun03

Posted: 02 May 2011, 03:47
by sofax222
I found out the solution !
The problem is :
The NPC (27, 131) of mosk_dun03 is at a non-walkable postion.
So, I modify the fields/mosk_dun03.dist to make (27, 131) (28, 131) (29, 131) (30, 131) positions to be walkable !

Re: Routing between mosk_dun02 and mosk_dun03

Posted: 02 May 2011, 08:01
by EternalHarvest
That's really a bug, NPC portal should be reachable even if the exact location of NPC isn't.

Re: Routing between mosk_dun02 and mosk_dun03

Posted: 02 May 2011, 08:29
by sofax222
EternalHarvest wrote:That's really a bug, NPC portal should be reachable even if the exact location of NPC isn't.
Actually, I do not know how to generate thr .dist file.
May be to re-generate the mosk_dun03.dist file.

Another one similar problem in routing from mosk_fild02 back to moscovia city.
The NPC portal is a "board", it's coordinate is (198,53), that is very a un-reachable position.
I use a macro to sovle that problem !

Re: Routing between mosk_dun02 and mosk_dun03

Posted: 02 May 2011, 12:34
by EternalHarvest
I mean, the bug is in routing.

Re: Routing between mosk_dun02 and mosk_dun03

Posted: 03 May 2011, 04:14
by Kamilia
How this you solve the moskovia dun2 to moscovia? Help in tha macro pls tnx

Re: Routing between mosk_dun02 and mosk_dun03

Posted: 03 May 2011, 12:59
by sofax222
Kamilia wrote:How this you solve the moskovia dun2 to moscovia? Help in tha macro pls tnx
There are two solutions.

The 1st solution:
This is a easy one, but with macro.
To add the line as following into the tables/portals.txt file.

Code: Select all

mosk_fild02 202 54 moscovia 140 54
And, add a macro as following into the control/macros.txt file.

Code: Select all

automacro MoskFld2ToMoscovia {
	location mosk_fild02 202 55 203 54
	run-once 1
	call {
		pause 1
		do talknpc 198 53 c r0 n
		pause 1
		release all
	} 
}
The 2nd solution:
This is a diffcult one, without macro.
To add the line as following into the tables/portals.txt file.

Code: Select all

mosk_fild02 198 53 moscovia 140 54 0 c r0 n
Thers is a NPC at the (198, 53) position, but the position is not reachable.
So, have to make it to be reachable.
Modify the fields/mosk_fild02.dist file with a HEX editor.
Change the bytes of the following from '00' to '01':
(198, 53), (198, 54), (199, 54), (200, 54), (201, 54)
Actually, make the (198, 53) to connect the port (202, 54).

There is a formula to calculate the byte order of the .dist file.
The mosk_fild02 is a 300 x 300 map.
The byte order of coordinate (x, y) is y * 300 + x + 8.
Such as,
the pos (198, 53) = 53 x 300 + 198 + 8 = 16106 = 0x3EEA
the pos (198, 54) = 54 x 300 + 198 + 8 = 16406 = 0x4016
the pos (199, 54) = 54 x 300 + 199 + 8 = 16407 = 0x4017
the pos (200, 54) = 54 x 300 + 200 + 8 = 16408 = 0x4018
the pos (201, 54) = 54 x 300 + 201 + 8 = 16409 = 0x4019

Re: Routing between mosk_dun02 and mosk_dun03

Posted: 03 May 2011, 18:30
by Kamilia
I'm having this problem on my macro
Cannot calculate a route from mosk_dun02 (269,115) to moscovia (223,191)

This is my macro, everytime after storage and i go back to dun_03, from dun_02 that error shows over and over again. Please help? tnx!

# ---- moscovia - mosk_fild01 ----
automacro mfild01 {
location moscovia
weight <= 30%
run-once 1
call mf01
}
macro mf01 {
do conf autoTalkCont 1
pause 1
do eq "Gusli"
pause 1
do move 136 50
pause 1
do talk resp 0
release all
}

# ---- mosk_fild01 - mosk_fild02 -----
automacro mfild02 {
location mosk_fild01
run-once 1
call mf02
}
macro mf02 {
do move 90 104
pause 2
do talknpc 86 104 c c r2 c c c r1 c c
release mfild02
}

# ---- mosk_fild02 - mosk_dun01 ----
automacro mdun01 {
location mosk_fild02
run-once 1
call md01
}
macro md01 {
do conf lockMap mosk_dun03
pause 1
do move mosk_dun03
release mdun01
}

automacro datoo {
map mosk_dun01
run-once 1
call {
do move 206 275
}
}

automacro datri {
location mosk_dun01 206 275
run-once 1
call {
do talk @npc (207 276)
pause 2
do talk resp 0
pause 2
}
}

automacro dapor {
location mosk_dun02 165 30
run-once 1
call {
do move 164 31
pause 1
do ai on
release all
}
}

automacro dafive {
map mosk_dun02
run-once 1
call {
do move 269 115
}
}

automacro dasix {
location mosk_dun02 267 116
run-once 1
call {
do talk @npc (268 117)
pause 2
do talk resp 0
pause 2
}
}

automacro daseven {
location mosk_dun03 32 135
run-once 1
call {
do move 33 136
pause 1
do ai on
release all
}
}

Re: Routing between mosk_dun02 and mosk_dun03

Posted: 03 May 2011, 21:42
by sofax222
Ok, do you want to route from mosk_dun02 to moscovia, right !?
You got the "Cannot calculate a route from mosk_dun02 (269,115) to moscovia (223,191)" message.

I think the problem has nothing with macro.
Because, you must let bot to walk to some portal position firstly.

Any routinng from a-map to b-map, there most be links in portals.txt.
So, if you want to route from mosk_dun02 to moscovia.
PS: The links from mosk_dun02 to moscovia:
mosk_dun02 -> mosk_dun01 -> mosk_fild02 -> moscovia

Firstly, you have to check the tables/portals.txt file.
It should inculde the following lines:

Code: Select all

mosk_dun02 xx1 yy1 mosk_dun01 xx2 yy2 ...
mosk_dun01 xx3 yy3 mosk_fild02 xx4 yy4 ...
mosk_fild02 xx5 yy5 moscovia xx6 yy6 ...
Secondly, the postions of (xx1, yy1), (xx2, yy2), (xx3, yy3), (xx4, yy4), (xx5, yy5), (xx6, yy6) all must be reachable.

Re: Routing between mosk_dun02 and mosk_dun03

Posted: 03 May 2011, 22:22
by sofax222
Total solutions of routing from moscovia to mosk_dun03, and routing back.
PS: These solutions is for twRO. I am not sure it could apply on other servers.

You need a HEX editor for modifying the .dist files.

Solution No. 1
With 2 macros and modiying 1 .dist file (mosk_dun03.dist)

Check the tables/portals.txt file, it should have the following lines:

Code: Select all

moscovia 136 48 mosk_fild01 95 93
mosk_fild01 86 104 mosk_fild02 204 54 0 c c r2 c c c r1 c n
mosk_fild02 190 257 mosk_dun01 189 45
mosk_dun01 207 276 mosk_dun02 165 30 0 c c r0
mosk_dun02 268 117 mosk_dun03 32 135 0 c c r0
mosk_dun03 27 131 mosk_dun02 262 118 0 c c r0
mosk_dun02 168 28 mosk_dun01 201 269 0 c c r0
mosk_dun01 189 42 mosk_fild02 190 257
mosk_fild02 202 54 moscovia 140 54
With 2 macros:
one for moscovia to mosk_fild01
another for mosk_fild02 to moscovia

Code: Select all

#from moscovia to mosk_fild01
automacro MoscoviaToMoskFld1 {
	location moscovia 136 48 140 46
	run-once 1
	call {
		pause 2
		do talk resp 0
		pause 1
		release all
	} 
}

#from mosk_fild02 to moscovia
automacro MoskFld2ToMoscovia {
	location mosk_fild02 202 55 203 54
	run-once 1
	call {
		pause 1
		do talknpc 198 53 c r0 n
		pause 1
		release all
	} 
}
Modify the fields/mosk_dun03.dist file.
Because the (27, 131) of mosk_dun03 is a un-reachable position,
the openkore always calculate failed from mosk_dun03 to mosk_dun02
PS: the (27, 131) of mosk_dun03 is a NPC portal.
Then to modify the fields/mosk_dun03.dist file to make the (27, 131) of mosk_dun03 to be a reachable position.
Using the HEX editor, to change the bytes of the following from '00' to '01':
(27, 131), (28, 131), (29, 131), (30, 131)

There is a formula to calculate the byte offset of the .dist file.
The mosk_dun03 is a 300 x 300 map.
The byte offset of coordinate (x, y) is y * 300 + x + 8.
Such as,
the pos (27, 131) = 131 x 300 + 27 + 8 = 39335 = 0x99A7
the pos (28, 131) = 131 x 300 + 28 + 8 = 39336 = 0x99A8
the pos (29, 131) = 131 x 300 + 29 + 8 = 39337 = 0x99A9
the pos (30, 131) = 131 x 300 + 30 + 8 = 39338 = 0x99AA

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

Solution No. 2
With 1 macros and modiying 2 .dist files (mosk_dun03.dist, mosk_fild02.dist)

Check the tables/portals.txt file, it should have the following lines:

Code: Select all

moscovia 136 48 mosk_fild01 95 93
mosk_fild01 86 104 mosk_fild02 204 54 0 c c r2 c c c r1 c n
mosk_fild02 190 257 mosk_dun01 189 45
mosk_dun01 207 276 mosk_dun02 165 30 0 c c r0
mosk_dun02 268 117 mosk_dun03 32 135 0 c c r0
mosk_dun03 27 131 mosk_dun02 262 118 0 c c r0
mosk_dun02 168 28 mosk_dun01 201 269 0 c c r0
mosk_dun01 189 42 mosk_fild02 190 257
mosk_fild02 198 53 moscovia 140 54 0 c r0 n
With 1 macros:
for moscovia to mosk_fild01

Code: Select all

#from moscovia to mosk_fild01
automacro MoscoviaToMoskFld1 {
	location moscovia 136 48 140 46
	run-once 1
	call {
		pause 2
		do talk resp 0
		pause 1
		release all
	} 
}
Modify the fields/mosk_dun03.dist file.
Because the (27, 131) of mosk_dun03 is a un-reachable position,
the openkore always calculate failed from mosk_dun03 to mosk_dun02
PS: the (27, 131) of mosk_dun03 is a NPC portal (stone).
Then to modify the fields/mosk_dun03.dist file to make the (27, 131) of mosk_dun03 to be a reachable position.
Using the HEX editor, to change the bytes of the following from '00' to '01':
(27, 131), (28, 131), (29, 131), (30, 131)

There is a formula to calculate the byte offset of the .dist file.
The mosk_dun03 is a 300 x 300 map.
The byte offset of coordinate (x, y) is y * 300 + x + 8.
Such as,
the pos (27, 131) = 131 x 300 + 27 + 8 = 39335 = 0x99A7
the pos (28, 131) = 131 x 300 + 28 + 8 = 39336 = 0x99A8
the pos (29, 131) = 131 x 300 + 29 + 8 = 39337 = 0x99A9
the pos (30, 131) = 131 x 300 + 30 + 8 = 39338 = 0x99AA

Modify the fields/mosk_fild02.dist file.
Because the (198, 53) of mosk_fild02 is a un-reachable position,
the openkore always calculate failed from mosk_fild02 to moscovia
PS: the (198, 53) of mosk_fild02 is a NPC portal (boat).
Then to modify the fields/mosk_fild02.dist file to make the (198, 53) of mosk_fild02 to be a reachable position.
Using the HEX editor, to change the bytes of the following from '00' to '01':
(198, 53), (198, 54), (199, 54), (200, 54), (201, 54)

There is a formula to calculate the byte offset of the .dist file.
The mosk_fild02 is a 300 x 300 map.
The byte offset of coordinate (x, y) is y * 300 + x + 8.
Such as,
the pos (198, 53) = 53 x 300 + 198 + 8 = 16106 = 0x3EEA
the pos (198, 54) = 54 x 300 + 198 + 8 = 16406 = 0x4016
the pos (199, 54) = 54 x 300 + 199 + 8 = 16407 = 0x4017
the pos (200, 54) = 54 x 300 + 200 + 8 = 16408 = 0x4018
the pos (201, 54) = 54 x 300 + 201 + 8 = 16409 = 0x4019

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

Actually, I try to make the (136, 46) of moscovia to be a NPC portal (boat).
But the (136, 46) NPC portal (boat) of moscovia is a active talking NPC.
Another words, the bot could not do a "talk" or "talknpc" command to the (136, 46) NPC portal (boat) of moscovia.