Left MB event

For problems with creating games or for reporting bugs of the Tool.
Post Reply
Oxilon
PaC-DK Newby
Posts: 8
Joined: 29 Feb 2008, 11:14

Left MB event

Post: # 70198Post Oxilon
04 Mar 2008, 09:46

Hello Everyone!

I have written a story I want to publish as P&C game and after some testing and evaluation I did choose this tool.

I’m going to use Coin interface, but I having some problems with it.

Does anyone know how to detect ‘Walk to’ event? If I have an Object on a Room and it has some script, ‘Walk to’ does nothing (Why?), so I need to do it manually. If I catch ‘On (click)’ event, I can make my Hero walk to Object. Now both mouse buttons do the same, resulting that Left MB does what I want, but the Right MB does the same and only after that opens the Coin.

How to detect Left MB event?
How to open Coin manually?

Thanks!

Schiman
PaC-DK God
Posts: 1177
Joined: 20 Dec 2006, 21:48
Contact:

Post: # 70199Post Schiman
04 Mar 2008, 11:24

how to detect left MB is also a question which I wanted to ask ;).

but to open coin manually you just have to disable the Auto-Popup of Coinmenu in the project setup and use popupcoin().

from the pac-dk manual:
popupcoin ()
Makes your coin-interface appear. Only necessary if autopopup was disabled for the coinmenu.

Oxilon
PaC-DK Newby
Posts: 8
Joined: 29 Feb 2008, 11:14

Post: # 70200Post Oxilon
04 Mar 2008, 12:24

Thanks for the Coin info, (lazy me) :)

I will put this ‘popupcoin()’ command in Right MB event. But I’m still having the ‘Walk to’ problem.

Schiman
PaC-DK God
Posts: 1177
Joined: 20 Dec 2006, 21:48
Contact:

Post: # 70201Post Schiman
04 Mar 2008, 13:39

Oxilon wrote:But I’m still having the ‘Walk to’ problem.
me2. I tried different things.
Atm my script in every objekt looks like that:

Code: Select all

on(mouse)
 {
 instmouse(1)
 setnum(walkx;8)
 setnum(walky;16)
 }

on(look)
 {
 .....
 }

on(use)
 {
 ......
 }
And in my Coin-Menu buttons the script is like that:

Code: Select all

on(click)
 {
 walkto(self;[walkx];[walky])
 command(use)
 }
My Auto-Popup is activated.
Now, if you rightclick an object, first the Coinmenu appears. That's great and I wanted this to be like that. But if i do the normal leftclick and my mouse is over the object the character doesn't do anything.
If I use on(click) in my object to make my character walk to the object then he walks first and after that the coinmenu appears.. It's bad that there is no on(leftclick) command.

Maybe there's another clever solution but I don't know it ;).


EDIT: Hehe :banana: . I've got it ;).
It's as simple as effective.
Just deactivate the auto-popup of the coinmenu and write this into the script of your object:

Code: Select all

on(mouse)
 {
 instmouse(1)
 setnum(walkx;8)
 setnum(walky;16)
 }

(* important *)
on(rightclick)
 {
 popupcoin()
 break()
 }
on(click)
 {
 walkto(self;[walkx];[walky])
 }


on(look)
 {
 ........
 }

on(use)
 {
 ........
 }
This works because it simulates a on(leftclick) command.
If you click right, the coinmenu appears and the rest of the script is not used (break) and the on(click)-event is not executed. if you click left, the on(rightlick) event does not any effect and the on(click)-event is used.

if you click right the coinmenu appears first. And if you click one of the coin-buttons the character walks to the point [walkx]/[walky] and then the on(command)-Event is executed.

Try it out. It works ;).

Oxilon
PaC-DK Newby
Posts: 8
Joined: 29 Feb 2008, 11:14

Post: # 70204Post Oxilon
04 Mar 2008, 14:42

Well done! Thanks!

I was going to propose you use of Variables and Ifs, but that’s simply splendid!

8)

Oxilon
PaC-DK Newby
Posts: 8
Joined: 29 Feb 2008, 11:14

Post: # 70206Post Oxilon
04 Mar 2008, 18:48

This break() didn’t work for me so I did it this way:

Code: Select all

on (mouse)
{
  showinfo (Plate ; false)
  setnum(WalkX; 7)
  setnum(WalkY; 16)
  setbool(RMB; false)
}

on (rightclick)
{
  popupcoin()
  setbool(RMB; true)
}

on (click)
{
  if_bool(RMB; false)
  {
    walkto(self; [WalkX]; [WalkY])
    setbool(RMB; false)
  }
}


japanhonk
PaC-DK God
Posts: 1716
Joined: 05 Feb 2009, 20:36
Location: NRW
Contact:

@Shiman

Post: # 75648Post japanhonk
22 Apr 2010, 11:00

Hab da mal was im Forum gesehen :

Oxilon wrote:This break() didn’t work for me so I did it this way:

Code: Select all

on (mouse)
{
  showinfo (Plate ; false)
  setnum(WalkX; 7)
  setnum(WalkY; 16)
  setbool(RMB; false)
}

on (rightclick)
{
  popupcoin()
  setbool(RMB; true)
}

on (click)
{
  if_bool(RMB; false)
  {
    walkto(self; [WalkX]; [WalkY])
    setbool(RMB; false)
  }
}
Es gibt 10 Arten von Usern :
die, die Binärcode verstehen und die, die es nicht tun....
----------------------------------------------------------
STAR TREK FYNE :
http://www.fynegames.homepage.t-online.de


japanhonk
PaC-DK God
Posts: 1716
Joined: 05 Feb 2009, 20:36
Location: NRW
Contact:

Post: # 75650Post japanhonk
22 Apr 2010, 13:00

Ups - da bin ich wohl noch im verkehrten Thema hängengeblieben - das sollte eigentlich in den Neuesten Thread - da meintest Du, dass da irgendwo noch was Nützliches rumgeistern müsse aber nicht wiesst, wo...


:oops:
Es gibt 10 Arten von Usern :
die, die Binärcode verstehen und die, die es nicht tun....
----------------------------------------------------------
STAR TREK FYNE :
http://www.fynegames.homepage.t-online.de

StarLite
An Adventure Creator
Posts: 446
Joined: 02 Jul 2005, 18:32
Contact:

Post: # 75651Post StarLite
22 Apr 2010, 15:11

Hi Oxilon, I have had the same problem and I use a verb coin as well. What you might need to do is go into the mouse icon in the toolbar and go to the bottom and click do nothing and your walk should work. Hope this helps.
StarLite Moon's Creators Haven

http://starlite-moon.freeforums.net

Post Reply