I've seen that you guys (AGDI) have add this feature your recent game[s] so I'd like to know how you coded it. If you use the scroll mouse wheel while you have an inventory item selected as your mouse mode, it will go to to the next inventory item automatically...
how did you code this?
mouse-scroll throught inventory objects.
Moderators: adeyke, VampD3, eriqchang, Angelus3K
BUMP!
I'm certain this much is right...
somewhere in:
function on_mouse_click(...
if (mouse.Mode==eModeUseinv) { //then...
if (button==WHEELNORTH) {
//scroll up;
}
if (button==WHEELSOUTH) {
//scroll down through the inventory...
}
}
So, the part I'm can't figure out is obviously the missing parts. I can't find how to script changing the active inventory item. I'd really appreciate help on filling in the blanks.
p.s. I always return favors when people are nice to me.
I'm certain this much is right...
somewhere in:
function on_mouse_click(...
if (mouse.Mode==eModeUseinv) { //then...
if (button==WHEELNORTH) {
//scroll up;
}
if (button==WHEELSOUTH) {
//scroll down through the inventory...
}
}
So, the part I'm can't figure out is obviously the missing parts. I can't find how to script changing the active inventory item. I'd really appreciate help on filling in the blanks.
p.s. I always return favors when people are nice to me.
-
- Defense Minister Status
- Posts: 717
- Joined: Sun Aug 15, 2004 3:55 am
- Location: South Australia
-
- Infamous Sheik of Australia
- Posts: 1722
- Joined: Tue Apr 22, 2003 3:43 pm
- Location: Rockhampton Australia
- Contact:
Code: Select all
else if (mouse.Mode==eModeUseinv) {
// this bit will allow mousewheel to scroll through inventory if the
// mouse.Mode is set to use inventory;
int tempInv=character[EGO].ActiveInventory.ID;
int maxInv=25;
//set maxinv to the maximum inventory items;
if (button==WHEELNORTH) {
if (tempInv==1)
tempInv=maxInv;
else
tempInv--;
while(character[EGO].InventoryQuantity[tempInv]==0) {
//checks to see if the Player has this item
if (tempInv==1)
tempInv=maxInv;
else
tempInv--;
}
character[EGO].ActiveInventory=inventory[tempInv];
}
else if (button==WHEELSOUTH) {
if (tempInv==maxInv)
tempInv=1;
else
tempInv++;
while(character[EGO].InventoryQuantity[tempInv]==0) {
//checks to see if the Player has this item
if (tempInv==maxInv)
tempInv=1;
else
tempInv++;
}
character[EGO].ActiveInventory=inventory[tempInv];
}
} //end the section for scrolling through inventory