PDA

View Full Version : Accessing Variables



legacy-Roy_Fokker
08-30-2003, 01:34 PM
i need to know how i can access the varaible in the class myVehicle from class TempHud



class myVehicle extends Pawn
config(User);

//Basic Vehicle Controls--
var float Steering; // between -1 and 1
var float TurnRate; // How many units it can turn in one second.
var float Throttle; // between -1 and 1
var float RateOfAccel; // The Acceleration until reaches Throttle Position


defaultproperties
{
TurnRate = 1.0;
Steering = 0;
Throttle = 0;
RateOfAccel = 10;
}




class HudTemp extends HudBase;

simulated function DrawHud(canvas c)
{
local float vehThrottle;

super.DrawHud(c);

if (PawnOwner.IsA('myVehicle'))
{
c.Drawtext("In A Vehicle");
vehThrottle = myVehicle(PawnOwner).Throttle; //Hmmmmmm Should work??
c.Drawtext(vehThrottle);
}
}


Few things i have tried, but my lack of UTscripting knowledge hinders me. Any suggestions / tips :confused:

legacy-CyberTao
08-30-2003, 03:21 PM
Maybe the text is written offscreen.
Try a "c.setpos(x,y)" before the drawtexts so that you are sure its written on screen.

legacy-Roy_Fokker
08-30-2003, 06:13 PM
No the text is not the problem

Problem is not being able to compile.

legacy-segall
08-30-2003, 06:35 PM
I know UCC compilation errors sometimes aren't much help, but please provide it anyway. Your code, as shown, seems like it should compile fine.