Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - rollo

Pages: [1] 2
1
Technical forum / Re: Interface menu not opening on right click
« on: June 28, 2014, 08:28:39 PM »
Thanks anarchrist. Will keep in mind.

2
Technical forum / Re: Interface menu not opening on right click
« on: June 27, 2014, 11:03:08 AM »
I think that I figured it out. I assumed that if you added an item it automatically created the code to launch the actions menu. My bad. After more reading, I assigned the item script to the entity in the scene. Many thanks for your help anarchrist.

3
Technical forum / Re: Interface menu not opening on right click
« on: June 24, 2014, 07:47:25 PM »
Hi anarchrist

Here is the game.script I am using. Hope you can make some sense of it. Thanks

Code: [Select]
#include "scripts\base.inc"
#include "scripts\keys.inc"

// store some of the game's attributes in global variables for convenience
Keyboard = Game.Keyboard;
Scene = Game.Scene;


// load the right-click menu
global WinMenu = Game.LoadWindow("interface\menu\menu.window");
WinMenu.Visible = false;

// load the "caption" window
var win = Game.LoadWindow("interface\system\caption.window");
global WinCaption = win.GetControl("caption");


global MenuObject = null;


// load our main actor
hero = Game.LoadEntity("entities\hero\hero.entity");
Game.MainObject = hero;

// run the "game loop" script
Game.AttachScript("scripts\game_loop.script");

// initial items
//Game.TakeItem("book");

// which scene to load?
Game.ChangeScene(Game.StartupScene);



////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  // what did we click?
  var ActObj = Game.ActiveObject;
  if(ActObj!=null)
  {
    // clicking an inventory item
    if(ActObj.Type=="item" && Game.SelectedItem==null)
    {
      Game.SelectedItem = ActObj;
    }
    // using an inventory item on another object
    else if(Game.SelectedItem != null && Game.SelectedItem!=ActObj)
    {
      var Item = Game.SelectedItem;
      if(ActObj.CanHandleEvent(Item.Name)) ActObj.ApplyEvent(Item.Name);
      else if(Item.CanHandleEvent("default-use")) Item.ApplyEvent("default-use");
      else if(ActObj.CanHandleEvent("default-use")) ActObj.ApplyEvent("default-use");
      else actor.Talk("I can't use these things together.");
    }
    // just a simple click
    else ActObj.ApplyEvent("LeftClick");
  }
  // else propagate the LeftClick event to a scene
  else
  {
    Scene.ApplyEvent("LeftClick");
  }
}



////////////////////////////////////////////////////////////////////////////////
on "RightClick"
{
  // if inventory item selected? deselect it
  if (Game.SelectedItem != null){
    Game.SelectedItem = null;
    return;
  }

  var ActObj = Game.ActiveObject;

  // is the righ-click menu visible? hide it
  if(WinMenu.Visible == true) WinMenu.Visible = false;
  else if(ActObj!=null)
  {
    // if the clicked object can handle any of the "verbs", display the right-click menu
    if(ActObj.CanHandleEvent("Take") || ActObj.CanHandleEvent("Talk") || ActObj.CanHandleEvent("LookAt"))
    {
      // store the clicked object in a global variable MenuObject
      MenuObject = Game.ActiveObject;
      var Caption = WinMenu.GetControl("caption");
      Caption.Text = MenuObject.Caption;

      // adjust menu's position
      WinMenu.X = Game.MouseX - WinMenu.Width / 2;
      if(WinMenu.X < 0) WinMenu.X = 0;
      if(WinMenu.X+WinMenu.Width>Game.ScreenWidth) WinMenu.X = Game.ScreenWidth-WinMenu.Width;

      WinMenu.Y = Game.MouseY - WinMenu.Height / 2;
      if(WinMenu.Y<0) WinMenu.Y = 0;
      if(WinMenu.Y+WinMenu.Height>Game.ScreenHeight) WinMenu.Y = Game.ScreenHeight-WinMenu.Height;

      // and show the right-click menu
      WinMenu.Visible = true;

      // stop the actor from whatever he was going to do
      actor.Reset();
    }
    // no verbs supported, no menu is needed; just send the RightClick event to the object
    else ActObj.ApplyEvent("RightClick");
  }
}


////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
  // on Esc or F1 key
  if(Keyboard.KeyCode==VK_ESCAPE || Keyboard.KeyCode==VK_F1)
  {
    // load and display the main menu window
    WinCaption.Visible = false;
    var WinMainMenu = Game.LoadWindow("interface\system\mainmenu.window");
    WinMainMenu.Center();
    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);
  }
}


////////////////////////////////////////////////////////////////////////////////
on "QuitGame"
{
  // on Alt+F4 (window close)
  // load and display the quit confirmation window
  WinCaption.Visible = false;
  var WinQuit = Game.LoadWindow("interface\system\quit.window");
  WinQuit.Center();
  WinQuit.GoSystemExclusive();

  // and if the user selected Yes
  if(WinQuit.xResult)
  {
    // quit the game
    Game.QuitGame();
  }
  // otherwise just unload the quit window from memory
  else Game.UnloadObject(WinQuit);
}

4
Technical forum / Interface menu not opening on right click
« on: June 24, 2014, 03:02:42 PM »
Hi
I am confused as to why when I click on an item, no menu appears with the option to LookAt and talk etc. If I use the bog standard demo wme_demo it opens fine. I guess that I have made a nOOb error and would be grataeful if someone could help with this as it is driving me nuts. Thanks

FYI: The game.script and game_loop.script are in place and point to the correct paths.

Interface menu script

Code: [Select]
#include "scripts\base.inc"

global MenuObject;

////////////////////////////////////////////////////////////////////////////////
on "Take"
{
  this.Close();
  if(MenuObject!=null)
  {
    if(MenuObject.CanHandleEvent("Take")) MenuObject.ApplyEvent("Take");
    else actor.Talk("I can't take this.");
  }
  MenuObject = null;
}


////////////////////////////////////////////////////////////////////////////////
on "LookAt"
{
  this.Close();
  if(MenuObject!=null)
  {
    if(MenuObject.CanHandleEvent("LookAt")) MenuObject.ApplyEvent("LookAt");
    else actor.Talk("I don't know what to say about it.");
  }
  MenuObject = null;
}


////////////////////////////////////////////////////////////////////////////////
on "Talk"
{
  this.Close();
  if(MenuObject!=null)
  {
    if(MenuObject.CanHandleEvent("Talk")) MenuObject.ApplyEvent("Talk");
    else actor.Talk("Can't talk to this.");
  }
  MenuObject = null;
}

Book script in items

Code: [Select]
#include "scripts\base.inc"


////////////////////////////////////////////////////////////////////////////////
on "LookAt"
{
  actor.Talk("Guess I should read through this...");
}

////////////////////////////////////////////////////////////////////////////////
on "Take"
{
  Game.SelectedItem = "book";
}

book script in scenes folder

Code: [Select]
#include "scripts\base.inc"
var ActObj = Game.ActiveObject

////////////////////////////////////////////////////////////////////////////////
on "Take"
{
  // walk to the desk
  //actor.GoTo(782, 645);
  //actor.TurnTo(DI_UPLEFT);

  Game.Interactive = false;
  actor.Talk("OK, I'll take it.");

  // play "take" animation
  //actor.PlayAnim("actors\molly\ul\take1.sprite");

  // hide the book entity and place "book" item into the inventory
  Game.TakeItem("book");
  var EntBook = Scene.GetNode("book");
  EntBook.Active = false;

  // play the second "take" animation
  actor.PlayAnim("actors\molly\ul\take2.sprite");

  Game.Interactive = true;
}


////////////////////////////////////////////////////////////////////////////////
on "LookAt"
{
  // walk to the desk
  actor.GoToObject(this);
  actor.Talk("~"Wintermute Engine: User's manual.~"");
  actor.TurnTo(DI_DOWN);
  actor.Talk("Sounds interesting.");
  actor.TurnTo(DI_UPRIGHT);
}


////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  //Game.Msg("You found the book");
}

5
Technical forum / Animated background question
« on: June 23, 2014, 10:57:46 AM »
Hi
I am using the latest version of WME and for the most part, finding it pretty straight forward. However, I am having trouble getting my head around how to use entity with animated background. Example, I have created a new sprite sewer_ani and in that sprite there are 40 frames made up of tga files. This acts as the background. There are 2 problems I am experiencing.

1) When the animation reaches the last frame, it glitches (jumps) before starting again. I have used the streaming option in properties, but it has made no difference. Is there a correct way to do this?

2) When I create an entity with a caption, when the game is run, I hover over the entity, but there is no caption or is not click able. Do I need to set a static background in addition to the animated one? Tried subframes, but still the same.

I would be grateful for any help so I can move forward with project. Many thanks.

6
Technical forum / Re: Changescene animation
« on: March 28, 2013, 07:08:19 PM »
anarchist. Thanks for reply. So there is no command for a timer so just use a for loop? Will check out that link. Thx

7
Technical forum / Re: Changescene animation
« on: March 27, 2013, 04:47:12 PM »
cheers keybone. will check it out.

8
Technical forum / Changescene animation
« on: March 26, 2013, 12:23:57 PM »
Hi. I have created a scene where the player drops a bomb and is set to explode after so long. My question is 2 part. Are there any examples of timer functions and if so where and secondly, I have created a scene in 3dsmax of an exploding barrel. How do I incorporate this into a new scene. In which I mean in what format. From what I can see there are 2 options. Avi or image sequence. Are they the only options. Thanks

9
Technical forum / Re: actor text assignment
« on: March 25, 2013, 03:27:20 PM »
That did the trick. Thanks very much 2.0

10
Technical forum / Re: actor text assignment
« on: March 24, 2013, 07:38:27 PM »
Just one thing. When i run game, the windows appears in intro scene. Is there a way to only have it appear in a certain scene or do Is there a way to make the window transparent? When I make a new window, it makes a question window. I have created the window in interface\system. Is that correct? Thanks

11
Technical forum / Re: actor text assignment
« on: March 24, 2013, 07:13:19 PM »
Thank you for your help. Will start experimenting with windows. Thanks

12
Technical forum / actor text assignment
« on: March 24, 2013, 05:06:02 PM »
IHello.  am not using an actor but just point & click. With an actor if I click on an object, the respose is in white near the actor. I am using Game.Msg(speak); to respond , but it is printing the message in green and under the inventory bar, which I assume is the correct place. Is there a way to have the message printed in a different font perhaps in some kind window or certainly near the object I am looking at. Thanks

13
Technical forum / Re: where is API?
« on: March 23, 2013, 05:10:04 PM »
There is one more thing. I am not using an actor but just point & click. With an actor if I click on an object, the respose is in white near the actor. I am using Game.Msg(speak); to respond , but it is printing the message in green and under the inventory bar, which I assume is the correct place. Is there a way to have the message printed in a different font perhaps in some kind window or certainly near the object I am looking at. Thanks

14
Technical forum / Re: where is API?
« on: March 23, 2013, 05:02:06 PM »
ooppss. Thanks Mnemonic. Only place I didn't look. :-)

15
Technical forum / where is API?
« on: March 23, 2013, 03:36:29 PM »
Can someone tell me where I will find the API for WME? I have looked in help file F1, I have looked in online book. Basically, I need to know for example, what commands are available to me to use in the engine. Many thanks

Pages: [1] 2

Page created in 0.094 seconds with 19 queries.