Page 1 of 1

Error with getpos ?

Posted: Mon Jan 18, 2010 9:25 pm
by Jiggaboo
Hey bros,

I'm trying to get my in-game coordinates so I can setup some waypoints, but every time I enter the command rom\getpos to run the get position script I get this error:

Image

I ran the update script and updated the SVN just in case; that didn't solve it either. I guess for some reason 'database' hasn't been initialized by this line (695):
local tmp = database.utf8_ascii[_key];

I searched the forums and the wiki and wasn't able to find any solutions or similar problems.
I also tried setting the ROMDATA_PATH to my RoM installation path (C:\Program Files\Runes of Magic) and it didn't help.
I wish people actually used IRC for this haha, I logged on only to be greeted by ChanServ T_T.


Any and all help would be appreciated!
Thanks

Re: Error with getpos ?

Posted: Mon Jan 18, 2010 11:11 pm
by Administrator
Open up getpos.lua in notepad. You'll see this line near the top:

Code: Select all

include("functions.lua");
Directly above that, add this:

Code: Select all

include("database.lua");
Save it. Let me know if this works.

Re: Error with getpos ?

Posted: Tue Jan 19, 2010 12:55 am
by Jiggaboo
Ah sorry I forgot to mention I tried that.
This is the error I get when I add the include (which I also added to the functions.lua file):
Image

This is the function that is crashing, the specific line (698) is in bold:
function utf8ToAscii_umlauts(_str)

-- convert one UTF8 character to his ASCII code
-- key is the combined UTF8 code
local function replaceUtf8( _str, _key )
local tmp = database.utf8_ascii[_key];
_str = string.gsub(_str, string.char(tmp.utf8_1, tmp.utf8_2), string.char(tmp.ascii) );
return _str
end

_str = replaceUtf8(_str, 195164); -- ä
_str = replaceUtf8(_str, 195132); -- Ä
_str = replaceUtf8(_str, 195182); -- ö
_str = replaceUtf8(_str, 195150); -- Ö
_str = replaceUtf8(_str, 195188); -- ü
_str = replaceUtf8(_str, 195156); -- Ü
_str = replaceUtf8(_str, 195159); -- ß
return _str;
end
Pretty weird, because that would mean database is no longer null, but the utf8_ascii array is? Heh, sorry my LUA is pretty rusty
Thanks for the reply by the way. Is there any way I can contact you over an instant messenger (whatever works for you) by chance? Would love to get this figured out asap.

Re: Error with getpos ?

Posted: Tue Jan 19, 2010 2:26 am
by Administrator
Try adding this to the function:

Code: Select all

if( not tmp ) then
    error("Invalid database information passed to replaceUtf8()", 2);
end
Does the bot work normally for you? You could just use the position given in the titlebar.

Re: Error with getpos ?

Posted: Wed Jan 20, 2010 1:25 am
by Jiggaboo
I can just use the CreatePath script to get coordinates without any issues - I don't know why I was using getpos in the first place.

If you still want me to test that code for the sake of fixing it just let me know, otherwise I'm going to move on.
Thanks for the replies by the way, pretty cool to see you providing support for your (fantastic/very well done/impressive etc) project to anyone who stumbles in :)

I still really believe that an IRC channel is the way to go. So much more ideal for getting help and talking to fellow users.

Re: Error with getpos ?

Posted: Wed Jan 20, 2010 7:00 am
by Administrator
No worries. I'll debug it when I get around to it. As long as you got something that works, that's good enough.

Re: Error with getpos ?

Posted: Fri Jan 22, 2010 1:28 am
by InadequateCoder
I get the same error and I was wondering if this option existed. Could we make an injections script within the createpath.lua script that added a waypoint after a designated waypoint (this would also autocorrect the comment numbering).

option 7 (or next up I forget what it is), edit existing file
enter filename
mark waypoint
which waypoint would you like to place this waypoint after?
use code to insert
correct comments
have beer and pretzels
watch bot work
etc...

Re: Error with getpos ?

Posted: Fri Jan 22, 2010 11:22 pm
by Jiggaboo
InadequateCoder wrote:I get the same error and I was wondering if this option existed. Could we make an injections script within the createpath.lua script that added a waypoint after a designated waypoint (this would also autocorrect the comment numbering).

option 7 (or next up I forget what it is), edit existing file
enter filename
mark waypoint
which waypoint would you like to place this waypoint after?
use code to insert
correct comments
have beer and pretzels
watch bot work
etc...
This might actually be useful. If I find the time I'll look into implementing this, shouldn't be too difficult.