Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Problem with SetImage, can't locate log  (Read 4102 times)

0 Members and 1 Guest are viewing this topic.

madtom

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Problem with SetImage, can't locate log
« on: April 20, 2009, 01:33:56 PM »

I've been working with WME for a few days, trying to put together a simple RPG to teach myself how to work the scripting. So far I've been able to solve all of the problems I've run into with WME's awesome debugging help. In this case, though, the engine tells me to check the log for runtime error details but I can't locate the details in any of the logs.

I suspect I may have caused a problem by copying the project I was working on and pasting it under a new name in the projects folder. I thought I had fixed all of the paths so that they pointed to the new location, but I likely missed something.

the relevant code is as follows:

I have a window called GenderButtons.window that contains two buttons, Male and Female. It's supposed to be a character generation sort of screen, where pressing the buttons changes the avatar portrait above.

GenderButtons.script reads:

Code: WME Script
  1. #include "scripts\base.inc"
  2. #include "scripts\keys.inc"
  3.  
  4.  
  5. ////////////////////////////////////////////////////////////////////////////////
  6. on "Male"
  7. {
  8.   //I set up messages to let me know if it was registering the clicks, in the event that SetImage didn't work for some reason
  9.    Game.Msg("Male");
  10.   Portrait.SetImage("sprites\male.png");
  11. }
  12.  
  13.  
  14. ////////////////////////////////////////////////////////////////////////////////
  15. on "Female"
  16. {
  17.  
  18.    Game.Msg("Female");
  19.   Portrait.SetImage("sprites\female.png");
  20. }
  21.  
  22.  
  23. ////////////////////////////////////////////////////////////////////////////////
  24. on "Keypress"
  25. {
  26. //In the event that keys are pressed, focus on the window containing the editor
  27. QuestionDisplay.Focus();
  28.  
  29. }


QuestionDisplay is the window containing Portrait, and both are defined in game.script as follows:

Code: WME Script
  1. #include "scripts\base.inc"
  2. #include "scripts\keys.inc"
  3.  
  4. // store some of the game's attributes in global variables for convenience
  5.  
  6.  
  7.  
  8. StatusWindow = Game.LoadWindow("interface\Status.window");
  9. StatusWindow.Visible = true;
  10.  
  11. GenderButtons = Game.LoadWindow("interface\GenderButtons.window");
  12. GenderButtons.Visible = true;
  13.  
  14. Narrator = Game.LoadWindow("interface\Narrator.window");
  15. Narrator.Visible = false;
  16.  
  17. QuestionDisplay = Game.LoadWindow("interface\questiondisplay.window");
  18. QuestionDisplay.Visible = true;
  19.  
  20. Portrait = QuestionDisplay.GetControl("Portrait");
  21.  


Both windows and the portrait are declared in base.inc:

Code: WME Script
  1. #include "scripts\const.inc"
  2.  
  3. global Scene;
  4. global Keyboard;
  5. global actor;
  6. global QuestionDisplay;
  7. global GenderButtons;
  8. global Portrait;


When I left click the buttons Male and Female, the Game.Msg plays correctly and I get a script runtime error from the system, but then I can't find any logs with entries from that time.

It's also worth noting that I had originally tried to just fudge the "buttons" as region entities in Room.Scene, but I could never get that to work, either. It makes me think that possibly my copy/paste job created a LeftClick problem. Just in case, I'm including that portion of the game.script.

Code: WME Script
  1. on "LeftClick"
  2. {
  3. // what did we click?
  4. var ActObj = Game.ActiveObject;
  5. if(ActObj!=null)
  6. {// just a simple click
  7.  ActObj.ApplyEvent("LeftClick");
  8. }
  9. // else propagate the LeftClick event to a scene
  10. else
  11.   {
  12.     Scene.ApplyEvent("LeftClick");
  13.   }
  14. }
  15.  
  16.  



I have also run the compiler and no errors come up. Any help would be greatly appreciated.
« Last Edit: April 21, 2009, 05:19:50 AM by madtom »
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Problem with SetImage, can't locate log
« Reply #1 on: April 21, 2009, 05:02:43 AM »

I can only try to help with my old code for this:

Portrait.SetImage("scenes\Kolobok\male.png");

You have to specify the scene where to get the image from.

Mnemonic gave me the code to set this up and it worked beautifully. My old post is around here somewhere.
 
« Last Edit: April 21, 2009, 05:10:54 AM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

madtom

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Problem with SetImage, can't locate log
« Reply #2 on: April 21, 2009, 05:11:56 AM »

My portrait sprites are contained in the data\sprites\ folder. Will that not work? Do they have to be in a particular folder?  ???


They're also plain .pngs, which I thought might cause a problem, so I tried creating .sprite files out of them in the sprite editor and then pathing to those, but the program behavior was unchanged.  :-\
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Problem with SetImage, can't locate log
« Reply #3 on: April 21, 2009, 05:15:03 AM »

Here is my post if it helps you.  It doesn't matter where they are but you have to refer to where they are.

http://forum.dead-code.org/index.php?topic=3273.msg20139;topicseen#msg20139

Are they in the data/sprites folder or in the data/system/sprites folder?

There's no problem with plain pngs.

If you have further questions with this, it's best to ask Mnemonic as I moved over to making an adventure game as opposed to an rpg game so I never took this any further.  But it worked delightfully.  :  )
« Last Edit: April 21, 2009, 05:24:58 AM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

madtom

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Problem with SetImage, can't locate log
« Reply #4 on: April 21, 2009, 05:27:28 AM »

Their paths are data\sprites\male.png and data\sprites\female.png.  They show up fine when initially set up with the scene editor and window editor dialogues, I just can't get them to change when the buttons are pressed.
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Problem with SetImage, can't locate log
« Reply #5 on: April 21, 2009, 05:32:52 AM »

If you're using sprites instead of images (f.e. pngs) you have to use different wording:   For example:

"Diving.SetSprite("scenes\House_Arrest2\Diving2.png");"

If you're using a sprite, you can't use code Set.Image.  And conversely, if you're using an image, you can't use code Set.Sprite.

If you are using a sprite, you have to say Something.Set.Sprite.  : )  Something refers to the name of the object that holds the sprite.

It took me a little while to figure this out but it's a very important difference.  :  )

Set.Sprite

not

Set.Image  : )
« Last Edit: April 21, 2009, 05:46:25 AM 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: Problem with SetImage, can't locate log
« Reply #6 on: April 21, 2009, 10:23:11 AM »

You need to get the error log working, otherwise it's just guesswork.
If the "Debug mode" option in ProjectMan is set to Yes, there is a file called wme.log in your project folder.
The same log is sent to the Debug console when you run the game from ProjectMan in windowed mode.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

madtom

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Problem with SetImage, can't locate log
« Reply #7 on: April 21, 2009, 11:33:51 AM »

Thhhhaaaaaaaankk you, Mnemonic.  :D

I didn't understand the connection between Debug Mode and the log files.  ::slug Now I've got a lot more to work with and will see how far I can get on my own before tugging at your pantleg again.  :-*
Logged
 

Page created in 0.093 seconds with 25 queries.