Why won't this compile....
by Matt "Mr. Pig" Razza · in Torque Game Engine · 10/29/2005 (4:36 pm) · 5 replies
Code:
Error:
function PlayGui::sniperZoom(%this)
{
if ($sZoom == 0)
{
xHair.setBitmap("")//Zoom
$sZoom = 1;
}
else
{
xHair.setBitmap(~/data/crosshairs/1) //UnZoom
$sZoom = 0;
}
}Error:
Compiling main/client/ui/PlayGui.gui...
main/client/ui/PlayGui.gui Line: 40 - Syntax error.
>>> Advanced script error report. Line 79.
>>> Some error context, with ## on sides of error halt:
^if ($sZoom == 0)
^{
^^xHair.setBitmap("")//Zoom
^^$sZoom ##=## 1;
^}
^else
^{
^^xHair.setBitmap(~/data/crosshairs/1) //UnZoom
>>> Error report complete.About the author
#2
Also I believe (not 100% sure) but setBitmap requires a string. So it should be:
10/29/2005 (5:35 pm)
AlsoxHair.setBitmap(~/data/crosshairs/1)needs a ;
xHair.setBitmap(~/data/crosshairs/1);
Also I believe (not 100% sure) but setBitmap requires a string. So it should be:
xHair.setBitmap("~/data/crosshairs/1");
#3
It says there is no such thing as setExtent, then what do I use to set the size?
10/29/2005 (5:38 pm)
Yeah, you were right, I figured that out a few min ago. Thanks guys... I have a new question, this will compile, but won't run.function PlayGui::sniperZoom(%this)
{
if ($sZoom == 0)
{
xHair.setBitmap("main/data/crosshairs/2"); //Zoom
xHair.setExtent($pref::display::resolution); //Size
$sZoom = 1;
}
else
{
xHair.setBitmap("main/data/crosshairs/1"); //UnZoom
xHair.setExtent("64 64"); //Size
$sZoom = 0;
}
}It says there is no such thing as setExtent, then what do I use to set the size?
#4
I had use this resource for creating sniper scope + zoom:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8387
Hope this helps!
10/29/2005 (5:50 pm)
I dont know if this will help you but If I can recall I am using something like setFOV.I had use this resource for creating sniper scope + zoom:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8387
Hope this helps!
#5
10/29/2005 (10:12 pm)
Thanks, that was just what I needed. (After reading through that resource I relized that there is a much easier way to zoom then what it said)
Torque Owner Gregory "Centove" McLean
xHair.setBitmap("")//Zoomneeds a ; after it.xHair.setBitmap("");//Zoom