Post by F1Andre on Mar 30, 2015 21:36:47 GMT
Finally there are a full how to on how to use a XBOX remote with 3DRAD. I will show you everything(you need to know a little scripting) that you must do in order to make it work. The documentation of the DLL is gone and the only remains that are left is the DLL he created that was used in TR-Zero.
There was a DLL created by Jestermon and you can use his DLL or the built in joystick functions.
Jestermons DLL:
Using the iJoyButtonDown():
In order to use the RT and LT you must use the following:
I will upload the code for the joysticks once I figure it out. On the picture I created there are two values (1;2). You must use the first value if you are using the iJoyButtonDown and the other one for the DLL( This will be the y value as revere in the scripts). Don't switch the two otherwise the controls will be all mixed up and some may not work. The D-Pad only works if you use the DLL. The y values as revered In the scripts for the D-Pad are as Follows: Up = 11; Down = 10; Right = 14; Left = 13.
Say thanks to imothep85 , cause without him asking I would never have gone so far and there would have been no thread on this. Thank you imothep85
There was a DLL created by Jestermon and you can use his DLL or the built in joystick functions.
Jestermons DLL:
// y is the joystick button number and must be replaced with the correct one(Note use the image that is attached to determine wich button you would like to use
// Make sure that the DLL is placed in the script folder
int handle_xbox = 0;
void Main()
{
iDLLCall(handle_xbox,"xboxinfo",0); // Call the DLL function
if(iInitializing())
{
handle_xbox = iDLLLoad(".\\3DRad_res\\objects\\Script\\xbox-03.dll"); // Load the DLL in order to use it, make sure you have put the DLL in the right folder
}
int x;
if(iDLLArrayGet(y)==1){x=1;} // Call this and it would return 1 if the correct key (y) was pressed on the remote
else if(iDLLArrayGet(y)==1){x=2;}// Use this if you want to us more than 1 button
else if(iDLLArrayGet(y)==1){x=3;}
else{x=0;}
if(x==1)
{
// Do Something
}
if(x==2)
{
// Do Something
}
if(x==3)
{
// Do Something
}
}
Using the iJoyButtonDown():
//x is the joystick number and it is by default 0 so make it 0 when you use it
// y is the joystick button number and must be replaced with the correct one(Note use the image that is attached to determine wich button you would like to use
// This works exactly the same as the iKeyDown() function
if(iJoyButtonDown(x,y))
{
// Do Something
}
In order to use the RT and LT you must use the following:
//x is the joystick number and it is by default 0 so make it 0 when you use it
// On default the LT will return a value greater than 0 and RT a value less than 0
int zax1;
float zax2;
void Main()
{
zax2 = iJoyZ(x); // Get the value of LT and RT when pressed down
zax1 = zax2;
if(zax1 > 0)
{
// Do something or use the next lines of code. OUT_1 is the throttle state of the car object so link a car to the script
OUT_1 = zax2; // Now LT will drive the car forward. Multiply zax2 with -1 to use RT instead of LT. By multiplying you switch the controls around
}
if(zax1 < 0)
{
// Do something or use the next lines of code. OUT_1 is the throttle state of the car object so link a car to the script
OUT_1 = zax2; // Now RT will drive the car forward. Multiply zax2 with -1 to use RT instead of RT. By multiplying you switch the controls around
}
I will upload the code for the joysticks once I figure it out. On the picture I created there are two values (1;2). You must use the first value if you are using the iJoyButtonDown and the other one for the DLL( This will be the y value as revere in the scripts). Don't switch the two otherwise the controls will be all mixed up and some may not work. The D-Pad only works if you use the DLL. The y values as revered In the scripts for the D-Pad are as Follows: Up = 11; Down = 10; Right = 14; Left = 13.
Say thanks to imothep85 , cause without him asking I would never have gone so far and there would have been no thread on this. Thank you imothep85