You can also test the teleport functions like this.
- 1. Go somewhere private such as millers ranch.
2. Run "StartCommandLine.bat".
3. TypeCode: Select all
teleport(5,nil,false)
Code: Select all
teleport(5,nil,false)
No, that's why I haven't commented further.Rickster wrote:any ideas left?
Code: Select all
repeat
teleport(x, z, 18)
if distance(player.X, player.Z, x, z) > 5 then yrest(500) end
until 5 > distance(player.X, player.Z, x, z)
Code: Select all
print("Teleporting to",x,z)
Can't you do a diff on the whole rom folder and quickly pinpoint the changed files? I can, although I don't use the TortoiseSVN diff viewer. I use KDIFF3 that comes with my GIT package but I think it can be downloaded separately.Rickster wrote:I thought about doing a diff an all important files, but I think its not worth the work.
rock5 wrote:I'm currently working on a aoe option that assumes that if you want to use an aoe to clear the trash then you would have it set as your first attack skill. So it checks the first attack skill again a list of aoe skills. Here is the list I'm using. Are there any others I should add?Code: Select all
local aoeskills = { "MAGE_PURGATORY_FIRE", "MAGE_DISCHARGE", "WARRIOR_BLASTING_CYCLONE", "WARRIOR_MOON_CLEAVE", "WARRIOR_WHIRLWIND", "KNIGHT_WHIRLWIND_SHIELD", }
Code: Select all
"WARDEN_FRANTIC_BRIAR
rock5 wrote:I'm currently working on a aoe option that assumes that if you want to use an aoe to clear the trash then you would have it set as your first attack skill. So it checks the first attack skill again a list of aoe skills. Here is the list I'm using. Are there any others I should add?Code: Select all
local aoeskills = { "MAGE_PURGATORY_FIRE", "MAGE_DISCHARGE", "WARRIOR_BLASTING_CYCLONE", "WARRIOR_MOON_CLEAVE", "WARRIOR_WHIRLWIND", "KNIGHT_WHIRLWIND_SHIELD", }
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
--=== Rock5's version ===--
--=== V 2.3 r5 ===--
--=== User Options ===--
When_Finished = "end" -- "relog" to end script, "relog" to log next character and "waypointfilename" to load that waypointfile.
AllowSkillCastTime = 2 -- Ignore skills with cast times longer than this value when when casting single skills.
--====================--
bizarremechanism = 101489
guardianrockspirit = GetIdName(101269)
guardiandefender = GetIdName(101637)
guardianswordsman = GetIdName(101271)
franticcliffdemon = GetIdName(101272)
brownwoodenchest = 111956
smallbomb = 101486
mediumbomb = 101487
largebomb = 101488
treasuretile = GetIdName(111811)
function checkRelog()
if When_Finished == "relog" then
sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();");
waitForLoadingScreen();
loadPaths("survivalr5");
elseif When_Finished == "end" then
error("Ending script",2)
else
if not string.find(When_Finished,".", 1, true) then
When_Finished = When_Finished .. ".xml"
end
local filename = getExecutionPath() .. "/waypoints/" .. When_Finished
local file, err = io.open(filename, "r");
if file then
file:close();
loadPaths(When_Finished)
else
error("'When_Finished' option is invalid",0)
end
end
end
--=== Function to sort tables, at angle ===--
local function SEsize(_x, _z)
local X1 = 2622.1403808594
local Z1 = 2900.1105957031
local X2 = 2471.7895507813
local Z2 = 2954.833984375
return math.floor(((_x-X1)*(Z2-Z1)-(X2-X1)*(_z-Z1))/math.sqrt((X2-X1)^2 + (Z2-Z1)^2) + 0.5)
end
local function NEsize(_x, _z)
local X1 = 2471.7895507813
local Z1 = 2954.833984375
local X2 = 2526.5126953125
local Z2 = 3105.1848144531
return math.floor(((_x-X1)*(Z2-Z1)-(X2-X1)*(_z-Z1))/math.sqrt((X2-X1)^2 + (Z2-Z1)^2) + 0.5)
end
function addToNE(_x, _z, _s)
return _x + (_s * 0.9397), _z - (_s * 0.3420)
end
function addToSE(_x, _z, _s)
return _x + (_s * 0.3420), _z + (_s * 0.9397)
end
function GetAttackPosition(_x, _z)
local SEvalue = SEsize(_x, _z)
local NEvalue = NEsize(_x, _z)
if 1 > SEvalue then -- nw edge
return addToSE(_x, _z, - attackdistance)
elseif SEvalue > 159 then -- se edge
return addToSE(_x, _z, attackdistance)
elseif 1 > NEvalue then -- sw edge
return addToNE(_x, _z, - attackdistance)
elseif NEvalue > 159 then -- ne edge
return addToNE(_x, _z, attackdistance)
end
end
--=== Create table of tiles ===--
function createTileTable()
tiles = {}
local objectList = CObjectList();
objectList:update();
local objSize = objectList:size()
for i = 0,objSize do
local obj = objectList:getObject(i);
if obj.Id == 111811 or obj.Id == 111812 then
table.insert(tiles, table.copy(obj))
end
end
-- Sort function
local function sortfunc(a,b)
if SEsize(a.X,a.Z) == SEsize(b.X,b.Z) then
return NEsize(b.X,b.Z) > NEsize(a.X,a.Z)
else
return SEsize(b.X,b.Z) > SEsize(a.X,a.Z)
end
end
-- Sort tiles
table.sort(tiles, sortfunc)
end
--=== look for indicator that the tile is clickable ===--
function clicktile(address)
local tmp = memoryReadRepeat("int", getProc(), address + addresses.pawnAttackable_offset) or 0;
if bitAnd(tmp,0x8) then
return true
else
return false
end
end
--=== look for indicator that the chest has loot ===--
function clickchest(address)
local chest = memoryReadRepeat("byte", getProc(), address + 0x2F0) or 0
if chest ~= 0 then
return true
else
return false
end
end
--=== Open chests ===--
function chests()
local chests = {}
local objectList = CObjectList();
objectList:update();
local objSize = objectList:size()
for i = 0,objSize do
local obj = objectList:getObject(i);
if obj.Name == "Brown wooden chest" then
table.insert(chests, table.copy(obj))
end
end
for k,v in pairs(chests) do
if not RoMScript("TimeKeeperFrame:IsVisible()") then
checkRelog()
end
if clickchest(v.Address) == true then
fly()
teleport(v.X+10,v.Z+10,18)
repeat
player:target_Object(v.Id, nil, nil, true);
until clickchest(v.Address) ~= true
end
end
checkRelog()
end
--=== Attack with only one skill ===--
function oneskillattack()
local skillcast = false
repeat
player:update()
for i,v in pairs(settings.profile.skills) do
if v.AutoUse and v.Available and
player.Level >= v.aslevel and
(v.Type == STYPE_DAMAGE or v.Type == STYPE_DOT) and
deltaTime(getTime(), v.LastCastTime) >= (v.Cooldown*1000 - getSkillUsePrior()) and
(player.Rage >= v.Rage and player.Energy >= v.Energy and player.Concentration >= v.Concentration) and
(player.Mana >= math.ceil(v.Mana + (v.Level-1)*v.ManaInc) ) and
(player.Nature >= v.Nature or player:hasBuff(503817)) and
AllowSkillCastTime >= v.CastTime then
skillcast = true
player:cast(v)
repeat yrest(50) player:update() until not player.Casting
yrest(500)
break
end
end
until skillcast
end
--=== First mobs to kill ===--
function trashmelee()
for i = 1,#orderlist do
local tile = tiles[orderlist[i]]
fly()
teleport(GetAttackPosition(tile.X,tile.Z))
if player.Battling then
local _enemy = findaggroenemy()
if _enemy then
player:target(_enemy);
player:fight()
end
end
local trash = player:findNearestNameOrId(bizarremechanism)
if trash then
trash = CPawn(trash.Address)
local distance = distance(player.X, player.Z, trash.X, trash.Z)
if (attackdistance * 1.3) > distance then
player:target(trash)
repeat
oneskillattack()
trash:update()
until 10 > trash.HP
player:clearTarget();
end
end
end
spawnsmelee()
end
--=== Kill spawns melee ===--
function spawnsmelee()
for i = 1,#orderlist do
local tile = tiles[orderlist[i]]
fly()
teleport(GetAttackPosition(tile.X,tile.Z))
if player.Battling then
local _enemy = findaggroenemy()
if _enemy then
player:target(_enemy);
player:fight()
end
end
local spawn = player:findNearestNameOrId(guardianrockspirit)
if spawn then
spawn = CPawn(spawn.Address)
local distance = distance(player.X, player.Z, spawn.X, spawn.Z)
if (attackdistance * 1.3) > distance then
player:target(spawn)
repeat
oneskillattack()
spawn:update()
until 10 > spawn.HP
player:clearTarget();
end
else
printf("Something wrong, name incorrect.\n")
end
end
breaktiles()
end
--=== Start of tiles function ===--
function breaktiles()
if player.Class1 == CLASS_MAGE then
changeProfileSkill("MAGE_PURGATORY_FIRE" , "AutoUse", false)
end
--=== First run of tiles ===--
orderlist = {6,24,5,23,4,22,3,21,2,20,1,19,16,36,18,35,17,34,15,33,14,32,13,31,28,12,30,11,29,10,27,9,26,8,25,7}
for i = 1,36 do
local tile = tiles[orderlist[i]]
-- Dig tile
repeat
if not RoMScript("TimeKeeperFrame:IsVisible()") then
checkRelog()
end
fly()
teleport(tile.X+1,tile.Z+1,18,120)
player:update()
player:target_Object(tile.Id, 500, false, true, clicktile);
until clicktile(tile.Address) == false
-- see what's there
local starttime = os.clock()
repeat
local result = player:findNearestNameOrId({guardiandefender,guardianswordsman,franticcliffdemon,brownwoodenchest,smallbomb,mediumbomb,largebomb})
if result and 10 > distance(player.X,player.Z,result.X,result.Z) then
printf("%s found. Id %d.\n", result.Name, result.Id)
if result.Name == guardiandefender or result.Name == guardianswordsman or result.Name == franticcliffdemon then
player:target(result)
player:fight()
elseif result.Id == brownwoodenchest then
repeat
player:target(result);
Attack() yrest(1000)
repeat
player:update()
until player.Casting == false
until clickchest(result.Address) ~= true
end
break
end
until os.clock()- starttime > 1
end
end
--=== find enemys that have you targeted ===--
function findaggroenemy()
local obj = nil
local pawn = nil
local objectList = CObjectList();
objectList:update();
for i = 0,objectList:size() do
obj = objectList:getObject(i);
if( obj ~= nil and obj.Type == PT_MONSTER) then
pawn = CPawn(obj.Address)
if pawn.TargetPtr == player.Address then
return pawn
end
end
end
end
if player.Class1 == CLASS_SCOUT or player.Class1 == CLASS_PRIEST or player.Class1 == CLASS_DRUID then
attackdistance = 50
else
attackdistance = 25
end
orderlist = {6, 12, 18, 24, 30, 36, 35, 34, 33, 32, 31, 25, 19, 13, 7, 1, 2, 3, 4, 5}
--=== Table numbering system ===--
--[[
1 7 13 19 25 31
2 8 14 20 26 32
3 9 15 21 27 33
4 10 16 22 28 34
5 11 17 23 29 35
6 12 18 24 30 36
* -- entrance to room.
]]
--=== Turn off looting, wastes time ===--
settings.profile.options.LOOT = false
settings.profile.options.TARGET_LEVELDIF_ABOVE = "15" -- Need to try to kill anything in there or no point.
settings.profile.options.TARGET_LEVELDIF_BELOW = "60" --trash is lvl 15 which people won't allow for in profile.
teleport_SetStepSize(120)
--=== Get into Survival Zone ===--
local zoneid = RoMScript("GetZoneID()")
if zoneid ~= 351 then -- not in Survival
local Malatina = GetIdName(111813)
-- Try to find Malatina and teleport in
if player:target_NPC(Malatina) then
if 50 > player.Level and (player.Level2 >= 50 or player.Level3 >= 50) then
-- Wait for user to change class
cprintf(cli.yellow,"If you want to earn Phirius Shells, change to your 50+ class before continuing.\n")
player:sleep()
end
sendMacro("ChoiceOption(1);");
yrest(2000)
sendMacro("ChoiceOption(1);");
if not waitForLoadingScreen(30) then
print("Failed to teleport into Survival")
checkRelog()
end
else
print("You are too far from Malatina")
checkRelog()
end
end
</onLoad>
<!-- # 1 --><waypoint x="2519" z="2593" y="9">
local joker = GetIdName(111814)
player:target_NPC(joker);
sendMacro("ChoiceOption(2);");
</waypoint>
<!-- # 2 --><waypoint x="2546" z="2681" y="9" type="TRAVEL"> </waypoint>
<!-- # 3 --><waypoint x="2586" z="2789" y="9" type="TRAVEL"> </waypoint>
<!-- # 4 --><waypoint x="2606" z="2843" y="9" type="TRAVEL">
createTileTable() -- do it here as you can't see the pawns until you start the event.
local trash = player:findNearestNameOrId(bizarremechanism) -- check for trash
local spawns = player:findNearestNameOrId(guardianrockspirit) -- check for spawns
local tiles = player:findNearestNameOrId(treasuretile, nil, clicktile) -- check if any tiles need opening
if trash then -- add in options for aoe and ranged here
trashmelee() -- clears trash within melee range
end
if spawns then
spawnsmelee() -- kill spawns within melee range
end
if trash == nil and spawns == nil and tiles ~= nil then
breaktiles() -- start breaking tiles
end
if tiles == nil then
chests() -- open chests
end
</waypoint>
</waypoints>
You have first post now so you can just update that 1 =)rock5 wrote:I'll probably get around to it eventually.
Moving to waypoint #4, (2606, 2843)
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Duplicate address found. #tiles = 37. Redoing table.
Users browsing this forum: No registered users and 0 guests