Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Pages: [1] 2  All

Author Topic: Script errors  (Read 8932 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
Script errors
« on: October 21, 2008, 03:45:49 AM »

SOB!!!!!!!  CRY!!!!  CATERWAUL!!!!

Following the warehouse demo:

I have these errors in the WME Log--I thought I followed the instructions--where do I declare the variable "door"?--am not so much worried about Molly errors:

CBSprite::LoadFile failed for file 'actors\molly\dr\stand.sprite'
22:39: CBSprite::LoadFile failed for file 'actors\molly\dr\walk.sprite'
22:39: CBSprite::LoadFile failed for file 'actors\molly\dr\talk.sprite'
22:39: CBSprite::LoadFile failed for file 'actors\molly\dr\turn.sprite'
22:39: CBSprite::LoadFile failed for file 'actors\molly\dr\turn.sprite'
22:39: Compiling script 'scenes\Warehouse\scr\Door.script'...
22:39:   Error@line 5: Variable 'Door' is referenced but not defined
22:39: Compiling script 'scenes\Warehouse\scr\Door.script'...
22:39:   Error@line 6: Variable 'Door' is referenced but not defined
22:39: Compiling script 'scenes\Warehouse\scr\Door.script'...
22:39:   Error@line 5: Variable 'Door' is referenced but not defined
22:39: Compiling script 'scenes\Warehouse\scr\Door.script'...
22:39:   Error@line 6: Variable 'Door' is referenced but not defined

« Last Edit: October 21, 2008, 04:33:42 AM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Script errors
« Reply #1 on: October 21, 2008, 07:52:56 AM »

Hi cat,

please post the contents of your code here.

Unlike in the book, you use variable in Door.script while in the book, there's no variable like this. Maybe you misplaced parts of the script with a bomb.script?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Script errors
« Reply #2 on: October 21, 2008, 02:57:11 PM »

Thank you!!!!   I'll post the script tonight--am not at my regular computer.  I did not put a variable in the door script--just copied the script from the book--was working my way to the bomb script.   

BTW, your book is very amusing and very clear.
« Last Edit: October 21, 2008, 03:43: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: Script errors
« Reply #3 on: October 21, 2008, 11:43:28 PM »

I made a small donation for the online book.  It's helped a lot.  But I don't understand one of the buttons on the "Scripts for the "Door" object"--it's the open folder icon between the new script button and the edit script buttion.  What is that used for?  To attach the script to the object?  If it is, where do I save the script with that?

This is the code on the door--I didn't have a variable:

#include "scripts\base.inc"
on "LeftClick"
{
   Game.Interactive = false;
   actor.GoToObject(Door);
   Door.Active = false;
   actor.Talk("Oh no. The door is welded shut.");
   Game.Interactive = true;
}

should it have been--

#include "scripts\base.inc"
var = Door = new Object("Door.script");
on "LeftClick"
{
Game.Interactive = false;
actor.GoToObject(Door);
Door.Active = false;
actor.Talk("Oh no. The door is welded shut.");
Game.Interactive = true;
}

Or something else???  Thanks for any help.

« Last Edit: October 22, 2008, 12:03:37 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: Script errors
« Reply #4 on: October 22, 2008, 04:40:52 AM »

I've fixed the script errors that referred to Molly--it's only the script on the door that is a problem now but I realize that's a very important problem--help is welcome.  : ) 
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Azrael

  • Regular poster
  • ***
  • Karma: 9
  • Offline Offline
  • Gender: Male
  • Posts: 155
    • View Profile
    • Mad Orange
Re: Script errors
« Reply #5 on: October 22, 2008, 07:07:19 AM »

It should be more something like:

Code: [Select]
var Door = Scene.GetNode("Door");
If "Door" is an entity or a region in the scene.
« Last Edit: October 22, 2008, 07:09:11 AM by Azrael »
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Script errors
« Reply #6 on: October 22, 2008, 08:55:16 AM »

Cat, the code in the book is meant verbatim, so you should put it there in its entirety. In the book is written:

Code: WME Script
  1. on "LeftClick"   
  2. {
  3.   Game.Interactive = false;    // We want our player to make more things at once and we don't want to be interrupted.
  4.  
  5.   actor.GoToObject(this);
  6.  
  7.   this.Active = false// We disable the door so the hotspot is not visible or active anymore.
  8.   actor.Talk("Oh no. The door is welded shut.");        
  9.   Game.Interactive = true; // Allow player to play some more.
  10. }
  11.  

You replaced the keyword this with a word Door which is never declared before. That's why your code is not working. I'll try to explain to you the meaning of life err. the *this* keyword.

Imagine you have a pet dog, let's call him Slowey. Now think of your dog as of some WME entity, for example the image of a dog. We'd call this dog internally "object" because apart from his visual side (image of a dog) it also has some behavior - he walks around, waves his tail and bark. This behavior would have been defined in his script file, which is attached to the dog. So at the end of the day, your dog consists of an image and of a script (or more scripts) defining his behavior.

Now the script is internally part of a dog and if you want inside of this script refer to dog itself, you can conveniently refer to dog using the keyword this.

Now back to your example - and how to correct it (if you really don't want to use my code):

Code: WME Script
  1. #include "scripts\base.inc"
  2. on "LeftClick"
  3. {
  4.    Game.Interactive = false;
  5.    var Door = Scene.GetNode("Door")// we have to tell WME what the Door really is! So instead of using convenient this, we add extra line and define a useless variable. :)
  6.  
  7.    actor.GoToObject(Door);
  8.    Door.Active = false;
  9.    actor.Talk("Oh no. The door is welded shut.");
  10.    Game.Interactive = true;
  11. }
  12.  

Hope this helps!
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Script errors
« Reply #7 on: October 22, 2008, 02:40:50 PM »

Thank you both, Azrael and Metamorphium.  The meaning of life . . err. . code is more clear.  I'll try it tonight.   :)  Will try it both ways.  Object oriented coding is a little bit new to me but am lapping it up.  : ) 

EDIT:  Just one little question -- if I use the code in the book verbatim, I don't have to declare the var door?  The game already knows that "this" is door?  I will use your code because I understand the value of less is more codewise in a big game.  : )  Thanks again.
« Last Edit: October 22, 2008, 03:03:25 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Script errors
« Reply #8 on: October 22, 2008, 03:03:59 PM »

yes. As I tried to explain - the script is part of an object (in this case the object is Door region) so *this* refers to the door region. As you are inside of the door object, this points to itself (door) and says "Hey, it's me! Your trusty door." :)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Script errors
« Reply #9 on: October 22, 2008, 03:21:16 PM »

Now I understand.  :  ) ) )  Thank you for your patience, your book, and your wonderful humor which makes slogging through all the exercises in the book a lot less painful than it otherwise would be!!!!  I hope I can make a nice, commercial game eventually.  : )   I'm one of 2 partners called Zarista Games--my partner is a Russian guy--we make games usually involving Russian history--rpg fighting stuff.  Can't wait to get further with your fine editor.  We just got licensed by Apple but before I try the Apple sdk I want to make a game with Wintermute. 

Thank you for the change in title.  :  ) 
« Last Edit: October 22, 2008, 03:30:06 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Script errors
« Reply #10 on: October 22, 2008, 03:51:26 PM »

Cat, I am not sure now, if you're not mistaking me with the engine creator (Mnemonic)? I know it's hard when our names both start with M. :) I'm just a humble book writer and game developer, the real master mind behind the engine and editors is Mnemonic. :D

Anyway, feel free to ask if you're stuck again. ;)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Script errors
« Reply #11 on: October 22, 2008, 03:58:54 PM »

Thank you both then, M & M.  :  ) 
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: Script errors
« Reply #12 on: October 22, 2008, 05:17:26 PM »

You're welcome :) Thanks for the donation.

We just got licensed by Apple but before I try the Apple sdk I want to make a game with Wintermute. 
You mean the iPhone development license?
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: Script errors
« Reply #13 on: October 22, 2008, 05:40:31 PM »

You're welcome.  Will make another as soon as I learn enough to make a little game.  I like your editor very much.  I have very few problems with it and those are my fault.

Yes, the iphone program.  : )  But before I do much with it I hope to be able to make an adventure game with Wintermute.  Apple will not kill us if we are idle for a little bit--besides I now have to learn Objective C--which is not too different from C but is very heavy in object oriented programming and right now that's my weakness---working on that weakness.  :  ) 

Thank you again for your fine editor.  I hope you will be developing it further but am happy with what it is right now.

If....If I can get to the point where I have a windows executable for a PC game, can I then convert that to a pocket pc game for windows mobile via Microsoft's SDK for Windows Mobile or that is not an option?  Would have to make a cab file.  I have instructions somewhere for making a cab file from an exec--was just wondering if anyone has done that or if there is anything about the structure of the exec file that would prevent my doing that. 
« Last Edit: October 22, 2008, 05:57:23 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: Script errors
« Reply #14 on: October 22, 2008, 07:33:26 PM »

Metamorphium---I just corrected my confusion between you and Mnemonic for the book.  Thanks again. 
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  
Pages: [1] 2  All
 

Page created in 0.057 seconds with 22 queries.