My Script not working on XIM APEX

Forum to discuss the scripts, configs and connection of XIM with the Titan devices.

Moderator: antithesis

My Script not working on XIM APEX

Postby Raczib » Fri Sep 14, 2018 8:37 am

I did a script for R6 Siege about leaning with one button left/right and it works fine (help me improve it xD) but when i connect it to XIM APEX using M&K it doesnt work, outputs shows on Device Monitor but nothing happens ingame.

Code: Select all
#pragma METAINFO("LEANTOGGLE", 1, 8, "User")
#define LEAN_OFF     0
#define LEAN_LEFT     1
#define LEAN_RIGHT     2
uint8 lean = LEAN_OFF;
main {
 
if(is_active(BUTTON_8)) {
    if(get_actual(BUTTON_9)) {lean = LEAN_LEFT;}   
    if(get_actual(BUTTON_6)) {lean = LEAN_RIGHT;}
        if (get_actual(BUTTON_12)){
            if (lean == LEAN_LEFT) {
                set_val(BUTTON_6, 100.0);
                lean = LEAN_RIGHT;
            }
            else if (lean == LEAN_RIGHT) {
                set_val(BUTTON_9, 100.0);
                lean = LEAN_LEFT;
            }
            else
              lean = LEAN_OFF;
        }
 
    }
}


And this code works just fine, what is the difference:

Code: Select all
#pragma METAINFO("TEST", 1, 8, "User")
#include <xb1.gph>
 
main {
 
    if((get_val(XB1_LX) < -99.0) && get_val(XB1_LT) && time_active(XB1_LT) > 300) { set_val(BUTTON_9, 100.0);}   
    if((get_val(XB1_LX) > 99.0) && get_val(XB1_LT) && time_active(XB1_LT) > 300) { set_val(BUTTON_6, 100.0);}
}]


Pd. Also if you can help me with my code, because it works fine when im standing still but whenever im moving while using the toggle button it just goes crazy on the Device Monitor and not working properly in-game.
User avatar
Raczib
Private First Class
Private First Class
 
Posts: 3
Joined: Fri Sep 14, 2018 8:32 am

Re: My Script not working on XIM APEX

Postby J2Kbr » Fri Sep 14, 2018 9:18 am

Welcome. :)

Please give us a brief explanation on how you want the script to work. For example, while pressing L2, dpal left lean to left. Thanks.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: My Script not working on XIM APEX

Postby Raczib » Fri Sep 14, 2018 9:50 am

Ok so lets say im manually leaning right or left with RS or LS while holding LT (ADS), what i had in mind was to make the script know where i left the leaning and just by pressing DPAD LEFT it goes either right or left depending where i left the leaning.

So basically one button to lean right/left depending where i left leaning manually.

Using: Xbox One X, XIM APEX, Titan Two, M&K
Game: R6 Siege
User avatar
Raczib
Private First Class
Private First Class
 
Posts: 3
Joined: Fri Sep 14, 2018 8:32 am

Re: My Script not working on XIM APEX

Postby J2Kbr » Mon Sep 17, 2018 1:58 pm

Sorry for not reply you yet last Friday, please check if the changes made below works as you expect.
Code: Select all
#pragma METAINFO("LEANTOGGLE", 1, 8, "User")
 
#define LEAN_OFF        0
#define LEAN_LEFT       1
#define LEAN_RIGHT      2
 
uint8 lean = LEAN_OFF;
 
main {
    if(is_active(BUTTON_8)) {
        if(get_actual(BUTTON_9)) lean = LEAN_LEFT;
 
        if(get_actual(BUTTON_6)) lean = LEAN_RIGHT;
 
        if(get_actual(BUTTON_12)) {
            if(lean == LEAN_LEFT) {
                set_val(BUTTON_6, 100.0);
                if(event_active(BUTTON_12)) lean = LEAN_RIGHT;
            } else if(lean == LEAN_RIGHT) {
                set_val(BUTTON_9, 100.0);
                if(event_active(BUTTON_12)) lean = LEAN_LEFT;
            } else lean = LEAN_OFF;
        }
 
        set_val(BUTTON_12, 0.0);
    }
}
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: My Script not working on XIM APEX

Postby Raczib » Mon Sep 17, 2018 10:58 pm

Now it works! Thank You! Sometimes the lean goes to the same side but its fine, will try to improve it more.
User avatar
Raczib
Private First Class
Private First Class
 
Posts: 3
Joined: Fri Sep 14, 2018 8:32 am


Return to XIM Apex, XIM4, XIM Edge with Titan devices

Who is online

Users browsing this forum: No registered users and 49 guests