Using inventory and mouse modes 'over hotspot' help wanted.

Started by Slasher, Sun 29/09/2013 06:59:57

Previous topic - Next topic

Slasher

Hi

I need a condition where if you use any other inventory other than igeiger you get the same response on 'mouse over hotspot'. Of course it won't take ! operator. There should be NO response with any other Mode.

This is what I have so far:

Code: ags

function hHotspot14_MouseMove()
{
 if (cSpaceman.ActiveInventory==iGieger){
 mouse.ChangeModeView(eModeUseinv, 107);
 cSpaceman.SayBackground("Radiation is very high there and exposure will kill you!");
}
 else { // Should be if any other inventory is active

 Display("You realise that using that won't help find the mysterious object."); // appears with any Mode.
}
 if(mouse.Mode==eModeInteract||mouse.Mode==eModeWalkto|| mouse.Mode==eModeTalkto|| mouse.Mode==eModeLookat){
 cSpaceman.SayBackground("");
    }
    }


Will you help please?

cheers

EDIT

Re-thought and fiddled and came up with this that works and still leaves Interact/look/talk free from 'over hotspot'.
There are numerous type hotspots.
Code: ags

function hHotspot12_MouseMove()
{

if (cSpaceman.ActiveInventory==iGieger){
   
   mouse.ChangeModeView(eModeUseinv, 105);
   cSpaceman.SayBackground("Radiation is very high there and exposure will kill you.");

}
 if(mouse.Mode==eModeInteract||mouse.Mode==eModeWalkto|| mouse.Mode==eModeTalkto|| mouse.Mode==eModeLookat){

  cSpaceman.SayBackground("");
  }
  }



Code: ags

function hHotspot12_UseInv()
{
if (cSpaceman.ActiveInventory==iGieger){
  
  mouse.ChangeModeView(eModeUseinv, 105);
  
}
  else {

  Display("You realise that using that won't help find the mysterious object.");

}
}







monkey0506

Quote from: slasher on Sun 29/09/2013 06:59:57function hHotspot14_MouseMove()
{
~
if (cSpaceman.ActiveInventory==iGieger){
~mouse.ChangeModeView(eModeUseinv, 107);
~cSpaceman.SayBackground("Radiation is very high there and exposure will kill you!");
}
~else { // Should be if any other inventory is active

~Display("You realise that using that won't help find the mysterious object."); // appears with any Mode.
}
~if(mouse.Mode==eModeInteract||mouse.Mode==eModeWalkto|| mouse.Mode==eModeTalkto|| mouse.Mode==eModeLookat){
~cSpaceman.SayBackground("");
~~~~}
~~~~}

Quote from: Proper Indentation and Consistent Brace Stylefunction hHotspot14_MouseMove() { // YOU SEEM TO PREFER KEEPING OPENING BRACES HERE
~~// THAT is fine, but BE CONSISTENT
~~if (cSpaceman.ActiveInventory==iGieger) {
~~~~mouse.ChangeModeView(eModeUseinv, 107);
~~~~cSpaceman.SayBackground("Radiation is very high there and exposure will kill you!");
~~}
~~else { // Should be if any other inventory is active
~~~~Display("You realise that using that won't help find the mysterious object."); // appears with any Mode.
~~}
~~if(mouse.Mode==eModeInteract||mouse.Mode==eModeWalkto|| mouse.Mode==eModeTalkto|| mouse.Mode==eModeLookat) {
~~~~cSpaceman.SayBackground("");
~~}
}

Code: ags
function hHotspot14_MouseMove() { // YOU SEEM TO PREFER KEEPING OPENING BRACES HERE
  // THAT is fine, but BE CONSISTENT
  if (cSpaceman.ActiveInventory==iGieger) {
    mouse.ChangeModeView(eModeUseinv, 107);
    cSpaceman.SayBackground("Radiation is very high there and exposure will kill you!");
  }
  else { // Should be if any other inventory is active
    Display("You realise that using that won't help find the mysterious object."); // appears with any Mode.
  }
  if(mouse.Mode==eModeInteract||mouse.Mode==eModeWalkto|| mouse.Mode==eModeTalkto|| mouse.Mode==eModeLookat) {
    cSpaceman.SayBackground("");
  }
}

You said that "it won't take ! operator" and that "there should be NO response" with any other mouse cursor than the iGieger inventory cursor.

I'm not sure why you need the ! (logical NOT) operator for this. You're checking that the player's active inventory is the right item, but you still aren't checking what the cursor mode actually is. Checking that the player has an active inventory isn't the same as the cursor mode being eModeUseinv.

As to there being no response for other cursors or inventory items, you realize that you've programmed the "Display" statement under the else clause, yeah?

Slasher

Hi Monkey,

yeah, spotted a few reasons why my code would not work the way it was. But my new code does what I want so I am a bit relieved.

Quoteyou realize that you've programmed the "Display" statement under the else clause, yeah?
I do now.

I will take into account what you have said.

Cheers ;)



SMF spam blocked by CleanTalk