Neither mouse buttons work for me in the compiled project.
Could you try iMouseButtonDown() instead of Click() in your project?
And could you try a new project with iMouseButtonClick() and compile it and check if it works?
The uploaded project already contains an iMouseButtonDown command (iMouseButtonDown(1)).
Also, I made a project containing an iMouseButton command, and that seemed to work fine.
I also took my problematic script and copy-pasted it into a new script object in a new project. I still had the same difficulties. Clearly there is something wrong with my script. Although I am still unsure why my project should work fine in the 3dRad editor, but differently in the compiled version.
Here's the problematic portion of my script. Perhaps someone can make sense of this all:
///----------------------------------------------------------CONTROLS - Weapons--------------------------------------------------------
float timer = 225;
dist = 70; //firing speed mps!!!
if ((finalrot > 60) && (finalrot < 100)) //final rot is the orientation of the camera relative to the orientation of the boat. The camera direction is used to decide which guns to fire.
{
weapon = "right";
}
else if ((finalrot < -60) && (finalrot > -100))
{
weapon = "left";
}
else if ((finalrot > 150) || (finalrot < -150))
{
weapon = "rear";
}
else
{
weapon = "...";
}
if (iMouseButtonDown(1)) ///AIM!
{
if (weapon == "left")
{
iObjectChildTransform(OBJ_0,OBJ_330,Vector3(0,0,0),aim[0]); //place and orientate the aiming skinmesh
iObjectOrientationSet(OBJ_330,SHIPQY);
iObjectShow(OBJ_330);
}
else if (weapon == "right")
{
iObjectChildTransform(OBJ_0,OBJ_330,Vector3(0,0,0),aim[1]); //place and orientate the aiming skinmesh
iObjectOrientationSet(OBJ_330,SHIPQY);
iObjectShow(OBJ_330);
}
else if (weapon == "rear")
{
iObjectChildTransform(OBJ_0,OBJ_330,Vector3(0,0,0),aim[2]); //place and orientate the aiming skinmesh
iObjectOrientationSet(OBJ_330,SHIPQY);
iObjectShow(OBJ_330);
}
else
{
iObjectHide(OBJ_330);
}
}
else
{
iObjectHide(OBJ_330);
}
if (iMouseButtonClick(0)) ///FIRE!
{
if (weapon == "left")
{
if (left > timer)
{
for(n=0;n<4;n++)
{
rand = (iFloatRand(50,90))*0.1;
iObjectChildTransform(OBJ_0,OBJ_286,Vector3(0,0,0),gun[n]);
iObjectLocation(OBJ_286,cbloc);
iObjectImposterSet(OBJ_220,n,Q,cbloc);
iObjectImposterVelocitySet(OBJ_220,n,Vector3(L[0].x,rand,L[0].z));
left = 0;
}
//----------smoke
iObjectChildTransform(OBJ_0,OBJ_242,Vector3(0,0,0),gun[0]);
iObjectOrientationSet(OBJ_242,SHIPQY);
iObjectStart(OBJ_242);
iObjectChildTransform(OBJ_0,OBJ_352,Vector3(0,0,0),gun[1]);
iObjectOrientationSet(OBJ_352,SHIPQY);
iObjectStart(OBJ_352);
iObjectChildTransform(OBJ_0,OBJ_374,Vector3(0,0,0),gun[2]);
iObjectOrientationSet(OBJ_374,SHIPQY);
iObjectStart(OBJ_374);
iObjectChildTransform(OBJ_0,OBJ_396,Vector3(0,0,0),gun[3]);
iObjectOrientationSet(OBJ_396,SHIPQY);
iObjectStart(OBJ_396);
//-------------
}
}
if (weapon == "right")
{
if (right > timer)
{
for(n=4;n<8;n++)
{
rand = (iFloatRand(50,90))*0.1;
iObjectChildTransform(OBJ_0,OBJ_286,Vector3(0,0,0),gun[n]);
iObjectLocation(OBJ_286,cbloc);
iObjectImposterSet(OBJ_220,n,Q,cbloc);
iObjectImposterVelocitySet(OBJ_220,n,Vector3(L[0].x,rand,L[0].z));
right = 0;
}
//----------smoke
iObjectChildTransform(OBJ_0,OBJ_242,Vector3(0,0,0),gun[4]);
iObjectOrientationSet(OBJ_242,SHIPQY);
iObjectStart(OBJ_242);
iObjectChildTransform(OBJ_0,OBJ_352,Vector3(0,0,0),gun[5]);
iObjectOrientationSet(OBJ_352,SHIPQY);
iObjectStart(OBJ_352);
iObjectChildTransform(OBJ_0,OBJ_374,Vector3(0,0,0),gun[6]);
iObjectOrientationSet(OBJ_374,SHIPQY);
iObjectStart(OBJ_374);
iObjectChildTransform(OBJ_0,OBJ_396,Vector3(0,0,0),gun[7]);
iObjectOrientationSet(OBJ_396,SHIPQY);
iObjectStart(OBJ_396);
//-------------
}
}
if (weapon == "rear")
{
if (rear > timer)
{
for(n=8;n<10;n++)
{
rand = (iFloatRand(50,90))*0.1;
iObjectChildTransform(OBJ_0,OBJ_286,Vector3(0,0,0),gun[n]);
iObjectLocation(OBJ_286,cbloc);
iObjectImposterSet(OBJ_220,n,Q,cbloc);
iObjectImposterVelocitySet(OBJ_220,n,Vector3(L[0].x,rand,L[0].z));
rear = 0;
}
//----------smoke
iObjectChildTransform(OBJ_0,OBJ_242,Vector3(0,0,0),gun[8]);
iObjectOrientationSet(OBJ_242,SHIPQY);
iObjectStart(OBJ_242);
iObjectChildTransform(OBJ_0,OBJ_352,Vector3(0,0,0),gun[9]);
iObjectOrientationSet(OBJ_352,SHIPQY);
iObjectStart(OBJ_352);
//-------------
}
}
}
for(CBI=0;CBI<10;CBI++)
{
iObjectImposterGet(OBJ_220,CBI,CBQ[CBI],CBL[CBI]); //get the location of each cannonball
iObjectImposterSet(OBJ_198,CBI,CBQ[CBI],CBL[CBI]); //place some 'firey' particles there
}
//this portion of the script (among other things) determines the vector for the iObjectImposterVecocitySet command for each cannonball. - it doesn't seem to be causing the problem.
iObjectLocationSet(OBJ_264,L[1]); //centre place
iObjectLocation(OBJ_308,L[2]); //aim get
L[0] = Vector3((L[2].x-L[1].x),0,(L[2].z-L[1].z));
iQuaternionFromEulerAngles(SHIPQY,0,Rot.y,0,"xyz");
iObjectOrientationSet(OBJ_264,SHIPQY);
iObjectChildTransform(OBJ_264,OBJ_308,Vector3(0,0,0),Vector3(0,0,dist));
left++;
right++;
rear++;
}
Just to reiterate. This script works fine in the editor. And I can use iMouseButton commands in other compiled projects. It is just
the iMouse commands in this particular script, which don't work in
compiled projects.
Anyway, thanks so much for the suggestions. I appreciate your guys help.
I should mention that there is one thing I have not tried. I might attempt to remove the problematic portion of my script and re-do it in another script object. Perhaps that would set things straight.
Cheers,
G