Quick question about a function...

Hi,
I'm a little stuck on something that will most likely be ridiculously simple to surpass. I am using The Pixie's Clock library, http://quest5.net/wiki/Clock_Library, and am having trouble with the boolean functions for time of day.

Example:
I'm trying to have a room display a different description for each time of day. So, I call function IsMorning (no parameters), IF expression = TRUE then print message. Elseif, call function IsDusk, IF expression = TRUE etc...

Note: I am new to Quest and am using the GUI mostly, but am not afraid of code and am trying to learn more as I go.

So, what is occurring instead of the desired result is that all messages from all times of day are being printed which leads me to believe that I'm doing something wrong as far as passing the IsMorning boolean into the IF command.

This silly little hiccup is preventing any progress on my project, so any help is greatly appreciated!

If you could show some code, it would be helpful. It sounds like something straightforward, but without more to go on, it could be anything. :)

Sure. It does look suspiciously simple.

IsDusk
if (True) {
msg ("It is dusk in Chinatown.")
}
else if (false) {
IsMorning
if (true) {
msg ("It is morning in Chinatown.")
}
}


I may end up answering my own question here, but do I need a boolean attribute for every room and object that needs to relate to the library's time functions?

Try this:

if (IsDusk()) {
msg ("It is dusk in Chinatown.")
} else if (IsMorning()) {
msg ("It is morning in Chinatown.")
}

It works perfectly, thank you!

You might be able to leave them off. If it had parameters, you'd need them for sure. I just habitually put them in since that's what you do in other languages (typically), but I think they're optional in Quest for functions with no parameters.

Ah, ok. I figured as much. I just edited that last question out of the thread so I didn't look like an idiot, :lol: . Thanks for answering anyway though. I'm not a total noob with scripting, but have never had any fluency in a language. I tend to dabble as my profession is on the game art/design side.
I am learning Java on codeacademy and Quest seemed like a great way to pair that process with an ongoing project.
Incidentally, I'm interested in your goal oriented "elevator" library and look forward to delving into that for my game. I haven't yet gotten into editing aslx files though, so it may be over my head at this point :?

That elevator code works to a point - it has some problems that I have corrected in later versions (e.g. my understanding of how objects should be managed improved.) So if you want to use it in any real game, let me know, and I can try to put together updated code.

stigma wrote:So, what is occurring instead of the desired result is that all messages from all times of day are being printed which leads me to believe that I'm doing something wrong as far as passing the IsMorning boolean into the IF command.


this sounds like it's a "nesting"~indenting of scripts problem, and yep, seeing Jayna's fix as successful, shows this to be true.

I still have a bloody time figuring out which "add a~new script" button in the GUI~Editor is the correct one to use, lol. It's not that easy to see the indentation in the GUI~Editor with how the GUI~Editor's interface (if I can use this word without being reduntant, lol) is set up.