Wierd function return problems on custom class

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Drew

New Member
May 15, 2003
13
0
0
Visit site
This is really wierd. I'm trying to return from a function my custom class variable, but when I do that it only returns the default values, even though I KNOW that's not what I returned, since I've been logging and debugging everything TONS in the past 4 hours.

I have a custom class that inherits from info, lets call it myThingy. I call an accessor function that owns that object to return it, like this:

Code:
Class myBot extends xBot;

var myThingy myOwnThingy;

function changeThingy()
{
  // do LOTS of stuff here to change the values
}

function returnMyThingy()
{
  return myOwnThingy;
}

------------------
Class somethingElse...

function doSomething()
{
  local myThingy differentOne;
   differentOne = myBot(bot).returnMyThingy();

  // but it just returns to me the default class values!!
}

So basically, when I try to return my custom class variable from any function, it only returns the default values and not the values of the var I tried to return!! And this isn't even a replication problem, so I'm real confused. Does anyone know what I'm doing wrong? I even went as far as trying to overload the = operator because I thought maybe that might help, but I couldn't get that to work either. *sigh*
 

Corran

Danger Mouse
Mar 10, 2003
168
0
0
37
Portsmouth, England
planetunreal.com
you've got to change:
Code:
function returnMyThingy()
{
  return myOwnThingy;
}
to
Code:
function myThingy returnMyThingy()
{
  return myOwnThingy;
}
Or fi you were trying to return a float, you'd do:
Code:
function float returnMyFloat()
{
  return MyFavouriteFloat;
}
I assume that is what you mean.
 

Drew

New Member
May 15, 2003
13
0
0
Visit site
thanks for the reply guys

Actually, it turns out the return variables were working fine, but somehow the variable I was initializing got erased accidentally a bit later, so when I returned it, nothing was in there.