Help: new Userfunction CheckInstance

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Help: new Userfunction CheckInstance

#1 Post by kanta »

Ok, biggest problem I'm having is when I'm trying to enter the Cyclops Stronghold instance to farm for gold. Since the instance entrance glitches, you sometimes do not enter the instance when you approach it. Because of this my character just stands there doing nothing and eventually gets killed because a mob comes up and attacks while waiting for the loading screen. My pain in the butt brainchild is this:

I know the coding is defunct. I don't really know what I'm doing, but trying to go with the idea anyway. I do not know what is allowed and what is not. I'm just trying to pull code that I can see in your existing LUA coding and mash it together to make my function.

Code: Select all

function CheckInstance()

	self:setWaypointIndex(self:getNearestWaypoint(player.X, player.Z, player.Y));
	self.LastWaypoint = self.CurrentWaypoint -1
		if self.LastWaypoint < 1 then
			self.CurrentWaypoint = self.CurrentWaypoint - 2;
		else
			waitForLoadingScreen();
			yrest(1000);
	end
end
The idea is this: Once it arrives at the waypoint that is supposed to trigger the loading into the instance it checks that waypoint value against the previous waypoint. If it determines that the last waypoint isn't changed then it needs to return to that last waypoint and try again. If it sees that it has changed then it can continue with a loading screen wait and then continue with the rest of the waypoints.

As I said, my coding is a horror story and shows I have no clue what I'm doing but I'm hoping my idea is a good one and something you'd like to incorporate into your code. As I see it, it could come in handy for many things. Maybe something like this is already in existence and I just can't find a reference to it. If that's the case could you please inform me of what that command is and how to use it?

Thank in advance for any advice.
Scout/Knight/Rogue 70/66/66
User avatar
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: Help: new Userfunction CheckInstance

#2 Post by Administrator »

You're using 'self' inside a non-class function. That's likely to generate a number of errors. I assume this is to be added to the CWaypointList class?
kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Help: new Userfunction CheckInstance

#3 Post by kanta »

To be honest, I'm not sure where it should be. I was just trying to make something to put in the userfunctions folder
Scout/Knight/Rogue 70/66/66
User avatar
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: Help: new Userfunction CheckInstance

#4 Post by Administrator »

If you're going to use 'self', you're going to have to change the function to CWaypointList:CheckInstance(). Otherwise, replace 'self' with __WPL.
kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Help: new Userfunction CheckInstance

#5 Post by kanta »

Ok, thank you for the information, I'll see what I can come up with.
Scout/Knight/Rogue 70/66/66
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Help: new Userfunction CheckInstance

#6 Post by rock5 »

I don't think your code will work because before you teleport your possition wouldn't have changed and while it's teleporting, trying to do a player:update() to get current possition will cause an error.

You might be able to make use of the waitForLoadingScreen() optional 'maxwaittime' argument. Check out the wiki. No wait. Looks like I didn't update it.

Basically what you could do is
1. Goto the waypoint to teleport
2. Do a waitForLoadingScreen(20) or however many seconds you think is a safe maximum time to wait.
3. Check your possition.
4. If you are in the instance then continue.
5. If not in the instance goto your last waypoint to try again.

Unfortunately if mobs can attack you in the portal when you failed to teleport, it will still wait the full maximum wait time until it fights back. There is no way around this that I can see. Hopefully you can survive that amount of time without dying. Maybe you could case a HOT spell just before trying to teleport? Or maybe it's not an issue if you just killed all the mobs on the way to the portal.

Edit: actually waitForLoadingScreen returns 'false' if it failed to teleport during the wait time so you could do something like.

Code: Select all

if waitForLoadingScreen(20) == false then
    go back to previoius waypoint
end
If it succeded then it would continue to the next waypoint.
  • 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
kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Help: new Userfunction CheckInstance

#7 Post by kanta »

Thanks Rock, I'll try that.
Scout/Knight/Rogue 70/66/66
Post Reply