Jump to content

Compilation Error


fatfang

Recommended Posts

I have following compilation error :

Translated the error best i could.

Spoiler

error CS0019: Operator > cannot be use with operand types MemoryRobot.Int128 and int

Code below :
internal void Rotation()
    {
        Logging.Write("[My fightclass] Is started.");
        while (_isLaunched)
        {
            try
            {
                if (!Products.InPause)
                {
                    if (!ObjectManager.Me.IsDeadMe)
                    {
                        //BuffRotation();

                        if (Fight.InFight && ObjectManager.Me.Target > 0)
                        {
                            Pull();
                            CombatRotation();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Logging.WriteError("[My fightclass] ERROR: " + e);
            }

            Thread.Sleep(10); // Pause 10 ms to reduce the CPU usage.
        }
        Logging.Write("[My fightclass] Is now stopped.");
    }

 

Also i get compilation errors with following code (error included in the spoiler)

 

Spoiler

error CS0019 Operator == cannot be used with operand types MemoryRobot.Int128 and ulong
error CS0029 Class MemoryRobot.Int128 cannot be implicidly transformed to class ulong

internal void Pull()
    {
        if (ObjectManager.Me.Target == _lastTarget)
            return;
 
        // Stealth:
        if (Prowl.IsSpellUsable && !Prowl.HaveBuff && ObjectManager.Target.Target != ObjectManager.Me.Guid)
        {
            Prowl.Launch();
            _lastTarget = ObjectManager.Me.Target;
        }
    }

 

 

Link to comment
Share on other sites

1 hour ago, fatfang said:

 

  Hide contents

Code below :
internal void Rotation()
    {
        Logging.Write("[My fightclass] Is started.");
        while (_isLaunched)
        {
            try
            {
                if (!Products.InPause)
                {
                    if (!ObjectManager.Me.IsDeadMe)
                    {
                        //BuffRotation();

                        if (Fight.InFight && ObjectManager.Me.HasTarget)
                        {
                            Pull();
                            CombatRotation();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Logging.WriteError("[My fightclass] ERROR: " + e);
            }

            Thread.Sleep(10); // Pause 10 ms to reduce the CPU usage.
        }
        Logging.Write("[My fightclass] Is now stopped.");
    }

Try  if (Fight.InFight && ObjectManager.Me.HasTarget)

 

  Hide contents


error CS0019 Operator == cannot be used with operand types MemoryRobot.Int128 and ulong
error CS0029 Class MemoryRobot.Int128 cannot be implicidly transformed to class ulong

internal void Pull()
    {
        if (ObjectManager.Me.Target == _lastTarget?.Guid)
            return;
 
        // Stealth:
        if (Prowl.IsSpellUsable && !Prowl.HaveBuff && ObjectManager.Target.Target != ObjectManager.Me.Guid)
        {
            Prowl.Launch();
            _lastTarget = ObjectManager.Me.TargetObject;
        }
    }

 

Make sure that ur property "_lastTarget" is type of ulong and not int

Hope that helped.

Link to comment
Share on other sites

10 minutes ago, fatfang said:

Only thing i have in code is "private WoWUnit _lastTarget;"

Oh okay that means you are holding the object of the target. If you want to validate it by ID you just need to use the Guid property. I have changed the code above just check it out. You need to take care of the type you are validating. 

For example:
 

_lastTarget = ObjectManager.Me.Target;

You tried to put a ulong into a WoWUnit object and that wont work.

Link to comment
Share on other sites

4 minutes ago, fatfang said:

Ok, i think i got it now. Thanks :)

 

It was template by Droidz in here 

 

Maybe hes template needs also fixing :)

 

He is not using the WoWUnit object ;) he is using the ulong 

    private ulong _lastTarget;
Link to comment
Share on other sites

Well it was originally full copy paste, it didnt work either with that ulong. After i did change the code while trying to fix it.

Same error.

 

Below error from direct copy paste of that template. Same error in exactly same row. It might have been working template when he created but it aint anymore :/

b300ff7ea5.png

Link to comment
Share on other sites

Hello, replace

ObjectManager.Me.Target > 0

by

ObjectManager.Me.Target.IsNotZero()

and replace (if '_lastTarget' is WoWUnit):

if (ObjectManager.Me.Target == _lastTarget)

by

if (ObjectManager.Me.Target == _lastTarget.Guid)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...