What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Refreshing ObjectManager

Gideonnn

New Member
Joined
Apr 7, 2012
Messages
94
Reaction score
0
I'm trying to let PB do something that depends on which character you are logged in as. Right now I have something like this:

PHP:
while(true) {
if(Me.Name == "Something") {
//Do stuff
}
if(Me.Name == "Something else") {
//Do other stuff
}
}

This doesn't work because Me.Name never changes, not even when a relog occures. I tested with this:

PHP:
<?xml version="1.0" encoding="utf-8"?>
<Professionbuddy>
  <CustomAction Code="MessageBox.Show(ObjectManager.Me.Name);" />
  <CustomAction Code="SwitchCharacter(&quot;Gideonpabank&quot;, &quot;Turalyon&quot;, &quot;Gatherbuddy2&quot;);" />
  <WaitAction Condition="Me.ZoneId == 1537" Timeout="15000" />
  <CustomAction Code="ObjectManager.Update();" />
  <CustomAction Code="MessageBox.Show(ObjectManager.Me.Name);" />
</Professionbuddy>

The name stays the same as before the relog, so i thought i could use .Update to refresh everything, but doesnt work.

Is there a way to get your actual character name?
 
PHP:
Lua.GetReturnVal<string>("return UnitName('player')")
 
Ye thats the way i fixed it. Feels kinda like a dirty fix though..
 
The name stays the same as before the relog, so i thought i could use .Update to refresh everything, but doesnt work.
Narayan, I believe that's what he already tried. I did bother to read his post though so that's how I figured it out ;)
 
Narayan, I believe that's what he already tried. I did bother to read his post though so that's how I figured it out ;)

Really :0 Me too, hence I asked the question, does it not work. The follow on question would have then been whereabouts in the code is it being put. But rather than pointlessly adding to the thread I was going to try and be constructive...
 
Last edited:
Updating the ObjectManager only refreshes the objects currently held by it. As far as I know, LocalPlayer or whatever it is called is a field which is populated upon initialization, thus updating the ObjectManager does not affect it.
 
for it to work code as follows:

ObjectManager.Update();
Me = ObjectManager.Me;

Where Me is whatever you call your LocalPlayer in code. If you update ObjectManager and don't tell Localplayer to update it will still be giving back old data;
 
I'm trying to let PB do something that depends on which character you are logged in as. Right now I have something like this:

PHP:
while(true) {
if(Me.Name == "Something") {
//Do stuff
}
if(Me.Name == "Something else") {
//Do other stuff
}
}

This doesn't work because Me.Name never changes, not even when a relog occures. I tested with this:

PHP:
<?xml version="1.0" encoding="utf-8"?>
<Professionbuddy>
  <CustomAction Code="MessageBox.Show(ObjectManager.Me.Name);" />
  <CustomAction Code="SwitchCharacter("Gideonpabank", "Turalyon", "Gatherbuddy2");" />
  <WaitAction Condition="Me.ZoneId == 1537" Timeout="15000" />
  <CustomAction Code="ObjectManager.Update();" />
  <CustomAction Code="MessageBox.Show(ObjectManager.Me.Name);" />
</Professionbuddy>

What would the corrected code look like for this?
 
Back
Top