Simple crosshair mod.
by Mark Smithh · in Torque Game Engine · 08/20/2001 (9:29 pm) · 10 replies
This is an easy one. The only know problem is that the
crosshair shows up in 3rd person mode.
edit client/ui/PlayGui.gui
add:
new GuiBitmapCtrl(reticleHud) {
profile = "GuiButtonProfile";
horizSizing = "center";
vertSizing = "center";
position = "192 112";
extent = "32 32";
minExtent = "2 2";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
wrap = "0";
fillColor = "0.250000 0.250000 0.250000 0.250000";
frameColor = "0.000000 1.000000 0.000000 1.000000";
opacity = "0.5";
bitmap = "data/textures/crosshair.png";
autoCenter = "1";
autoResize = "1";
};
copy Crosshair imagefile to data/textures
And it should look something like this:

crosshair shows up in 3rd person mode.
edit client/ui/PlayGui.gui
add:
new GuiBitmapCtrl(reticleHud) {
profile = "GuiButtonProfile";
horizSizing = "center";
vertSizing = "center";
position = "192 112";
extent = "32 32";
minExtent = "2 2";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
wrap = "0";
fillColor = "0.250000 0.250000 0.250000 0.250000";
frameColor = "0.000000 1.000000 0.000000 1.000000";
opacity = "0.5";
bitmap = "data/textures/crosshair.png";
autoCenter = "1";
autoResize = "1";
};
copy Crosshair imagefile to data/textures
And it should look something like this:

#2
08/21/2001 (3:50 am)
after doing exactly what you say.... nothing happens... i dont see the crosshair...bah..; i'm sure its me forgetting something stupid again...
#3
08/21/2001 (4:48 am)
strange... just made my own playgui and that one does work... only i cant turn it on and off... (altough I'm using the right name)...
#4
You're sure you deleted the dso, right? That's what causes a lot of problems for people not familiar with scripts.
Check the console for syntax errors.
Dark
08/21/2001 (11:25 am)
Try tracking down the error. Make sure the function is being called, and %val = true.function toggleFirstPerson(%val)
{
if (%val)
{
$firstPerson = reticleHud.Visible = !$firstPerson;
error("*** $firstPerson = " @ $firstPerson);
}
else // %val = false
error("*** %val is false! ***");
}
// check and make sure the function is getting executed.
// if there's a syntax error this won't show up.
error("*** toggleFirstPerson: OK ***");You're sure you deleted the dso, right? That's what causes a lot of problems for people not familiar with scripts.
Check the console for syntax errors.
Dark
#5
08/21/2001 (1:21 pm)
yeh, got it all fixed. Dunno what was wrong actually... just ran it again and it worked fine
#6
How do I set the:
extent = "32 32"; // shown in bold in the below ex.
to fit the current screen resolution.
I have a binocular bitmap as HUD and now its set to 800x600 but what if I change the resolution, then it need to change as well.
See my thread about the scoped crosshair to understand why I wanna do this.
new GuiBitmapCtrl(reticleHud) {
profile = "GuiButtonProfile";
horizSizing = "center";
vertSizing = "center";
position = "192 112";
extent = "32 32";
minExtent = "2 2";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
wrap = "0";
fillColor = "0.250000 0.250000 0.250000 0.250000";
frameColor = "0.000000 1.000000 0.000000 1.000000";
opacity = "0.5";
bitmap = "data/textures/crosshair.png";
autoCenter = "1";
autoResize = "1";
};
Is there something I can change it with to set it to full extent?
// Clocks out
09/04/2001 (10:59 am)
I have a quick question.How do I set the:
extent = "32 32"; // shown in bold in the below ex.
to fit the current screen resolution.
I have a binocular bitmap as HUD and now its set to 800x600 but what if I change the resolution, then it need to change as well.
See my thread about the scoped crosshair to understand why I wanna do this.
new GuiBitmapCtrl(reticleHud) {
profile = "GuiButtonProfile";
horizSizing = "center";
vertSizing = "center";
position = "192 112";
extent = "32 32";
minExtent = "2 2";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
wrap = "0";
fillColor = "0.250000 0.250000 0.250000 0.250000";
frameColor = "0.000000 1.000000 0.000000 1.000000";
opacity = "0.5";
bitmap = "data/textures/crosshair.png";
autoCenter = "1";
autoResize = "1";
};
Is there something I can change it with to set it to full extent?
// Clocks out
#7
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
This would place the image at location 0,0 with an extent of 640x480 and would resize relative to the right and bottom.
09/04/2001 (12:57 pm)
horizSizing = "right"; vertSizing = "bottom";
position = "0 0";
extent = "640 480";
This would place the image at location 0,0 with an extent of 640x480 and would resize relative to the right and bottom.
#8
The above suggestion do not seem to work.
What it does is, it take the 640x480 bitmap and align it to the upper left corner which is fine.
Then it extent it to an area of 640x480, this is not good since I'm running the testapp at 800x600. Now the bitmap only cover a part of the screen instead of rezising to cover the whole screen.
Is there a way (like in html) to enter something like 100% instead of a number in the "extent".
I'm going to test this in a minut (probably dosen't work).
Any other suggestions?
// Clocks out.
09/05/2001 (1:03 am)
Reply to LabRat.The above suggestion do not seem to work.
What it does is, it take the 640x480 bitmap and align it to the upper left corner which is fine.
Then it extent it to an area of 640x480, this is not good since I'm running the testapp at 800x600. Now the bitmap only cover a part of the screen instead of rezising to cover the whole screen.
Is there a way (like in html) to enter something like 100% instead of a number in the "extent".
I'm going to test this in a minut (probably dosen't work).
Any other suggestions?
// Clocks out.
#9
The idea of changing this:
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
Into this:
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "100% 100%";
Didn't work all that good.
It did show the bitmap but it looked like it was 20% and not 100%, it did keep its aspect ratio though.
So any ideas?
// Clocks out (of the testing Lab)
09/05/2001 (1:24 am)
HmmmmThe idea of changing this:
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
Into this:
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "100% 100%";
Didn't work all that good.
It did show the bitmap but it looked like it was 20% and not 100%, it did keep its aspect ratio though.
So any ideas?
// Clocks out (of the testing Lab)
#10
I did it like this:
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
And it works.
// Clocks out.
09/05/2001 (2:43 am)
Ahhh I fixed it myself /me pads me on shoulderI did it like this:
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
And it works.
// Clocks out.
Torque Owner Chris "Dark" Evans
function toggleFirstPerson(%val) { if (%val) { $firstPerson = !$firstPerson; } }to this:
function toggleFirstPerson(%val) { if (%val) { $firstPerson = reticleHud.Visible = !$firstPerson; } }That works for me.
*Edit: Don't forget to delete default.bind.cs.dso.
Dark