SOLVED: sensorbar problem

Wiimote tutorials, configurations and GPC scripts (FPS like in Nintendo Wii/WiiU).

Moderator: OFC-Giorgio

SOLVED: sensorbar problem

Postby teddy18 » Tue Jul 21, 2015 5:08 pm

I have Problem with the sensorbar
The sensorbar loses connection when i turn the Wimote too far left or Right
The Titan one Led turn red
Who got the problem too?

This Script i use:

Code: Select all
// GPC Online Library
// call_of_duty_wiimote_script_bravo_settings.gpc

// GPC Online Library
// call_of_duty_wiimote_script_bravo_settings.gpc

/*
   OFC-Giorgio - Call of duty wiimote script (bravo settings)

   (c) 2014 OFC-Giorgio - All right reserved

   ONLY PUBLISHED ON consoletuner.com (makers of the Titan One usb dongle)

   NO RIGHTS TO PUBLISH ELSEWHERE WITHOUT WRITTEN CONSENT OF THE AUTHOR

   Changelog:

   20141126-1
              * Added support for PS4, XBOX1 & XBOX360 (so now the script works for
                PS3, PS4, XBOX1 & XBOX360).

   20141105-1
              * Updated copyright notice to prevent illegal copying and
                publishing on other places than consoletuner.com
                (makers of the Titan One usb dongle)
              * Empty battery indicator (led 3 on if battery level less or equal 20%)

   20141021-1
              * Make nunchuck stick 3 states based on value of
                MOVE_LEFT_RIGHT_3STATES and MOVE_FORWARD_BACKWARD_3STATES
                parameters.
              * Changed default ADS_SENSITIVITY to 35 and NON_ADS_SENSITIVITY to 44.

   20141019-1
              * Make nunchuck stick 3 states only (per direction):
                - stick is only up/neutral/down (vertical).
                - stick is only left/neutral/right (horizontal).
              * Removed: Led 3 indicates ADS.

   20141018-1
              * Removed crouch/prone macro (standard wii C button works fine).
              * Use different sensitivity for ADS (aiming down the sights) and
                non ADS (hip fire) via ADS_SENSITIVITY and NON_ADS_SENSITIVITY parameters
              * Led 3 indicates ADS.
              * Led 4 indicates wiimote is out of reach of sensorbar and
                IRX & IRY are set to 0 to prevent spinning around.
              * RUMBLE_ENABLED parameter to enable/disable vibrating
              * Documented all wii keys (including non nunchuk) and keys for dummy mappings.

   20140916-1
              * Initial tagged version.
   
   Based on the scripts of wiimote Fuzzy, Wiimote3, Wiimote and J2Kbr I created
   a script to mimic the "bravo" settings wiimote+nunchuck of the wii(u) cod
   games (ghosts, blackops 2, modern warfare 3, black ops, modern warfare reflex
   and world at war) for the PS3 but this script can easily be altered for the
   PS4, XBOX 360 and XBOX One.

   The first version of my script I posted in the c o n t r o l l e r m a x
   forums (their "publish script to library" function in gtuner suspiciously did
   not work) and the overfortyclan forums.
   
   I removed my scripts from c o n t r o l l e r m a x and only publish them in
   the c o n s o l e t u n e r Titan One library.
 
   In the Titan One forums I posted information about the wii sensorbar that is needed
   for operating the wiimote.
   
   I knew of both the device dongle and the titan one dongle (and the
   dispute between the two).
   
   Initially I choose (and purchased) the device dongle because of their
   claim of a bigger community and better support. However to me the
   device "staff" appeared evasive and suspicious about the api, library,
   a couple of software/website bugs I informed them about, future fixes and
   future updates, as well as arrogant and rude in their communication towards
   me (and others).
   
   After asking the same questions in the Titan One forums of
   c o n s o l e t u n e r, I not only got (more detailed) answers, I also noticed
   there were software updates and even my request to have deadzone settings in
   MaxAIM DI was added to the new version over night.

   For now I assume that the Titan One team is the original developer and has
   the source code of the firmware, gtuner and the plugins. Based on this
   information I purchased a Titan One dongle and my scripts also worked on it.

   Hence I removed my old scripts from c o n t r o l l e r m a x and only publish my
   scripts in the c o n s o l e t u n e r Titan One library.
   
   (c) 2014 OFC-Giorgio - All right reserved
 
   Background:

   For years I (and many others) have been playing call of duty with the
   wiimote on the wii (world at war, modern warfare reflex, black ops, modern
   warfare 3) and wiiu (black ops2, ghosts). Many years ago I started the
   Over Forty Clan (OFC) with a group of older players that play cod with the
   wiimote on the wii and later on the wiiu.

   Since this year (2014) it seems there will be no more cod (advanced warfare)
   on the wiiu platform, a lot of wiimote cod users are very sad not to be able
   to play the new cod(s) with a wiimote.

   In order to be able to play the new cod I explored the possibilities to
   connect a wiimote to a PC, PS3 or XBOX. I first tried cod world at war with
   a wiimote on a PC by writing a small C# program with Brian Peek's wiimotelib at
   channel9.msdn.com/coding4fun/articles/Managed-Library-for-Nintendos-Wiimote).
   It turned out that the sensitivity and deadzones settings (made by TreyArc,
   the company that made/ported all the wii/wiiu versions of cod) that I was used
   to on the wii/wiiu were not so easy to be programmed from scratch and most
   importantly:the mouse+keyboard players were super fast compared to me with my
   wiimote setup (and my old reflexes).
   
   Later I found out about the titan one and the device
   and reported my findings to all the wiimote users via the
   OFC website (overfortyclan.freeforums.org),
   the nintendo miiverse (miiverse.nintendo.net/) social network and
   the activision cod wiiu black ops II and ghosts forums at
   community.callofduty.com/community/call_of_duty/english/black_ops_2/forums/wii-u
   and
   community.callofduty.com/community/call_of_duty/english/ghosts/forums/ghosts_wii-u .

   Happy wiimoting!
   OFC-Giorgio
   

   From the wiiu manual:
   * Z Button - ADS
   * C Button - Crouch/Prone
   * Control Stick - Move
   * Up on the +Control Pad - Jump
   * Right on the +Control Pad - Switch Weapon
   * Left on the +Control Pad - Inventory
   * Down on the +Control Pad - Melee Attack
   * A Button - Use/Sprint/Lock Camera
   * - Button - Throw Tacticals
   * + Button - Throw Lethals
   * 1 Button - Objectives/Menu
   * 2 Button - Scoreboard
   * B Button (underneath controller) - Fire Weapon
   * Shake Nunchuk - Reload

   Hold Wii-Left and select with Nunchuck stick up, down, left or right (for
   next-killstreak, previous-killstreak, use killstreak, switch to rifle
   grenadelauncher attachment respectively).

   Bravo settings:
   * shake nunchuk / reload is disabled,
   * - is used for reload and
   * + is still used to throw lethals but + while twisting the wiimote is used
     for throwing tacticals
*/


define ADS_SENSITIVITY     = 35; // a lower value than the standard 50 value means more sensitive
define NON_ADS_SENSITIVITY = 44; // a lower value than the standard 50 value means more sensitive

//define RUMBLE_ENABLED = TRUE; // vibrating enabled
define RUMBLE_ENABLED = FALSE// vibrating disabled

define MOVE_LEFT_RIGHT_3STATES         = TRUE;   // stick is only left/neutral/right (horizontal)
//define MOVE_LEFT_RIGHT_3STATES       = FALSE;  // stick is -100% - 100% (horizontal)
define MOVE_FORWARD_BACKWARD_3STATES   = TRUE;   // stick is only up/neutral/down (vertical)
//define MOVE_FORWARD_BACKWARD_3STATES = FALSE;  // stick is -100% - 100% (vertical)

unmap ALL_REMAPS;
   
remap  WII_MINUS    -> PS3_SQUARE;   // Bravo settings: reload
remap  WII_HOME     -> PS3_PS;       // home menu
remap  WII_PLUS     -> PS3_R1;       // lethal grenade
remap  WII_ONE      -> PS3_START;    // menu/map
remap  WII_TWO      -> PS3_SELECT;   // score
remap  WII_A        -> PS3_CROSS;    // "use" action difference:
                                     // in wii: A:use/sprint   -:reload
                                     // in ps3: square=use/reload and L3=sprint
                                     // for now: assign the wii A button to sprinting
                                     //          and use the wii minus (reload) button also
                                     //          to use/take dropped care packages
remap  WII_B        -> PS3_R2;       // fire
remap  WII_UP       -> PS3_TRIANGLE; // switch weapon
remap  WII_DOWN     -> PS3_L3;       // jump/mantle
remap  WII_RIGHT    -> PS3_L1;       // melee
remap  WII_C        -> PS3_CIRCLE;   // crouch/prone
remap  WII_Z        -> PS3_L2;       // zoom/aiming down the sights (ADS)
remap  WII_NX       -> PS3_LX;       // move
remap  WII_NY       -> PS3_LY;       // move
remap  WII_IRX      -> PS3_RX;       // look
remap  WII_IRY      -> PS3_RY;       // look

unmap PS3_ACCX;
unmap PS3_ACCY;
unmap PS3_ACCZ;

// wiimote+nunchuk only buttons:
// WII_ONE/WII_TWO/WII_ACCX/WII_ACCY/WII_ACCZ/WII_ACCNX/WII_ACCNY/WII_ACCNZ/WII_IRX/WII_IRY

// Common identical (classic) controller (pro) and wiimote+nunchuk buttons:
// WII_HOME/WII_MINUS/WII_PLUS/WII_UP/WII_DOWN/WII_LEFT/WII_RIGHT/WII_A/WII_B

// Overlapping (classic) controller (pro) with wiimote+nunchuk:
// (classic) controller (pro) button WII_LT = nunchuk WII_C
// (classic) controller (pro) button WII_ZL = nunchuk WII_Z
// (classic) controller (pro) button WII_LX = nunchuk WII_NX
// (classic) controller (pro) button WII_LY = nunchuk WII_NY

// (classic) controller (pro) buttons that are not used in wiimote+nunchuk mode:
// WII_RT
// WII_ZR
// WII_RX
// WII_RY
// WII_X
// WII_Y
// used to bind them to PS3 button and force the wii buttons to trigger the PS3 button
// by the setval commands in the script (see (1) & (2)):

// (1)
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
//phantom buttons choosen by macro or shaking nunchuck
remap WII_X  -> PS3_LEFT// left
remap WII_RX -> PS3_RIGHT; // right
remap WII_Y  -> PS3_UP;    // up
remap WII_RY -> PS3_DOWN// down
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.

// (2)
// dummy mapping for lethal grenades
remap  WII_RT -> PS3_R3;       

// (3)
// dummy mapping for ps4 touch
remap  WII_ZR -> PS4_TOUCH;

int LETHAL_GRENADE         = 0;
int TACTICAL_GRENADE       = 0;
int AIMING_DOWN_THE_SIGHTS = 0;

init
{
  if(!RUMBLE_ENABLED)
  {
    block_rumble();
  }
}


main
{
    // Console support for PS3, PS4, XBOX360 and XBOX1
    if(get_console() && get_console() != PIO_PS3)
    {
      // PS4, XBOX360 and XBOX1
      LETHAL_GRENADE         = WII_PLUS;
      TACTICAL_GRENADE       = WII_RT;
      AIMING_DOWN_THE_SIGHTS = WII_Z;
   }
   else
   {  // PS3
      LETHAL_GRENADE         = WII_PLUS;
      TACTICAL_GRENADE       = WII_RT;
      AIMING_DOWN_THE_SIGHTS = WII_Z;
   }
 
   if(get_console() == PIO_PS4)
   {
      swap(WII_TWO, WII_ZR); // SELECT <-> TOUCH CLICK
   }

   // PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)
   set_val(WII_IRX, inv(get_val(WII_IRX)));
   // PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)

   // use different sensitivity for ADS (aiming down the sights) and non ADS
   if (get_val(AIMING_DOWN_THE_SIGHTS))
   {
     //set_led(LED_3, 1); // indicate ADS
     sensitivity(WII_IRX , ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , ADS_SENSITIVITY, 100);
   }
   else
   {
     //set_led(LED_3, 0);
     sensitivity(WII_IRX , NON_ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , NON_ADS_SENSITIVITY, 100);
   }

   deadzone(WII_IRX, WII_IRY, DZ_CIRCLE, 10);

   // PS3 LXY = Nunchuck NXY by Wiimot3
   //sensitivity(WII_NX , NOT_USE, 150);
   //sensitivity(WII_NY , NOT_USE, 150);
   //deadzone(WII_NX, WII_NY, DZ_CIRCLE, 5);
   // PS3 LXY = Nunchuck NXY by Wiimot3



   // make nunchuck stick 3 states only (per direction):
   // - stick is only left/neutral/right (horizontal)
   if (MOVE_LEFT_RIGHT_3STATES)
   {
     if (get_val(WII_NX) < -20)     
     {   
        set_val(PS3_LX, -100); // left
     }
     else
     if (get_val(WII_NX) > 20)     
     {   
        set_val(PS3_LX, 100); // right
     }
     else
     {
        set_val(PS3_LX, 0);  // neutral
     }
   }

   // - stick is only up/neutral/down (vertical)
   if (MOVE_FORWARD_BACKWARD_3STATES)
   {
     if (get_val(WII_NY) < -20)     
     {   
        set_val(PS3_LY, -100); // up
     }
     else
     if (get_val(WII_NY) > 20)
     {   
        set_val(PS3_LY, 100); // down
     }
     else
     {
        set_val(PS3_LY, 0);   // neutral
     }
   }
   //stickize(WII_IRX, WII_IRY, 129);


   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
   if(get_val(WII_LEFT) && get_val(WII_NX) < -90) set_val(WII_X100);  // left
   if(get_val(WII_LEFT) && get_val(WII_NX) >  90) set_val(WII_RX, 100);  // right
   if(get_val(WII_LEFT) && get_val(WII_NY) < -90) set_val(WII_Y100);  // up
   if(get_val(WII_LEFT) && get_val(WII_NY) >  90) set_val(WII_RY, 100);  // down
   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.


   // Bravo settings  + while twisting the wiimote is used for throwing tacticals
   if(get_val(LETHAL_GRENADE) && get_val(WII_ACCX) > 20)
   {
       set_val(LETHAL_GRENADE,     0); // stop/prevent throwing lethal
       set_val(TACTICAL_GRENADE, 100); // throw tactical grenade
   }

   // test for wiimote out of reach of sensorbar
   if(wiir_offscreen())
   {
     set_val(WII_IRX, 0); // prevent camera from spinning
     set_val(WII_IRY, 0); // prevent camera from spinning
     set_led(LED_4, 1);   // light led 4 to indicate sensorbar is out of sight
   }
   else
   {
     set_led(LED_4, 0);
   }


   // Empty battery indicator (led 3 on if battery level less or equal 20%)
   if(get_battery() <= 2)
   {
     set_led(LED_3, 1);
   }
   else
   {
     set_led(LED_3, 0);
   }

} // end of main() function
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: wii sensorbar problem

Postby OFC-Giorgio » Fri Jul 24, 2015 3:38 pm

Led 4 indicates that wiimote is out of reach of the sensorbar. So you need to get closer to the sensorbar or move the sensorbar closer to you. You might also test the sensor on top of the tv and on the bottom.

HTH
User avatar
OFC-Giorgio
Lieutenant
Lieutenant
 
Posts: 344
Joined: Mon Sep 15, 2014 4:26 pm

Re: wii sensorbar problem

Postby teddy18 » Mon Jul 27, 2015 5:44 pm

Thank you for the Tip

I think it is a script Problem
when i play with the Wii oder wii U the wiimote isn´t out of reach of the sensorbar.
this only happens when it use with the Titan one
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: wii sensorbar problem

Postby OFC-Giorgio » Tue Jul 28, 2015 3:26 pm

teddy18 wrote:Thank you for the Tip

I think it is a script Problem
when i play with the Wii oder wii U the wiimote isn´t out of reach of the sensorbar.
this only happens when it use with the Titan one


I used the scrips for many months without problem. You might try to change the sensitivity values:

define ADS_SENSITIVITY = 35; // a lower value than the standard 50 value means more sensitive
define NON_ADS_SENSITIVITY = 44; // a lower value than the standard 50 value means more sensitive
User avatar
OFC-Giorgio
Lieutenant
Lieutenant
 
Posts: 344
Joined: Mon Sep 15, 2014 4:26 pm

Re: wii sensorbar problem

Postby teddy18 » Tue Jul 28, 2015 3:41 pm

Thank you for the help i try to the Ads and non ads

Yesterday i found the Problem in The script
It tooks very long to fix the problem
the problem was // test for wiimote out of reach of sensorbar
the wiimote wasnt out of reach but the pointer stopt
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: wii sensorbar problem

Postby teddy18 » Tue Jul 28, 2015 3:41 pm

Code: Select all
// GPC Online Library
// call_of_duty_wiimote_script_bravo_settings.gpc

// GPC Online Library
// call_of_duty_wiimote_script_bravo_settings.gpc

/*
   OFC-Giorgio - Call of duty wiimote script (bravo settings)

   (c) 2014 OFC-Giorgio - All right reserved

   ONLY PUBLISHED ON consoletuner.com (makers of the Titan One usb dongle)

   NO RIGHTS TO PUBLISH ELSEWHERE WITHOUT WRITTEN CONSENT OF THE AUTHOR

   Changelog:

   20141126-1
              * Added support for PS4, XBOX1 & XBOX360 (so now the script works for
                PS3, PS4, XBOX1 & XBOX360).

   20141105-1
              * Updated copyright notice to prevent illegal copying and
                publishing on other places than consoletuner.com
                (makers of the Titan One usb dongle)
              * Empty battery indicator (led 3 on if battery level less or equal 20%)

   20141021-1
              * Make nunchuck stick 3 states based on value of
                MOVE_LEFT_RIGHT_3STATES and MOVE_FORWARD_BACKWARD_3STATES
                parameters.
              * Changed default ADS_SENSITIVITY to 35 and NON_ADS_SENSITIVITY to 44.

   20141019-1
              * Make nunchuck stick 3 states only (per direction):
                - stick is only up/neutral/down (vertical).
                - stick is only left/neutral/right (horizontal).
              * Removed: Led 3 indicates ADS.

   20141018-1
              * Removed crouch/prone macro (standard wii C button works fine).
              * Use different sensitivity for ADS (aiming down the sights) and
                non ADS (hip fire) via ADS_SENSITIVITY and NON_ADS_SENSITIVITY parameters
              * Led 3 indicates ADS.
              * Led 4 indicates wiimote is out of reach of sensorbar and
                IRX & IRY are set to 0 to prevent spinning around.
              * RUMBLE_ENABLED parameter to enable/disable vibrating
              * Documented all wii keys (including non nunchuk) and keys for dummy mappings.

   20140916-1
              * Initial tagged version.
   
   Based on the scripts of wiimote Fuzzy, Wiimote3, Wiimote and J2Kbr I created
   a script to mimic the "bravo" settings wiimote+nunchuck of the wii(u) cod
   games (ghosts, blackops 2, modern warfare 3, black ops, modern warfare reflex
   and world at war) for the PS3 but this script can easily be altered for the
   PS4, XBOX 360 and XBOX One.

   The first version of my script I posted in the c o n t r o l l e r m a x
   forums (their "publish script to library" function in gtuner suspiciously did
   not work) and the overfortyclan forums.
   
   I removed my scripts from c o n t r o l l e r m a x and only publish them in
   the c o n s o l e t u n e r Titan One library.
 
   In the Titan One forums I posted information about the wii sensorbar that is needed
   for operating the wiimote.
   
   I knew of both the device dongle and the titan one dongle (and the
   dispute between the two).
   
   Initially I choose (and purchased) the device dongle because of their
   claim of a bigger community and better support. However to me the
   device "staff" appeared evasive and suspicious about the api, library,
   a couple of software/website bugs I informed them about, future fixes and
   future updates, as well as arrogant and rude in their communication towards
   me (and others).
   
   After asking the same questions in the Titan One forums of
   c o n s o l e t u n e r, I not only got (more detailed) answers, I also noticed
   there were software updates and even my request to have deadzone settings in
   MaxAIM DI was added to the new version over night.

   For now I assume that the Titan One team is the original developer and has
   the source code of the firmware, gtuner and the plugins. Based on this
   information I purchased a Titan One dongle and my scripts also worked on it.

   Hence I removed my old scripts from c o n t r o l l e r m a x and only publish my
   scripts in the c o n s o l e t u n e r Titan One library.
   
   (c) 2014 OFC-Giorgio - All right reserved
 
   Background:

   For years I (and many others) have been playing call of duty with the
   wiimote on the wii (world at war, modern warfare reflex, black ops, modern
   warfare 3) and wiiu (black ops2, ghosts). Many years ago I started the
   Over Forty Clan (OFC) with a group of older players that play cod with the
   wiimote on the wii and later on the wiiu.

   Since this year (2014) it seems there will be no more cod (advanced warfare)
   on the wiiu platform, a lot of wiimote cod users are very sad not to be able
   to play the new cod(s) with a wiimote.

   In order to be able to play the new cod I explored the possibilities to
   connect a wiimote to a PC, PS3 or XBOX. I first tried cod world at war with
   a wiimote on a PC by writing a small C# program with Brian Peek's wiimotelib at
   channel9.msdn.com/coding4fun/articles/Managed-Library-for-Nintendos-Wiimote).
   It turned out that the sensitivity and deadzones settings (made by TreyArc,
   the company that made/ported all the wii/wiiu versions of cod) that I was used
   to on the wii/wiiu were not so easy to be programmed from scratch and most
   importantly:the mouse+keyboard players were super fast compared to me with my
   wiimote setup (and my old reflexes).
   
   Later I found out about the titan one and the device
   and reported my findings to all the wiimote users via the
   OFC website (overfortyclan.freeforums.org),
   the nintendo miiverse (miiverse.nintendo.net/) social network and
   the activision cod wiiu black ops II and ghosts forums at
   community.callofduty.com/community/call_of_duty/english/black_ops_2/forums/wii-u
   and
   community.callofduty.com/community/call_of_duty/english/ghosts/forums/ghosts_wii-u .

   Happy wiimoting!
   OFC-Giorgio
   

   From the wiiu manual:
   * Z Button - ADS
   * C Button - Crouch/Prone
   * Control Stick - Move
   * Up on the +Control Pad - Jump
   * Right on the +Control Pad - Switch Weapon
   * Left on the +Control Pad - Inventory
   * Down on the +Control Pad - Melee Attack
   * A Button - Use/Sprint/Lock Camera
   * - Button - Throw Tacticals
   * + Button - Throw Lethals
   * 1 Button - Objectives/Menu
   * 2 Button - Scoreboard
   * B Button (underneath controller) - Fire Weapon
   * Shake Nunchuk - Reload

   Hold Wii-Left and select with Nunchuck stick up, down, left or right (for
   next-killstreak, previous-killstreak, use killstreak, switch to rifle
   grenadelauncher attachment respectively).

   Bravo settings:
   * shake nunchuk / reload is disabled,
   * - is used for reload and
   * + is still used to throw lethals but + while twisting the wiimote is used
     for throwing tacticals
*/


define ADS_SENSITIVITY     = 35; // a lower value than the standard 50 value means more sensitive
define NON_ADS_SENSITIVITY = 44; // a lower value than the standard 50 value means more sensitive

//define RUMBLE_ENABLED = TRUE; // vibrating enabled
define RUMBLE_ENABLED = FALSE// vibrating disabled

define MOVE_LEFT_RIGHT_3STATES         = TRUE;   // stick is only left/neutral/right (horizontal)
//define MOVE_LEFT_RIGHT_3STATES       = FALSE;  // stick is -100% - 100% (horizontal)
define MOVE_FORWARD_BACKWARD_3STATES   = TRUE;   // stick is only up/neutral/down (vertical)
//define MOVE_FORWARD_BACKWARD_3STATES = FALSE;  // stick is -100% - 100% (vertical)

unmap ALL_REMAPS;
   
remap  WII_MINUS    -> PS3_SQUARE;   // Bravo settings: reload
remap  WII_HOME     -> PS3_PS;       // home menu
remap  WII_PLUS     -> PS3_R1;       // lethal grenade
remap  WII_ONE      -> PS3_START;    // menu/map
remap  WII_TWO      -> PS3_SELECT;   // score
remap  WII_A        -> PS3_CROSS;    // "use" action difference:
                                     // in wii: A:use/sprint   -:reload
                                     // in ps3: square=use/reload and L3=sprint
                                     // for now: assign the wii A button to sprinting
                                     //          and use the wii minus (reload) button also
                                     //          to use/take dropped care packages
remap  WII_B        -> PS3_R2;       // fire
remap  WII_UP       -> PS3_TRIANGLE; // switch weapon
remap  WII_DOWN     -> PS3_L3;       // jump/mantle
remap  WII_RIGHT    -> PS3_L1;       // melee
remap  WII_C        -> PS3_CIRCLE;   // crouch/prone
remap  WII_Z        -> PS3_L2;       // zoom/aiming down the sights (ADS)
remap  WII_NX       -> PS3_LX;       // move
remap  WII_NY       -> PS3_LY;       // move
remap  WII_IRX      -> PS3_RX;       // look
remap  WII_IRY      -> PS3_RY;       // look


unmap PS3_ACCX;
unmap PS3_ACCY;
unmap PS3_ACCZ;

// wiimote+nunchuk only buttons:
// WII_ONE/WII_TWO/WII_ACCX/WII_ACCY/WII_ACCZ/WII_ACCNX/WII_ACCNY/WII_ACCNZ/WII_IRX/WII_IRY

// Common identical (classic) controller (pro) and wiimote+nunchuk buttons:
// WII_HOME/WII_MINUS/WII_PLUS/WII_UP/WII_DOWN/WII_LEFT/WII_RIGHT/WII_A/WII_B

// Overlapping (classic) controller (pro) with wiimote+nunchuk:
// (classic) controller (pro) button WII_LT = nunchuk WII_C
// (classic) controller (pro) button WII_ZL = nunchuk WII_Z
// (classic) controller (pro) button WII_LX = nunchuk WII_NX
// (classic) controller (pro) button WII_LY = nunchuk WII_NY

// (classic) controller (pro) buttons that are not used in wiimote+nunchuk mode:
// WII_RT
// WII_ZR
// WII_RX
// WII_RY
// WII_X
// WII_Y
// used to bind them to PS3 button and force the wii buttons to trigger the PS3 button
// by the setval commands in the script (see (1) & (2)):

// (1)
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
//phantom buttons choosen by macro or shaking nunchuck
remap WII_X  -> PS3_LEFT// left
remap WII_RX -> PS3_RIGHT; // right
remap WII_Y  -> PS3_UP;    // up
remap WII_RY -> PS3_DOWN// down
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.

// (2)
// dummy mapping for lethal grenades
remap WII_ACCNX -> PS3_R3;       

// (3)
// dummy mapping for ps4 touch
remap  WII_ZR -> PS4_TOUCH;

int LETHAL_GRENADE         = 0;
int TACTICAL_GRENADE       = 0;
int AIMING_DOWN_THE_SIGHTS = 0;

init
{
  if(!RUMBLE_ENABLED)
  {
    block_rumble();
  }
}


main
{
    if(get_val(WII_PLUS)) set_val(WII_PLUS, 100);
    sensitivity(WII_ACCNX, NOT_USE, 5);
    if(get_val(WII_RIGHT)) set_val(WII_RIGHT, 100);
   
   // Console support for PS3, PS4, XBOX360 and XBOX1
    if(get_console() && get_console() != PIO_PS3)
    {
      // PS4, XBOX360 and XBOX1
      LETHAL_GRENADE         = WII_PLUS;
      TACTICAL_GRENADE       = WII_RT;
      AIMING_DOWN_THE_SIGHTS = WII_Z;
   }
   else
   {  // PS3
      LETHAL_GRENADE         = WII_PLUS;
      TACTICAL_GRENADE       = WII_RT;
      AIMING_DOWN_THE_SIGHTS = WII_Z;
   }
 
   if(get_console() == PIO_PS4)
   {
      swap(WII_TWO, WII_ZR); // SELECT <-> TOUCH CLICK
   }

   // PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)
   set_val(WII_IRX, inv(get_val(WII_IRX)));
   // PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)

   // use different sensitivity for ADS (aiming down the sights) and non ADS
   if (get_val(AIMING_DOWN_THE_SIGHTS))
   {
     //set_led(LED_3, 1); // indicate ADS
     sensitivity(WII_IRX , ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , ADS_SENSITIVITY, 100);
   }
   else
   {
     //set_led(LED_3, 0);
     sensitivity(WII_IRX , NON_ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , NON_ADS_SENSITIVITY, 100);
   }

   deadzone(WII_IRX, WII_IRY, DZ_CIRCLE, 25);

   // PS3 LXY = Nunchuck NXY by Wiimot3
   //sensitivity(WII_NX , NOT_USE, 150);
   //sensitivity(WII_NY , NOT_USE, 150);
   //deadzone(WII_NX, WII_NY, DZ_CIRCLE, 5);
   // PS3 LXY = Nunchuck NXY by Wiimot3



   // make nunchuck stick 3 states only (per direction):
   // - stick is only left/neutral/right (horizontal)
   if (MOVE_LEFT_RIGHT_3STATES)
   {
     if (get_val(WII_NX) < -20)     
     {   
        set_val(PS3_LX, -100); // left
     }
     else
     if (get_val(WII_NX) > 20)     
     {   
        set_val(PS3_LX, 100); // right
     }
     else
     {
        set_val(PS3_LX, 0);  // neutral
     }
   }

   // - stick is only up/neutral/down (vertical)
   if (MOVE_FORWARD_BACKWARD_3STATES)
   {
     if (get_val(WII_NY) < -20)     
     {   
        set_val(PS3_LY, -100); // up
     }
     else
     if (get_val(WII_NY) > 20)
     {   
        set_val(PS3_LY, 100); // down
     }
     else
     {
        set_val(PS3_LY, 0);   // neutral
     }
   }
   //stickize(WII_IRX, WII_IRY, 129);


   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
   if(get_val(WII_LEFT) && get_val(WII_NX) < -90) set_val(WII_X100);  // left
   if(get_val(WII_LEFT) && get_val(WII_NX) >  90) set_val(WII_RX, 100);  // right
   if(get_val(WII_LEFT) && get_val(WII_NY) < -90) set_val(WII_Y100);  // up
   if(get_val(WII_LEFT) && get_val(WII_NY) >  90) set_val(WII_RY, 100);  // down
   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.


   // Bravo settings  + while twisting the wiimote is used for throwing tacticals
   if(get_val(LETHAL_GRENADE) && get_val(WII_ACCX) > 20)
   {
       set_val(LETHAL_GRENADE,     0); // stop/prevent throwing lethal
       set_val(TACTICAL_GRENADE, 100); // throw tactical grenade
   }

 


   // Empty battery indicator (led 3 on if battery level less or equal 20%)
   if(get_battery() <= 2)
   {
     set_led(LED_3, 1);
   }
   else
   {
     set_led(LED_3, 0);
   }

} // end of main() function
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: wii sensorbar problem

Postby OFC-Giorgio » Mon Aug 03, 2015 10:07 am

That part is for letting led light number 4 indicate the wiimote is out of reach of the sensorbar. Normally in games like call of duty the camera will spin around so to prevent that the extra "set_val(WII_IR" statements disable the signal to the game console:

// test for wiimote out of reach of sensorbar
if(wiir_offscreen())
{
set_val(WII_IRX, 0); // prevent camera from spinning
set_val(WII_IRY, 0); // prevent camera from spinning
set_led(LED_4, 1); // light led 4 to indicate sensorbar is out of sight
}
else
{
set_led(LED_4, 0);
}
User avatar
OFC-Giorgio
Lieutenant
Lieutenant
 
Posts: 344
Joined: Mon Sep 15, 2014 4:26 pm


Return to Wiimote, Nunchuk and Sensorbar

Who is online

Users browsing this forum: No registered users and 25 guests

cron