Game Development Community

Quick question objects

by Stephen Walsh · in Torque Game Engine · 11/15/2005 (7:46 am) · 11 replies

I have this


....
MyColor = "./RedZone";
bitmap = MyColor;
....

in this code

new GuiCrossHairHud() {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "691 5";
extent = "64 32";
minExtent = "8 2";
visible = "1";
MyColor = "./RedZone";
bitmap = MyColor;
wrap = "0";
damageFillColor = "0.000000 1.000000 0.000000 1.000000";
damageFrameColor = "1.000000 0.600000 0.000000 1.000000";
damageRect = "50 4";
damageOffset = "0 32";
};

this is in the playGui.gui

cant figure out where to create the object MyColor cause the engine keeps saying "cannot find texture MyColor".

or maybe i can access the bitmap object outside of the function and change it that way. either way i need the bitmap to change based on triggers.

THanks for your help guys
Stephen Walsh

#1
11/15/2005 (2:43 pm)
Any ideas
#2
11/16/2005 (6:25 am)
Never mind i got te answer i can change the bipmap withthe fillowing command
"coatHUD.setBitmap("Wyeth/client/ui/empty");"

where coatHud is "new GuiBitmapCtrl(coatHUD)"


hope this helps some people out there. i was using it in a trigger so that the color of a bitmap in the gui matched the color zone you where in.
#3
11/16/2005 (6:26 am)
Dont you just love figuring these things out =) man going to get so drunk tonight =) lol
#4
11/16/2005 (8:18 am)
Maybe you couldn't figure it out... cause you were drunk?
#5
11/16/2005 (10:41 am)
No i couldn't figure it our cause i dont know alot about torque script and how its function calls work.
#6
11/22/2005 (4:21 am)
Ok slight problem , every time i enter the trigger on the client side , the gui changes on the server side , any ideas?
#7
11/22/2005 (4:57 am)
You don't enter triggers client-side. And there are no GUI's serverside.

That's probably what your problem is, too. You need to run the GUI code on the client, and you're most likely doing it on the server.

Take a look at how commandToClient works, and use it in the trigger to send a message to the client, telling it to manipulate the GUI.
#8
11/30/2005 (8:23 am)
Whats wrong with this line??


Quote:commandToClient.PlayGui.ZoneHUD.setBitmap("Wyeth/client/ui/coat");

get the error setBitmap was not found.
ithought setbitmap wass a predefined function embedded into the GuiBitmapCtrl,

any ideas,?

p.s i've also tried


Quote:commandToClient.ZoneHUD.setBitmap("Wyeth/client/ui/coat");
#9
11/30/2005 (11:51 am)
There's all kinds of things wrong with this line. :P

commandToClient.PlayGui.ZoneHUD.setBitmap("Wyeth/client/ui/coat");

commandToClient is a function call - you're treating it like an object!
#10
11/30/2005 (11:54 am)
Lol , crap, can you give me on hand on it? please
#11
12/06/2005 (11:17 am)
Ok i got it , if any one is intersted on how to do this, this is the answer
and it works

i have to thank this address for there inspiring post "http://www.garagegames.com/mg/forums/result.thread.php?qt=5700"

i changed

"commandToClient.PlayGui.ZoneHUD.setBitmap("Wyeth/client/ui/coat");"


to this (server/scripts/triggers.cs)

Quote:
function BlueZone::onEnterTrigger( %this, %trigger, %obj )
{
%client = %obj.client;
commandToClient(%client,'hudTarget',%trigger);
Parent::onEnterTrigger( %this, %trigger, %obj );
}


client/scripts/init.cs

Quote:
exec("./scripts/triggerClient.cs");


client/scripts/triggerClient.cs
Quote:

function clientCmdhudTarget(%trigger)
{
coatHUD.setBitmap("Wyeth/client/ui/coat");
}