script command to change memory slots?

GPC1 script programming for Titan One. Code examples, questions, requests.

script command to change memory slots?

Postby Rapture » Sat Feb 04, 2017 10:17 pm

I'm trying to write a script where at the end of the script it changes the Memory slot. How would I do this?

Example: I press start which activates my combo then at the end of the combo I would like it to change memory slot 2 .

I have tried the G8 alternate command to change the memory slot by writing LS+ home button into my script. But for some reason the controller will only change the slot and the script will not. :cry:

any help would be much appreciated :smile0203:
User avatar
Rapture
Sergeant First Class
Sergeant First Class
 
Posts: 19
Joined: Sat Feb 04, 2017 8:57 pm

Re: script command to change memory slots?

Postby xenologer » Sun Feb 05, 2017 6:50 am

User avatar
xenologer
Command Sergeant Major
Command Sergeant Major
 
Posts: 147
Joined: Thu Dec 29, 2016 12:31 am

Re: script command to change memory slots?

Postby J2Kbr » Tue Feb 21, 2017 3:38 pm

complementing xenologer post, what you need to do is use load_slot(x); at the end of the combo, where x is the memory slot number you want load.
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: script command to change memory slots?

Postby Rapture » Sat Mar 11, 2017 10:25 pm

Is there a command that will tell the Titan 1 to change slots Without giving a specific Number? I just want the Titan to Change slots 123456789 then back to 1.
User avatar
Rapture
Sergeant First Class
Sergeant First Class
 
Posts: 19
Joined: Sat Feb 04, 2017 8:57 pm

Re: script command to change memory slots?

Postby PaulaTheKoala » Sun Mar 12, 2017 12:13 am

Use the max function along with the modulus operator for a nice one line solution:

Code: Select all
load_slot(max(1, (get_slot() + 1) % 9));


EDIT:

I just checked and I guess there isn't a max function.
You'd have to do something like this:

Code: Select all
if (get_slot() > 8)
{
    load_slot(1);
}
else
{
    load_slot(get_slot() + 1);
}


(Not a one line solution, unfortunately GPC doesn't support the ternary operator)
User avatar
PaulaTheKoala
Command Sergeant Major
Command Sergeant Major
 
Posts: 131
Joined: Wed Aug 26, 2015 3:45 am

Re: script command to change memory slots?

Postby Rapture » Mon Mar 13, 2017 11:07 pm

PaulaTheKoala wrote:Use the max function along with the modulus operator for a nice one line solution:

Code: Select all
load_slot(max(1, (get_slot() + 1) % 9));


EDIT:

I just checked and I guess there isn't a max function.
You'd have to do something like this:

Code: Select all
if (get_slot() > 8)
{
    load_slot(1);
}
else
{
    load_slot(get_slot() + 1);
}


(Not a one line solution, unfortunately GPC doesn't support the ternary operator)

IT WORKED!!! :smile0208: YOU ARE THE BEST EVER THANKS FOR THE HELP :smile0202: :smile0202: :smile0202:
User avatar
Rapture
Sergeant First Class
Sergeant First Class
 
Posts: 19
Joined: Sat Feb 04, 2017 8:57 pm

Re: script command to change memory slots?

Postby xenologer » Tue Mar 14, 2017 1:24 pm

PaulaTheKoala wrote:Use the max function along with the modulus operator for a nice one line solution:

Code: Select all
load_slot(max(1, (get_slot() + 1) % 9));


EDIT:

I just checked and I guess there isn't a max function.


Hey J2Kbr
it would really be Helpful if there Was a function to Query the Titanone for the current number of Slots downloaded.
Or if performing load_slot() on an Empty slot could have an Alternative default to slot1 instead of Null Slot. -if it defaulted to a location I had control of, at least I could program a way to handle it nicely, or even use that to runtime determine the number of slots...

True, I could just hardcode the Number of Slots Used at Compile time, but suppose I want to create a series of modular scripts that work together in a plug-in-play fashion for other's to use? Can't expect them to go and do that ...
User avatar
xenologer
Command Sergeant Major
Command Sergeant Major
 
Posts: 147
Joined: Thu Dec 29, 2016 12:31 am

Re: script command to change memory slots?

Postby J2Kbr » Tue Mar 14, 2017 1:52 pm

Hi xenologer. I have just replied your PM, here is a copy:
--
The Titan Two has this capability and we can include that on the Titan One as well. I will add your request to the Gtuner Pro GitHub and you can expect to have it available for the next software and firmware update. Thanks for you suggestion.
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: script command to change memory slots?

Postby DUCKMO3W » Sun Mar 18, 2018 7:57 am

Is there a way to put that on a toggle or somthing like LT + dpad up somthing like that??
User avatar
DUCKMO3W
Sergeant First Class
Sergeant First Class
 
Posts: 22
Joined: Sat Jan 10, 2015 9:29 pm

Re: script command to change memory slots?

Postby J2Kbr » Mon Mar 19, 2018 10:09 am

DUCKMO3W wrote:Is there a way to put that on a toggle or somthing like LT + dpad up somthing like that??

with GPC scripts this can be achieved with this code:
Code: Select all
main {
    if(get_val(XB1_LT) && event_press(XB1_UP)) {
        load_slot(get_slot()+1);
    }
}
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 74 guests