Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Scripts attached to windows  (Read 2343 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
Scripts attached to windows
« on: December 03, 2008, 07:38:45 AM »

I have a window that overlays every scene.  It has a compass type button that it would be nice it it could be used to move to the previous or next scene--in every scene.  That window is always on top of each scene.  That window has the player avatar and a few other things.

I'd like to let the player click on a part of that compass type button in that window in each individual scene and move to the next correct scene or to the correct prior scene, or another different, unvisited scene. 

I'd have to change the script for that button in each scene.ini file I think to accomplish that.  Can I do it?  :  ) 

Or should I just have the button as part of the graphics of each scene and make region entities over that button that allow the movement to the next or previous scene?

Trying to describe this as best I can.  :  )

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: Scripts attached to windows
« Reply #1 on: December 03, 2008, 01:45:45 PM »

There are numerous ways of doing that. I'd define two shared (global) variables containing currently available prev/next scene. You can set those variables in each scene's scene_init.script:

Code: WME Script
  1. global g_PrevScene = "scenes\something\something.scene";
  2. global g_NextScene = "scenes\something_else\something_else.scene";
  3.  

And the compass button would simply read those globals and change scene.

Code: WME Script
  1. on "CompassPrev"
  2. {
  3.   global g_PrevScene;
  4.   if(g_PrevScene != "") Game.ChangeScene(g_PrevScene);
  5. }
  6.  
  7.  
  8. on "CompassNext"
  9. {
  10.   global g_NextScene;
  11.   if(g_NextScene != "") Game.ChangeScene(g_NextScene);
  12. }
  13.  
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: Scripts attached to windows
« Reply #2 on: December 03, 2008, 03:48:00 PM »

Thanks, I will try it, Mnemonic. It seems like a beautifully simple solution.   :D
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  
 

Page created in 0.069 seconds with 22 queries.