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: First Visit to Scene  (Read 8063 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
First Visit to Scene
« on: February 24, 2009, 07:07:47 PM »

This may sound pretty basic but am having a problem with setting a text value to a certain number on the first visit to a scene.  For some reason, it doesn't work if I put it in the scene.ini script here:

Code: WME Script
  1. if(!StateVacation_House.Visited)
  2. {
  3.   hud.AddItem(5);//a method
  4.   StateVacation_House.Visited = true;
  5.   // this is our first visit in this scene...
  6. }
  7.  


The method works--it's just a questin of where to put it on the first visit to the scene. 

As always, any help is appreciated.
« Last Edit: February 24, 2009, 07:22:45 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Spellbreaker

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Gender: Male
  • Posts: 376
    • View Profile
    • Apeiron Studios
Re: First Visit to Scene
« Reply #1 on: February 24, 2009, 07:55:47 PM »

scene init is correct, and make sure that the variable is global
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: First Visit to Scene
« Reply #2 on: February 24, 2009, 08:12:30 PM »

Thanks, Spellbreaker, but I'm puzzled.  It works if I put the script in the script that changes to the new scene for the first time but if I put it in the scene as above, it doesn't work.  Can't figure it out.

I have to put it in the scene.init as you can go to the scene from a wide variety of places.  So it has to be set to a number before you go there from anywhere. 
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: First Visit to Scene
« Reply #3 on: February 24, 2009, 09:22:47 PM »

Let me just iron my hands---

This code works--  :  )

Code: WME Script
  1. if(!StateVacation_House.Visited)
  2. {StateVacation_House.Visited = true; // this is our first visit in this scene...
  3.  hud.AddItem(5);//a method
  4. }
  5.  
  6. The placement of the StateVacation_House.Visited = true; is important//
  7.  

Thanks!
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

sychron

  • Wanderer zwischen den Welten
  • Global Moderator
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 223
  • There is no spoon. The enemy gate is down!
    • View Profile
Re: First Visit to Scene
« Reply #4 on: February 24, 2009, 09:26:54 PM »

It must have been something else you changed while reordering the code ... the two lines inside the if block do not depend on each other, so they can be in any order. Maybe you misplaced some curly brackets before?
Logged
... delete the inner sleep ...

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: First Visit to Scene
« Reply #5 on: February 25, 2009, 03:38:09 AM »

Thanks for explaining that--there must have been a missing or extra brace.

I'm having trouble though with what am trying to do.  Each scene has a global with a name and that global holds a number and I'd like it to be set to 5 when you first enter each scene--it goes down as things happen and if you go back to the scene the number should be as it was when you left the scene.  I've been trying different things but can't seem to get this to work.  The number just doesn't stay as it should.

Any advice would be wonderful.  I have the patience to keep trying. 
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

maze

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 59
  • Good news
    • View Profile
Re: First Visit to Scene
« Reply #6 on: February 25, 2009, 11:01:30 AM »

This sounds a bit weird.
To solve your number problem, you can try something like this.
Code: WME Script
  1. if (yourglobal == null) yourglobal = 5;
Every global and variable contains a null-state on its birth, so you can use this to set your first state.
« Last Edit: February 25, 2009, 10:00:52 PM by Jyujinkai »
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: First Visit to Scene
« Reply #7 on: February 25, 2009, 03:52:47 PM »

Thanks, maze----I think that will work. Meanwhile have found a walkaround.
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: First Visit to Scene
« Reply #8 on: February 26, 2009, 05:42:17 AM »

I just wanted to say thanks to all you Muties (and Mnemonic of course) for all your help.  I would not have been able to progress as far as I have without it.  I didn't want to waste a new thread to say that but thank you from the bottom of my heart.  :  )
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
Re: First Visit to Scene
« Reply #9 on: February 26, 2009, 05:46:49 AM »

when do we get to see a demo :) I'm diing to see what you been up 2.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: First Visit to Scene
« Reply #10 on: February 26, 2009, 10:20:25 PM »

Thanks, Jyujinkai, as soon as all the testers can agree on a few basics.

Here is the splash screen anyway:


« Last Edit: February 27, 2009, 07:33:43 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: First Visit to Scene
« Reply #11 on: February 26, 2009, 10:21:30 PM »

And here is the menu:



« Last Edit: February 27, 2009, 07:34:43 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: First Visit to Scene
« Reply #12 on: February 27, 2009, 07:51:49 AM »

And a puzzle screne--wasn't that fun to code.  :  ) ) ) )  And I am so coded out, I can't spell screen anymore.  :  )

« Last Edit: February 27, 2009, 07:57:54 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: First Visit to Scene
« Reply #13 on: March 07, 2009, 03:19:29 AM »

I put up a demo, Jyujinkai.  Thanks for all your help.  I'll still need it.  :  )  Am far from finished.  : )
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  
 

Page created in 0.201 seconds with 25 queries.