Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Can't use object  (Read 6096 times)

0 Members and 1 Guest are viewing this topic.

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Can't use object
« on: December 04, 2008, 06:06:48 AM »

I have an unusual situation.   I have a door key that the actor (first person actor) gets via code in a script on a window button in a dialogue in that window script.

When I gave the actor this key before in script in the scene everything worked fine, the actor could use it on the door. Now getting it via code on a button creates mischief!!

Now the door says I can't use this key on the door.  I'm just really puzzled.  Nothing changed except how the actor gets the key.  ? I don't get a script error in WME log, I just can't use the nice key that appears in inventory.  I get a message in the game that says it can't be used on this object--the door.

This is the script on the door where the key is supposed to be used:

#include "scripts\base.inc"

global DoorUnlocked;

on "LeftClick"
{
Game.Interactive = false; 
  if (!DoorUnlocked)
  {
    Game.Msg("The door is locked and you don't have the right key.");
   Game.Interactive = true;
  }
  }

on "key"
{
  Game.Interactive = false; 
  DoorUnlocked = true; 
  Game.Msg("You unlock the door with your key.");
  Game.DeleteItem("key");
 Game.ChangeScene("scenes\Tunnels\Tunnels.scene");   
  Game.Interactive = true;
}

This is the script on the window in the scene where the actor gets the key--the stuff on Goodbye is just to close out the window--I had trouble with that.  All my dialogues and images stayed on the screen.  I'm using a special window to show dialogue.  I like it and would like to keep it.  The Buttop stuff is just the buttons that are pressed.

#include "scripts\base.inc"
 on "Buttop1"
{
var a = this.GetControl("Buttop2");
a.Text = "Ready for action. Here take this key.";
var key = Scene.GetNode("key");
actor.TakeItem("key");
}

 on "Buttop3"
{
var b = this.GetControl("Buttop4");
b.Text = "Princess Vasilisa's Book of Weather Spells is missing. That could mean mischief in the wrong hands. Let me hop in your back pack and let's go.";
actor.TakeItem("kolo");
}

on "Goodbye"
{   
var d = this.GetControl("Buttop1");
d.ParentNotify = false;
d.Text = "";
var e = this.GetControl("Buttop2");
e.ParentNotify = false;
e.Text = "";
var f = this.GetControl("Buttop3");
f.ParentNotify = false;
f.Text = "";
var g = this.GetControl("Buttop4");
g.ParentNotify = false;
g.Text = "";
var h = this.GetControl("Face");
h.SetImage(null);
h.ParentNotify = false;
var i = this.GetControl("Goodbye");
i.Text = "";
i.ParentNotify = false;
var j = this.GetControl("Textbox");
j.SetImage(null);
j.ParentNotify = false;
}

This is my Items/items script:

ITEM
{
      CURSOR_COMBINED = TRUE
      CAPTION = "Agent Kolobok"
      NAME = "kolo"
      SPRITE = "items\kolo.png"
      CURSOR = "items\kolo.png"
      CURSOR_HOVER = "items\kolo.png"
      SCRIPT = "items\kolo.script"
}

ITEM
{
      CURSOR_COMBINED = TRUE
      CAPTION = "Key"
      NAME = "key"
      SPRITE = "items\key.png"
      CURSOR = "items\key.png"
      CURSOR_HOVER = "items\key.png"
      SCRIPT = "items\key.script"
}

Sigh--it's a nice scene--but I can't get it to work now since I added the dialogue window.  :  {  And I really like the dialogue window. 





« Last Edit: December 04, 2008, 06:47:55 AM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Can't use object
« Reply #1 on: December 04, 2008, 06:51:46 AM »

I'm not willing to give up the dialogue window.  It works perfectly for me.  I have to find a walkaround or what's wrong.  :  )  Can you include script on a window that gives items that can be used in a specific scene if you press a button in that window?  And how do you correctly do that? I know the item goes into inventory.  It's there and I can right click on it and move it to the abysmal door but the abysmal door doesn't recognize it as an item that can be used on said lousy door.  :  )  Or am I missing something?  :  )
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Can't use object
« Reply #2 on: December 04, 2008, 08:47:03 AM »

It looks like it should work. If you are getting the generic "Can't use X on Y", it would mean the script isn't attached to the door at all. What if you left click the door, are you getting the "The door is locked and you don't have the right key." message?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Can't use object
« Reply #3 on: December 04, 2008, 03:56:11 PM »

Yes, I get that message.  But I think it's before I load the window with the dialogue.

I'm thinking the window just doesn't close and I'm trying to use the key on the window that has a black background that shows up when the window is loaded and not the door.

That's what all that parentnotify false stuff is about on the goodbye button--the goodbye button is to get rid of the stuff in the dialogue box----to get rid of the image and text contents of the window---I remove the window itself in the scriptini file in the next scene----but it never, never, never truly goes away----the images and text I loaded in the dialogue box stay on the screen forever and forever---

ONLY IF I do all that elaborate coding with the text=="" and the parent notify false and the set image to null on the goodbye button do the text and image objects carried in a static and in buttons by the window disappear and my screen is clear.

BUT I'm sure the window is still there.  I'm positive the window is still active.  I've tried every magic snippet of code I can think of or find in the forum to destroy that window.  :  )

It's depressing.  :  )
« Last Edit: December 04, 2008, 04:00:18 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Can't use object
« Reply #4 on: December 04, 2008, 04:45:10 PM »

If you want to close the window, use:

on "goodbye"
{
  this.Close();
}

If you want to destroy the window, use:

on "goodbye"
{
  Game.DeleteWindow(this);
}

I don't think it's related to the original problem, though.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Can't use object
« Reply #5 on: December 04, 2008, 04:56:06 PM »

Thanks, Mnemonic, I'll try it tonight.  Will also unattach and reattach that door script.  Before I add something new, I backup the file in a different directory and tested the scene before with the same code before I added the dialogue window and everything was fine--before the window--that's why I'm puzzled.  :  )
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Can't use object
« Reply #6 on: December 04, 2008, 07:03:54 PM »

I was able to test this ("this.Close()") with a file I have with me and it closes the window fine.  :  )  I no longer need all that parentnotify false etc stuff.

Before I close the window, I can't get at the underlying objects--no clicks register--after I close the window, everything is great!  So I think this is going to work fine.   :D 

Thank you.  :  )  Thanks also to Metamorphium for the great dialogue box that now is perfect or close to perfect!!!   :D
« Last Edit: December 04, 2008, 08:15:34 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Can't use object
« Reply #7 on: December 05, 2008, 12:39:37 AM »

I tested this out with the real file--this works perfectly now--as soon as the window closes--I can use the key on the door.   :D :D :D
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Can't use object
« Reply #8 on: December 05, 2008, 12:12:40 PM »

Ah, now I understand, so your invisible windows has been obstructing the door, so you were actually using the key on the window, not on the door.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Can't use object
« Reply #9 on: December 05, 2008, 03:35:28 PM »

Yep.  :  )  Now everything is in order.  :  )  Thanks for your help.  : )
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  
 

Page created in 0.06 seconds with 20 queries.