Need some help here. I'm using a .lua script similar in fashion to the creatpaths script and in it, I'm attempting to make the bot's camera point toward a specific coordinates. In the script where I run the command player:aimAt({v.x, v.z, player.Y-3}), I get the error:
"2016-01-30 10:43:43 - ...am Files (x86)/micromacro/scripts/rom/classes/player.lua:3919: attempt to index global 'camera' (a nil value)"
Line 3919 of player.lua is simply camera:update(). Why is that not running? I'm assuming something isn't loading that is needed? But I have no idea what.
Problem using aimAt command
Re: Problem using aimAt command
If you are using a modified version of createpath then quite a lot of the bot functions wouldn't be loaded.
Try adding this to your code.
There may be more needed to add/include but it would be a matter of trying and working out what is missing to be able to do what you want.
TBH it might be easier to just make up a WP file that does what you want for creating paths, that way every function in the bot will be active.
Try adding this to your code.
Code: Select all
local cameraAddress = memoryReadIntPtr(getProc(), addresses.staticbase_char, addresses.camPtr_offset);
if( cameraAddress == nil ) then cameraAddress = 0; end;
camera = CCamera(cameraAddress);
TBH it might be easier to just make up a WP file that does what you want for creating paths, that way every function in the bot will be active.
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
-
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
Re: Problem using aimAt command
Thanks Lisa. I was wondering earlier today if maybe I should make it a waypoint file instead.
I have another question. I have this file creating a table (with embedded tables) holding nodes, NPCs, MOBs, objects, and neighboring nodes. Now I'm at the point where I want to save this off into a file. Any idea how I might save a table like this into a file that I can later copy into a userfunction? I know doing a table.print doesn't make it look anything like the arrays we tend to use a lot. For example, this is the format we tend to use a lot:
But I'm not sure how to save my table info out into a format like that. Any ideas?
I have another question. I have this file creating a table (with embedded tables) holding nodes, NPCs, MOBs, objects, and neighboring nodes. Now I'm at the point where I want to save this off into a file. Any idea how I might save a table like this into a file that I can later copy into a userfunction? I know doing a table.print doesn't make it look anything like the arrays we tend to use a lot. For example, this is the format we tend to use a lot:
Code: Select all
mytable = {
[1] = {x = 1435, z = 6532, Neighbors = { 2, 4}, NPCs = {110532}, }
[2] = {x = 1504, z = 6620, Neighbors = { 1, 3, 7}, MOBs= {110532}, }
[3] = {x = 1435, z = 6532, Neighbors = { 2, 4}, NPCs = {110529}, }
}
Re: Problem using aimAt command
Basically you want to save the exact thing you see that you posted into a file.
Here is an example that does more than you want but you can pick and choose what you need from it.
You also want to have
instead of the
Then to use the table in the file you just need to do
something like that anyway
Here is an example that does more than you want but you can pick and choose what you need from it.
Code: Select all
local function savefile()
local tmp_points = {};
for i,v in pairs(worldmap.points) do
table.insert(tmp_points, {index = i, value = v});
end
table.sort(tmp_points, function (a,b) return (a.index < b.index) end)
file, err = io.open("rbmedit/pointssaved.lua", "w+");
file:write("return {\n")
for i,v in ipairs(tmp_points) do
file:write("\t["..(v.index).."]={ X="..v.value.X.." , Z="..v.value.Z)
if v.value.Y ~= nil then
file:write(", Y="..v.value.Y)
end
if v.value.Name ~= nil then
file:write(", Name=\""..v.value.Name.."\"")
end
file:write(", Links={")
if v.value.Links ~= nil then
for j,k in ipairs(v.value.Links) do
if k.Num then
file:write("["..j.."]={Num="..k.Num)
end
if k.Action then
file:write(", Action=\""..k.Action.."\"")
end
file:write("},")
end
file:write("}")
else
file:write("}")
end
file:write("},\n")
end
file:write("}")
file:close()
end
Code: Select all
return {
Code: Select all
mytable = {
Code: Select all
mytable = include("filename")
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Who is online
Users browsing this forum: No registered users and 3 guests