Player switch issue
-
- Posts: 6
- Joined: Sun May 02, 2010 6:00 am
Player switch issue
Hi.
I got this problem: I start the bot with one char, and then switch player while the bot is on pause, and then i unpause the bot. but when i level up with the new char the bot doesnt follow the things i put in <onLevelup>. Is it possible to fix that problem?
I got this problem: I start the bot with one char, and then switch player while the bot is on pause, and then i unpause the bot. but when i level up with the new char the bot doesnt follow the things i put in <onLevelup>. Is it possible to fix that problem?
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Player switch issue
You shouldn't be switching characters like that. Press CTRL+L, press UP arrow (it'll type in rom/bot.lua for you), and ENTER. Don't just pause and resume after switching.
-
- Posts: 6
- Joined: Sun May 02, 2010 6:00 am
Re: Player switch issue
I need that switch tho for some reason. But its ok i fixed it by borrowing some code from the bot.lua. I just have one problem tho, appreciate alot for any help. The bot cant use any pots after the switch, it keeps saying "NOTICE: Item mismatch (~=Simple First Aid Potion); updating item info (don't panic).". If that problem is sovled this is gonna be awesome
.
would also like to take the time to thank for a wonderfull bot program! :>
![Smile :)](./images/smilies/icon_e_smile.gif)
would also like to take the time to thank for a wonderfull bot program! :>
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Player switch issue
Code: Select all
inventory:update();
Re: Player switch issue
Sorry for resurrecting an old post but I'm having this problem too.
A shame the OP never said how he fixed it.
Anyway, finally got my multi-player scripts going but like the OP said, it doesn't level up skills or open giftbags. I'm not sure yet about pots.
What do I have to do to reset player?
A shame the OP never said how he fixed it.
Anyway, finally got my multi-player scripts going but like the OP said, it doesn't level up skills or open giftbags. I'm not sure yet about pots.
What do I have to do to reset player?
- 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
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Player switch issue
You could try completely re-creating the player object after switching.rock5 wrote: What do I have to do to reset player?
Code: Select all
local playerAddress = memoryReadIntPtr(getProc(), addresses.staticbase_char, addresses.charPtr_offset);
player = CPlayer(playerAddress);
player:initialize();
player:update();
Re: Player switch issue
This didn't work. Still not opening bags and, for some reason, wont attack any mobs. I assume it is some sort of player level issue.Administrator wrote:You could try completely re-creating the player object after switching.rock5 wrote: What do I have to do to reset player?Code: Select all
local playerAddress = memoryReadIntPtr(getProc(), addresses.staticbase_char, addresses.charPtr_offset); player = CPlayer(playerAddress); player:initialize(); player:update();
Any other ideas?
Edit: Sorry, it is opening bags. I think it was just confused because the first bag is usually opened when loading the profile. I'll have to do it manually.
But it's still not attacking mobs. If I exit the script and restart it, it works fine so there's nothing wrong with the script..
- 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
Re: Player switch issue
I thought of something when I woke this morning. profile settings I'd already changed would still be changed so I need to change them back to the profile settings.
Instead of changing all the settings back what I need is a command that reloads the profile.
I found this. I'll try it. Assuming load_profile_name hasn't lost it's value, it should work.
Instead of changing all the settings back what I need is a command that reloads the profile.
I found this. I'll try it.
Code: Select all
settings.loadProfile(load_profile_name);
- 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
Re: Player switch issue
Code: Select all
settings.loadProfile(load_profile_name);
Code: Select all
settings.loadProfile("myProfileName);
Looks like it won't over-write an already loaded profile. Actually it looks like the profile is reset to default before the new one is loaded. So maybe the problem is with the 'settings' variable. Maybe reset the settings before loading the profile?
Is there an easy way to reload the profile or should I just change all the values I've changed back to their original values manually?
- 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
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Player switch issue
I just noticed as I was about to post the quick solution to reload all settings that the default settings table was being overwritten.
Find this in settings.lua:
Change to:
Now, you can use that last line to reset to default settings. Let me know if this works.
Find this in settings.lua:
Code: Select all
settings = settings_default;
Code: Select all
function table.copy(_other)
local t = {};
for i,v in pairs(_other) do
t[i] = v;
end
return t;
end
settings = table.copy(settings_default);
Now, you can use that last line to reset to default settings. Let me know if this works.
Re: Player switch issue
So after making the above change I use this to reset my profile?Administrator wrote: Find this in settings.lua:Change to:Code: Select all
settings = settings_default;
Code: Select all
function table.copy(_other) local t = {}; for i,v in pairs(_other) do t[i] = v; end return t; end settings = table.copy(settings_default);
Code: Select all
local playerAddress = memoryReadIntPtr(getProc(), addresses.staticbase_char, addresses.charPtr_offset);
player = CPlayer(playerAddress);
player:initialize();
player:update();
settings = table.copy(settings_default);
settings.loadProfile("MyProfile");
- 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
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Player switch issue
Go to line 537 and you will have to add the table.copy() call there, as well. After that, you shouldn't need to explicitly call it in your profile as you are doing. If you do, though, it should be called before recreating the character object.
Re: Player switch issue
You've confused me a bit.Administrator wrote:Go to line 537 and you will have to add the table.copy() call there, as well. After that, you shouldn't need to explicitly call it in your profile as you are doing. If you do, though, it should be called before recreating the character object.
Line 537, I'm assuming you are talking about settings.lua. I should put
Code: Select all
settings = table.copy(settings_default);
Code: Select all
settings.profile = settings_default.profile;
So are you saying that if I add the line above, I don't have to do anything to reset the profile when I change characters or are you saying I don't have to do one of the commands?
Could you clarify exactly what I need to put in my waypoint file to reset my profile values once the above changes have been made to the settings.lua file?
- 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
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Player switch issue
rock5 wrote:
Line 537, I'm assuming you are talking about settings.lua. I should putbefore?Code: Select all
settings = table.copy(settings_default);
Code: Select all
settings.profile = settings_default.profile;
Code: Select all
settings.profile = table.copy(settings_default.profile);
I mean, you don't need this:What do you mean by "you shouldn't need to explicitly call it in your profile"? Do you mean my waypoint file? Because that is where I was trying to reset the profile.
Code: Select all
settings = table.copy(settings_default);
Re: Player switch issue
You didn't answer "exactly what I need to put in my waypoint file".
What I did was removeand
from the waypoint file. It didn't attack the mobs (The reason is because the following options were changed in a previous waypoint file TARGET_LEVELDIF_ABOVE and TARGET_LEVELDIF_BELOW and are not being reset to default) .
I tried puttingback in but got the "You assigned the key '0' double" error.
Just to remind you what we are trying to do here. We are trying to reset the profile after changing characters in the middle of a waypoint file.
Here is a recap of what I've done so far.
1. I have the following in my waypoint file onLoad event;2. I've changed
to:
3. I've changed
to:
Set up like this , it is still not attacking the mobs.
What I did was remove
Code: Select all
settings = table.copy(settings_default);
Code: Select all
settings.loadProfile("MyProfile");
I tried putting
Code: Select all
settings.loadProfile("MyProfile");
Just to remind you what we are trying to do here. We are trying to reset the profile after changing characters in the middle of a waypoint file.
Here is a recap of what I've done so far.
1. I have the following in my waypoint file onLoad event;
Code: Select all
local playerAddress = memoryReadIntPtr(getProc(), addresses.staticbase_char, addresses.charPtr_offset);
player = CPlayer(playerAddress);
player:initialize();
player:update();
Code: Select all
settings = settings_default;
Code: Select all
function table.copy(_other)
local t = {};
for i,v in pairs(_other) do
t[i] = v;
end
return t;
end
settings = table.copy(settings_default);
Code: Select all
settings.profile = settings_default.profile;
Code: Select all
settings.profile = table.copy(settings_default.profile);
- 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
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Player switch issue
Code: Select all
local playerAddress = memoryReadIntPtr(getProc(), addresses.staticbase_char, addresses.charPtr_offset);
player = CPlayer(playerAddress);
player:initialize();
player:update();
settings.load();
settings.loadProfile("profilenamehere");
I'm also going to add a new function to the player class to do the first 4 lines for you. I just committed this. In player.lua:
Code: Select all
function CPlayer.new()
local playerAddress = memoryReadIntPtr(getProc(), addresses.staticbase_char, addresses.charPtr_offset);
local np = CPlayer(playerAddress);
np:initialize();
np:update();
return np;
end
Now, in your profile you can use:
Code: Select all
player = CPlayer.new();
settings.load();
settings.loadProfile("profilenamehere");
Re: Player switch issue
Yep, it's working now. Thanks.
- 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
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests