Scripting problems, need help

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Scripting problems, need help

#1 Post by lalaxy » Sat Sep 22, 2012 11:03 am

Hy!

My problem is if i use bot'automatic skill to a boss, it don't follow the additional castingspeed buffs time, so it casting flames more slowly than he could cast (like manual). Then soluted this now i dont use this, i using macro only making actions from skillbar...I cast as many times the flame as need to kill the boss, and a lil more for safety. Its successful, but waiting too many time when boss killed for the looting...So it wasting time. I need one solution wich monitoring the mob's HP...And making actions only till the boss is living...Ive tryed with this scripts:

Code: Select all

RoMScript("TargetNearestEnemy();") yrest(1000)
local target = player:getTarget()
if target.HP > 0 then
			player:update();
			player:cast("MAGE_FLAME");    -----(or sendMacro("UseAction(7,1)") this one would be better)
			yrest(500);
end
another try:

Code: Select all

RoMScript("TargetNearestEnemy();") yrest(1000)
local target = player:getTarget()
repeat 
			player:update();
			player:cast("MAGE_FLAME");    -----(or sendMacro("UseAction(7,1)") this one would be better)
			yrest(500);
until target.HP > 0
but not works...:(
Mybe ive thought something wrong about this theme, or only made a syntactical mistake...But it not works...
I need a solution, pls help me, or write some script to solution this theme!

Many thx

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Scripting problems, need help

#2 Post by lisa » Sat Sep 22, 2012 11:43 am

when you say it doesn't work, what exactly do you mean?

The code doesn't work or it keeps casting forever?

chances are you just needed to update the target and not player but there is an "Alive" value anyway, so you could do this

to use your example.

Code: Select all

RoMScript("TargetNearestEnemy();") yrest(1000)
local target = player:getTarget()
repeat 
         target:update();
         player:cast("MAGE_FLAME");    -----(or sendMacro("UseAction(7,1)") this one would be better)
         yrest(500);
until not target.Alive
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

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#3 Post by lalaxy » Sun Sep 23, 2012 10:10 am

Hmmm, something still wrong...Its casting over time (doing action), and dont want to stop when mob killed...

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: Scripting problems, need help

#4 Post by BillDoorNZ » Sun Sep 23, 2012 3:57 pm

it is possible that the boss dies and the target pointer is not longer valid, in which case this wont work :(

may not be that tho. you could try:

Code: Select all

RoMScript("TargetNearestEnemy();") yrest(1000)
local target = player:getTarget()
repeat 
         target:update();
         player:cast("MAGE_FLAME");    -----(or sendMacro("UseAction(7,1)") this one would be better)
         yrest(500);
until ((not target.Alive) or (target.Id == 0))
or

Code: Select all

RoMScript("TargetNearestEnemy();") yrest(1000)
local target = player:getTarget()
while ((target ~= nil) and (target.Alive)) do
         player:cast("MAGE_FLAME");    -----(or sendMacro("UseAction(7,1)") this one would be better)
         yrest(500);
         player:update();
         target = player:getTarget();
end;
btw, I changed the loop to a while loop so that the conditions (target not nil and target.Alive) are checked at the start, in case the bot has no target in the beginning.

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#5 Post by lalaxy » Mon Sep 24, 2012 12:46 pm

Thy, ill try it, ill post the result :)

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#6 Post by lalaxy » Thu Oct 04, 2012 11:28 am

Hi , last method seems to be good, but 2 other question created....Sometimes (and somehow) instance not resetting , and when i go in again boss isnt at his place...In this case for buff target is myself...So it cannot target the enemy , target is on me, then (target =~ nil) true, (target.Alive) is true, so it try to make actions to the infinite...So he stands only and try to cast, so in this case process not continues...How can i solve it ??? Ive thought on a security counter what counts the actions done and after 1000 (then boss is dead surely) he do the nexs step and the "while" process ends...
Or U have other idea ?
Problem that i cannot define a counter in the waypoint ( ive thought on a simple i=0 before while, then in the while cycle i=i+1, and build in a while (i=1000) ) it not works... :(

Other problem that sometimes he go in the portal and portal not works for first time, and he is standing in the portal and process halted cause other waypoint is on the other side... Any idea ???

Thy

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#7 Post by lalaxy » Thu Oct 04, 2012 11:32 am

Code: Select all

	
        <waypoint x="1207" z="1507" y="101">
	RoMScript("TargetNearestEnemy();") yrest(500)
	local target = player:getTarget()
	i=0
	while ((target ~= nil) and (target.Alive) or (i ~=1000)) do
        sendMacro("UseAction(5,1)")
	i=i+1;
        target = player:getTarget();
	end;
        </waypoint>
Or a similar... ?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Scripting problems, need help

#8 Post by rock5 » Thu Oct 04, 2012 1:25 pm

Or

Code: Select all

while ((target ~= nil) and (target.Alive) and target.Address ~= player.Address) do
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#9 Post by lalaxy » Thu Oct 04, 2012 2:08 pm

Ure amazing :)
Best , shortest :)
Thy

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#10 Post by lalaxy » Sat Oct 06, 2012 6:38 am

IS here any solution , when the portal is fail???
Description: Char run into the portal and portal not works, so char standing in the port and cannot go to next wp. The solution in this case step back and run into the port again. till it will works.
Is any solution to this problem, some script what checking the success of the port or something ?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Scripting problems, need help

#11 Post by rock5 » Sat Oct 06, 2012 7:01 am

There is a nice simple solution on the first post of the teleporter topic that should work at most portals.

Code: Select all

if not GoThroughPortal() then
    __WPL:setWaypointIndex(__WPL.LastWaypoint - 1)
end
This will try to go through the portal and if it fails, it goes back to the last waypoint so that it can re-approach the portal and try again.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#12 Post by lalaxy » Sun Oct 07, 2012 5:57 am

Hi!

The last thing what makes things harder...Ive attached a screen. Bot freezes at this time. This is the point when char left the instance. I use waitForLoadingScreen(); , so i dunno why freezes sometimes. Some memory reading problem mybe ? It freezes,i cannot pause, cannot stop, nothing reaction. when i go through the portal, then it works again... when my address changed.
Any idea?

Attachments
freeze.png

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Scripting problems, need help

#13 Post by rock5 » Sun Oct 07, 2012 6:25 am

Maybe you tried to do a waitForLoadingScreen() after a GoThroughPortal? GoThroughPortal includes a waitForLoadingScreen() so your waitForLoadingScrren() would run after you've already left the instance and would wait for a loading screen that will never come.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#14 Post by lalaxy » Sun Oct 07, 2012 8:30 am

Not used gothroughportal, its a simple waypoint in the portal, with WaitForLoadingScreen().

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Scripting problems, need help

#15 Post by rock5 » Sun Oct 07, 2012 10:49 am

Walking to a waypoint in the portal is not very reliable. Sometimes it will teleport before it registers that it reached the waypoint. Then on the other side of the teleport it will still try to go to the last waypoint. That's why GotoPortal and GoThroughPortal were written. I recommend you use that bit of code I posted but make sure you use it at a waypoint outside the portal and remove the waypoint in the portal.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#16 Post by lalaxy » Sun Oct 07, 2012 11:28 am

Confirmed...Ill use it then :)
Many thx :)

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#17 Post by lalaxy » Wed Oct 17, 2012 11:44 am

Hi!

Everything seems working now...Only 1 problem remained...Sometimes teleport not appear in instance, so i cannot leave...Is there any solution for this problem ???

Thy

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: Scripting problems, need help

#18 Post by BillDoorNZ » Wed Oct 17, 2012 3:49 pm

Are you saying that the bot cannot detect the portal or that you cannot see the portal? Sometimes you cant see it, but it is still there, and sometimes you cant see it and as a result the collision detection fails to detect that you are where the portal is and therefore won't port you :(

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Scripting problems, need help

#19 Post by lalaxy » Wed Oct 17, 2012 4:57 pm

Hi!

I dunno wich, but i dont see the portal and bot cannot see it too...He goes back the lastest waypoint and try again gothroughportal without success...Or just standing where portal not be and wait (no loading screen appears)...Ive tryed manually go back and go through without success too...The only way when i leave party and go back again...If there arent easier solution this one would be one...But a lil complicated...

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: Scripting problems, need help

#20 Post by BillDoorNZ » Wed Oct 17, 2012 5:32 pm

lalaxy wrote:Hi!

I dunno wich, but i dont see the portal and bot cannot see it too...He goes back the lastest waypoint and try again gothroughportal without success...Or just standing where portal not be and wait (no loading screen appears)...Ive tryed manually go back and go through without success too...The only way when i leave party and go back again...If there arent easier solution this one would be one...But a lil complicated...
ouch....not much else you can do it seems :(

either drop party or set a transport point. Dropping party is prolly more efficient, and then handle running back in :(

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 7 guests