SOLVED: If mouse graphic is [n] condition

Started by Slasher, Thu 29/08/2013 10:50:28

Previous topic - Next topic

Slasher

Hi,

please excuse my memory loss at this present time but I could do with a reminder.

Interact means Mode 2

scenario:

Player clicks (Interacts) on Object A. If you have seen Object B then the mouse changes Interact graphic to 2228 (image of oblueclam), if you have not seen Object B then it stays as default (812).

So far so good and the Interact cursor does change graphic.

Now, if you click (Interact) with Object B with default Interact Graphic (812) you say this or if you click (Interact) with Object B with Interact Graphic (2228) further events run and the Interact Graphic then returns to default (812)

Object A= oblueclam
Object B= ocrab

So, I need a condition for 'if the mouse mode (Interact) graphic is [n]' do this else do that.

Hope this explains the scenario ok.

cheers



xil

#1
I believe this entry in the manual is what you want:

QuoteGetModeGraphic

static int Mouse.GetModeGraphic(CursorMode)
Returns the sprite slot number of the specified mouse cursor mode.
This could be useful if you want to change it manually with ChangeModeGraphic but be able to remember what it was before.

Example:

Display("The current mouse cursor sprite is %d.", mouse.GetModeGraphic(mouse.Mode));
will display the sprite slot number of the current mouse cursor.
See Also: Mouse.ChangeModeGraphic
Calico Reverie - Independent Game Development, Pixel Art & Other Stuff
Games: Mi - Starlit Grave - IAMJASON - Aractaur - blind to siberia - Wrong Channel - Memoriae - Point Of No Return

Slasher

This lot appears to the job (fingers crossed with further testing  (roll))

Code: ags
function oblueclam_Interact()
{
 cSpaceman.Walk(514,1597, eBlock, eWalkableAreas);
 cSpacemanLoop=2;
 
 if(see_crab==false) // not seeing the crab
 {
 cSpaceman.Say("This blue clam is poisonous.");
}
    else if (see_crab==true) // after seeing the crab a region turns see_crab to true.
    }
    cSpaceman.LockView(43);
    cSpaceman.Animate(2, 4, eOnce, eBlock);
    cSpaceman.UnlockView();
    oblueclam.Visible=false;
    cSpaceman.Say("Got it.");
    got_blue_clam=true;
    mouse.ChangeModeGraphic(2, 2228); // mouse becomes graphic of  a blue clam.
   }
   }



Code: ags
function ocrab_Interact()
{
  if(see_crab==true && crab_dead==false && got_blue_clam==false)
  {
  cSpaceman.Say("There's no way I'm going to wrestle that giant Crab!");
  }
      
      else  if(see_crab==true && crab_dead==false && got_blue_clam==true)
      {
      cSpaceman.Say("That's killed that giant Crab!");
      crab_dead=true;
      mouse.ChangeModeGraphic(2, 812); // mouse returns to normal graphic.
       }
        
         else if (see_crab==true && crab_dead==true)
         {
         Display("The giant Grab is now dead.");
         }
         }
      



Cheers



Khris

#3
Sure, you can use another variable, but isn't this whole way of doing things kind of error prone?
What happens if you leave the room after grabbing the clam?
Is there a reason why the player can't simply pick up the clam, then use it from the inventory?
I'd understand this convoluted way of doing things if the player picked up, say, a chain connected to a fixture in the room, but why go through all that for a small, inanimate object?

Also, what's with your indentation...? You aren't doing it for us, you know:

Code: ags
function ocrab_Interact()
{
  if(see_crab==true && crab_dead==false && got_blue_clam==false)
  {
    cSpaceman.Say("There's no way I'm going to wrestle that giant Crab!");
  }
  else if (see_crab==true && crab_dead==false && got_blue_clam==true)
  {
    cSpaceman.Say("That's killed that giant Crab!");
    crab_dead=true;
    mouse.ChangeModeGraphic(2, 812); // mouse returns to normal graphic.
  }
  else if (see_crab==true && crab_dead==true)
  {
    Display("The giant Grab is now dead.");
  }
}


also, consider this alternate way:
Code: ags
function ocrab_Interact()
{
  if (see_crab)
  {
    if (crab_dead) Display("The giant Grab is now dead.");
    else
    {
      if (got_blue_clam)
      {
        cSpaceman.Say("That's killed that giant Crab!");
        crab_dead = true;
        mouse.ChangeModeGraphic(2, 812); // mouse returns to normal graphic.
      }
      else cSpaceman.Say("There's no way I'm going to wrestle that giant Crab!");
    }
  }
}

Slasher

Hi Khris,

QuoteWhat happens if you leave the room after grabbing the clam?
If you grab the blue clam (oblueclam: one that changes the mouse graphic) you cannot leave the room and you say "I must kill that crab and get those red clams near it." Apart from this crab scenario you can leave and return any time. After getting all 10 red clams you can't enter this scene again. You need all 10 need clams to buy an Air Shell.

QuoteIs there a reason why the player can't simply pick up the clam, then use it from the inventory?
You do not see or have access to your inventory as you PED will not function at the depth of water you are at. All you have is a red clam GUI with 10 slots that are filled each time you grab a red clam (you need 10).

The idea is too get rid of the crab as it sits near some red clams. As you can't use inventory I have gone this way and the results are fine. You are told earlier that blue clams are poisonous.

There is a region that stops you getting too close to the crab until you use the blue clam cursor.

I hope this clears things up.

QuoteAlso, what's with your indentation...? You aren't doing it for us, you know:
I find this way is easier for me to read because of failing eyesight.

Cheers





SMF spam blocked by CleanTalk