need assistance : Map mode/Map room

Started by Monk, Sun 14/09/2008 20:41:08

Previous topic - Next topic

Monk

Ive played the blackwell legacy demo,great game! One thing keep stuck in my mind,the map system.. It display maps and where to go by clicking some buttons..

Im using verbcoin gui,is there any way to create such map?ive tried,but when I'm disabling the verbcoin module,but i lost control of the mouse,i cant click any hotspots or objects there..

my question is, how dou you disable verb coin while the mouse function still active/functional.. ether left,right,or middle...

Please give me guidance through this problem..

Thank you very much in advance!

Khris

A simple if should solve that:

Code: ags
function on_mouse_click(MouseButton button) {
  
  ...
 
  if (player.Room == MAP_ROOM) {

    if (button == eMouseLeft) {
      // map room left-click code
    }
    else if (button == eMouseRight) {
      // map room right-click code
    }

  }
  else {

    // original contents of on_mouse_click

  }
}

Monk

#2
thanks Khris! finally an answer.. i will try the code asap.. hope it works...

by the way, where should i put the code on? the global,room,or the clicked object?

oh and is the mouse action code ir EnableMode.eMode ?

again, thanks a bunch for the help Khris...

Monk

ah, i got it.. it works! thanks!

now the problem is when the character move to a room using the object/button, it move to the coordinates from where the button located in the map room..

how to make character stay put in the assigned coordinates (not moving unless clicked) when he enters new rooms from the map room..

thanks..

Electroshokker

When you disabled the verbcoin system, using .DisableVerbCoinGUI(true) ALL lines of code in the verbcoin module become disabled.

If you want any response to mouse clicks or what not after that, you'll have to script it yourself. (For which Khris gave a good example)

If you want the character to stop moving on clicks, you'll need to change the global setting "Automatically move the player in walk mode" to false.


Now, here's a thought for you: have you checked out the "act" property? If you use that (set it to 'true') on all your map hotspots, you don't need to disable the verbcoin module. It was designed to specifically allow for interactions with a single mouse click WITHOUT popping up the verbcoin.

I believe I put an example in the template.

Monk

wow.. thats opening my mind! thank you elektro! let me recheck back my scripts and all those hotspot scripts, i really hope this will solve all..

oh, and btw why if we disable/invisible the character in the first room we cant pop the inventory in the next room with player visible?

Monk

#6
aargh! yes! thank you guys! finally my "verbcoin problem" for my map room are solved! Khris & Elektro... i salute you.. thank you for assisting the dumb me.. looking forward to have some advices from you guys...

'cheers!

p.s: i hope elektro wouldnt mind answering my last question for this topic above.. :D

Electroshokker

Quote from: "Monk" on Mon 15/09/2008 20:07:40
oh, and btw why if we disable/invisible the character in the first room we cant pop the inventory in the next room with player visible?

actually, you can. If you want to disable the inventory (and ONLY the inventory), you'll have wait 'till I release v1.7.1 of the module (which I'm already using, just haven't found the time to upload it yet.)

Monk

this is sooo solved... back to making game! huzzah! thanks alot Elektro! looking forward to you uploading the module!

cheers!

Elenmir

Quote from: Electroshokker on Mon 15/09/2008 18:01:18
Now, here's a thought for you: have you checked out the "act" property? If you use that (set it to 'true') on all your map hotspots, you don't need to disable the verbcoin module. It was designed to specifically allow for interactions with a single mouse click WITHOUT popping up the verbcoin.

Hello guys.

I have a similar problem with the verbcoin in a room map.
Could you explain a little more the "act" property?
Thank you.




Khris

Sounds like it's a custom property. Edit your hotspot, click the [...] button in the Properties field, then set "act" to "true".

Elenmir

#11
Thank you for your help.
In the custom properties there isn't a property called "act". I have tryed to create it but it ins't work.
My solution for this is use this function in all of the maps hotspots: 

Code: ags

function hNameOfHotsport_MouseMove()
{
 cNameOfCharacter.ChangeRoom(6, 382, 790, eDirectionLeft); 
}


And use the code suggested by you (very helpful) in the global script filling with:

Code: ags

function on_mouse_click(MouseButton button) {
   
  if (player.Room == 5) {
        
    if (button == eMouseLeft) {
      // map room left-click code
      gVerbCoin.Transparency=100; 
    }
    else if (button == eMouseRight) {
      // map room right-click code
      gInventory.Visible = false;      
    }

  }
  else {

    // original contents of on_mouse_click
    // all clicks handled by VerbCoin script
  }
}


It's very, very simple but it's functional. But there is a litte problem with this. There isn't time to see the information of the action bar and the character still walking around the map every time I click in anywhere.
So I was trying to modify the original code of the verbcoin to activate a modemap (reading the script of the verbcoin, this mode it seems to exist) but I'm completly begginer at programming.

Excuse for my english, I don't usually use it.

Khris

#12
Try this:

1. edit the schema via the properties dialog of any hotspot, then add a new property:
Name: act
Type: boolean
Default Value: 0

2. open the VerbCoin main script and find
a) function on_mouse_click(...)
and a bit below
b) else if (interface.Visible)

remove everything in between those two lines, and replace it with

Code: ags
{
  if (interface == null || !enabled)
  {
    // don't do anything if GUI isn't set or is disabled
  }
  else if (button == eMouseLeft)
  {
    int mx = mouse.x;
    int my = mouse.y;
    int lt = GetLocationType(mx, my);
    if (lt != eLocationNothing)
    {
      bool act = false;
      if (lt == eLocationHotspot) {
        Hotspot* h = Hotspot.GetAtScreenXY(mx, my);
        if (h.GetProperty("act")) act = true;
      }
      if (lt == eLocationObject) {
        Object* o = Object.GetAtScreenXY(mx, my);
        if (o.GetProperty("act")) act = true;
      }
      
      if (player.ActiveInventory != null)
      {
        Room.ProcessClick(mx, my, eModeUseinv);
      }
      else if (act)
      {
        interface.Visible = false;
        Room.ProcessClick(mx, my, eModeInteract);
      }


Now set your map hotspots' "act" to "true" and use their "Interact" event to handle the click.

Elenmir

Thanks a lot.

This code works perfectly.

You are the best ;-D



Khris

You're welcome ;-D

Please report any issues you encounter, and if this works as expected, maybe we can add it back into the VerbCoin template permanently.

Elenmir

Ok, I will be testing it and write down if something works improperly.

Thanks again  :smiley:

SMF spam blocked by CleanTalk