![]() |
|
|
#1 |
|
Registered User
Join Date: May. 15th, 2003
Posts: 13
|
Wierd function return problems on custom class
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!!
}
|
|
|
|
|
|
#2 |
|
you've got to change:
Code:
function returnMyThingy()
{
return myOwnThingy;
}
Code:
function myThingy returnMyThingy()
{
return myOwnThingy;
}
Code:
function float returnMyFloat()
{
return MyFavouriteFloat;
}
__________________
<tarquin> to know what you wish to know, first you must know what you wish to know Play more Jailbreak! Save Sam and Max! |
|
|
|
|
|
|
#3 |
|
For more general information about returning values from functions see UnrealWiki: Function Syntax.
__________________
Wormbo's UT/UT2004/UT3 mods | YouTube channel | PlanetJailbreak | Unreal Wiki | Liandri Archives Everything you ever wanted to know about replication | UnrealScript security considerations <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort <TNSe> nono <TNSe> its always funny to find code a week later you dont even remember writing <Pfhoenix> what's worse is when you have a Star Wars moment <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!" Last edited by Wormbo; 25th Jun 2003 at 12:57 PM. |
|
|
|
|
|
|
#4 |
|
Registered User
Join Date: May. 15th, 2003
Posts: 13
|
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. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|