Cycle memory slots
2 posts
• Page 1 of 1
Cycle memory slots
This needs to be placed at the very bottom of all the scripts you want to cycle.
- Code: Select all
#include <xb1.gph>
#define SLOTS_IN_USE 4 // How many memory slots are in use
main {
// Hold L2-LT and press Dpad UP/DOWN to cycle slots
if(is_active(XB1_LT)) {
if(event_active(XB1_DOWN)) {
if(mslot_get() == SLOTS_IN_USE) mslot_load(1);
else mslot_load(mslot_get()+1);
}
if(event_active(XB1_UP)) {
if(mslot_get() == 1) mslot_load(SLOTS_IN_USE);
else mslot_load(mslot_get()-1);
}
}
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
- Mad
- Major General
- Posts: 4536
- Joined: Wed May 22, 2019 5:39 am
Re: Cycle memory slots
What about adding this as an included file on every script you would like to cycle? perhaps the approach is easier, would the multiple mains conflict? (asking because of "This needs to be placed at the very bottom of all the scripts you want to cycle.")
This is my approach if it's worth sharing by the way:
This is my approach if it's worth sharing by the way:
- Code: Select all
#define SLOTS_IN_USE 4 /* Set how many memory slots are in use */
main {
/* Hold L2/LT and press D-Pad UP/DOWN to cycle slots */
/* Cycle UP */
if(is_active(7)) {
if(event_active(10)) {
mslot_load((mslot_get() == SLOTS_IN_USE) ? 1 : mslot_get() + 1);
}
/* Cycle DOWN */
if(event_active(9)) {
mslot_load((mslot_get() == 1) ? SLOTS_IN_USE : mslot_get() - 1);
}
}
}
-
Derivates - Sergeant Major
- Posts: 75
- Joined: Sat Jan 19, 2019 6:15 pm
2 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 145 guests