Little problem with custom inventory

Started by Mehrdad, Sat 07/05/2011 07:59:38

Previous topic - Next topic

Mehrdad

Hello

I made custom inventory.i have a problem.....

Code: ags
//in  rep_exe
if ((GUI.GetAtScreenXY(mouse.x,mouse.y)==gGui1)&&( player.ActiveInventory == null)) {
mouse.Mode= eModeInteract;
mouse.UseModeGraphic(6);  //pointer
mouse.Mode = eModeUseinv;

}else if((GUI.GetAtScreenXY(mouse.x,mouse.y) == gGui1)&&( player.ActiveInventory != null)){
 
mouse.Mode= eModeUseinv;
mouse.UseModeGraphic(6);//pointer

}


In here ,i can pickup a item but i can not pick another item.seems item 1  lock to mouse.I can not return to normal mode for pick up another item.
sorry for bad english and sorry for very beginner question.

Mehrdad


My official site: http://www.pershaland.com/

Creator

Try changing

Code: ags
else if((GUI.GetAtScreenXY(mouse.x,mouse.y) == gGui1)&&( player.ActiveInventory != null)){
 
mouse.Mode= eModeUseinv;
mouse.UseModeGraphic(6);//pointer

}


to

Code: ags

else if((GUI.GetAtScreenXY(mouse.x,mouse.y) == gGui1)&&( player.ActiveInventory != null)){
 
mouse.Mode= eModeInteract;
mouse.UseModeGraphic(6);//pointer

}

Mehrdad

Thanks.but i want change mouse to item current inventory after click...your code will changes to interact mode. :-[
My official site: http://www.pershaland.com/

Khris

I don't think that changing the mouse mode 40 times per second constantly is a good way to deal with things anyway.

What is the behavior you want to implement?
Interacting with an inventory item is supposed to select it as active item, right?
Do you use the other cursor modes in your game but want to suppress them above the inventory gui?

Mehrdad

#4
Khris..I want pick a item from inventory at gGui1 and change cursor to current item into the inventory and game .ok? and i want pick another items.
in my code, i can't pick up again.(AFAIK item1 dont  leave cursor)
suppress anything and repeat again.(I hope is will be clear.) 
My official site: http://www.pershaland.com/

Creator

#5
Quote from: Khris on Sat 07/05/2011 14:48:21
What is the behavior you want to implement?

I think that he wants  to pick up an item the first time in his inventory then, without changing the cursor (UseInv mode), be able to select a different item from his inventory.
If so, I think it's impossible without changing to interact mode, correct?

Mehrdad

#6
QuoteIf so, I think it's impossible without changing to interact mode, correct?

I dont know...i think is correct.
Anyway it's my problem:
A)I want change mouse on inventory (in gGui1)to interact mode.
B)THEN I want pick up a item .change mouse to item.
C)THEN going to scene and graphic mouse remaind to current item.
D)THEN again going to inventory and change mouse automatic to Interact mode for pick up another item.
like Beneath a steel sky inventory.

In 'Creator' code,after pick up,change mouse automatic to interact mode in scene and i must click right for reach to item. ???

I think it was clear.dosent it?
My official site: http://www.pershaland.com/

Creator

#7
OK. I think I understand now.
Delete the code you have for the mouse and inventory in rep_ex.

Quote from: MEHRDAD on Sat 07/05/2011 17:49:32
I want change mouse on inventory (in gGui1)to interact mode.

When you open the GUI (gGui1.Visible = true;) also add this:
Code: ags

mouse.mode = eModeInteract;


Quote
THEN I want pick up a item .
THEN going to scene and graphic mouse remaind to current item.

When you click an inventory item in eModeInteract, it should automatically change to the inventory item's graphic and the UseInv mouse mode and stay like that when you close gGui1.

Quote
THEN again going to inventory and change mouse automatic to Interact mode for pick up another item.like Beneath a steel sky inventory.

As long as you have to code to change to interact mode whenever you open the GUI, it will always change to interact when you open the GUI.

Quote
In 'Creator' code,after pick up,change mouse automatic to interact mode in scene and i must click right for reach to item.

This is probably because you have your mouse's code in rep_ex.

I hope this solves what you're attempting to do.

Mehrdad

sorry.where do i put     mouse.mode = eModeInteract;   ?
I try that but no change mouse automatically yet.
My official site: http://www.pershaland.com/

Creator

Quote from: MEHRDAD on Sat 07/05/2011 18:36:48
sorry.where do i put     mouse.mode = eModeInteract;   ?

Where ever your code is called for the GUI to open (gGui1.Visible = true;). How does your GUI open? A key press? A button on the screen?

Mehrdad

#10
Quote from: Creator on Sat 07/05/2011 18:38:47
Quote from: MEHRDAD on Sat 07/05/2011 18:36:48
sorry.where do i put     mouse.mode = eModeInteract;   ?

Where ever your code is called for the GUI to open (gGui1.Visible = true;). How does your GUI open? A key press? A button on the screen?

thats over to gIconbar Gui.and use gGui1.ZOrder = 1; for order front .and pull down automatically with gIconbar when mouse is over a top position.
My official site: http://www.pershaland.com/

Creator

#11
Ah, right. I see.

On your GUI (gGui1), create a button.
Make its name "btnInvInteract".
Now double click the button. It will send you to the global script. You will see

Code: ags

function btnInvInteract_OnClick(GUIControl *control, MouseButton button)
{

}


Make it say:

Code: ags

function btnInvInteract_OnClick(GUIControl *control, MouseButton button)
{
  mouse.mode = eModeInteract;
}


The only thing is, you will need to click this button to change the mode to the interact mode. I can't think of a way to do it automatically. I'm sure Khris or Monkey will probably be able to drop a piece of code in shortly.

As long as you followed my previous post everything should now be fine.

Mehrdad

Thanks. Yes i know for make button and change mouse with click.but i want change automatically OVER that. ???

My official site: http://www.pershaland.com/

Snarky

Use the Tween Module to make the inventory appear instead of the built-in z-order GUI pulldown setting. It's demonstrated in the demogame.

This gives you a place where you can put in the mouse.mode = eModeInteract command.

SMF spam blocked by CleanTalk