char_on_spot...?
Author | Topic: char_on_spot...? |
---|---|
BANNED
Member # 4
|
written Saturday, March 27 2004 16:05
Profile
Homepage
This script does nothing: beginstate 31; if(char_on_spot(19,36) == 0 || char_on_spot(19,36) == 1 || char_on_spot(19,36) == 2 || char_on_spot(19,36) == 3){ print_str("You are standing on the mat."); } else{ print_str("You are not standing on the mat."); } break; ---- If I'm merely making some stupid syntax error, then please alert me. -------------------- * Posts: 6936 | Registered: Tuesday, September 18 2001 07:00 |
Infiltrator
Member # 3040
|
written Saturday, March 27 2004 16:11
Profile
I think you may need parentheses around each condition, but I'm not sure: ((char_on_spot(19,36) == 0) || (char_on_spot(19,36) == 1) || (char_on_spot(19,36) == 2) || (char_on_spot(19,36) == 3)) -------------------- 5.0.1.0.0.0.0.1.0... Posts: 508 | Registered: Thursday, May 29 2003 07:00 |
BANNED
Member # 4
|
written Saturday, March 27 2004 16:23
Profile
Homepage
Nope- Doesn't work. -------------------- * Posts: 6936 | Registered: Tuesday, September 18 2001 07:00 |
Infiltrator
Member # 169
|
written Saturday, March 27 2004 18:29
Profile
Looks like it should work. Did you make sure the state is actually being called? (Put a print_str outside the conditional.) Posts: 422 | Registered: Tuesday, October 16 2001 07:00 |
BANNED
Member # 4
|
written Saturday, March 27 2004 19:57
Profile
Homepage
I tried both Namothil's and Wizard's suggestions, but still couldn't make it work. Bah. -_- (First, I tried calling this through state 2. Then, I tried calling it as a node. Both didn't work.) -------------------- * Posts: 6936 | Registered: Tuesday, September 18 2001 07:00 |
Infiltrator
Member # 154
|
written Sunday, March 28 2004 05:33
Profile
Try incrementally checking it. good = false; good = (char_on_spot(19,36)); if (good = false) good = (char_on_spot(20,37)); if (good = false) good = (char_on_spot(20,37)); if (good = false) good = (char_on_spot(20,37)); if (good = true) { // on mat Etc. [ Sunday, March 28, 2004 05:33: Message edited by: Snuff ling kin ] -------------------- Apparently still annoying. Posts: 612 | Registered: Saturday, October 13 2001 07:00 |
BANNED
Member # 4
|
written Sunday, March 28 2004 05:52
Profile
Homepage
Boolean checks don't use semicolons. That aside, I'm not entirely sure what you're getting at. -------------------- * Posts: 6936 | Registered: Tuesday, September 18 2001 07:00 |
Infiltrator
Member # 154
|
written Sunday, March 28 2004 07:29
Profile
quote:It works like this. Good is false. Good is whatever char_on_spot returns (i.e. true if char there, false otherwise). Then, if good is still false, it sets good to whether char is on the next spot. And again and again until it's tried all the spots. Then you check good, see if it's true, if it is, a char is on any of the spots. -------------------- Apparently still annoying. Posts: 612 | Registered: Saturday, October 13 2001 07:00 |
Post Navel Trauma ^_^
Member # 67
|
written Sunday, March 28 2004 07:50
Profile
Homepage
Try making it print the result of is_char_on_spot. -------------------- Barcoorah: I even did it to a big dorset ram. New Mac BoE Posts: 1798 | Registered: Thursday, October 4 2001 07:00 |
Shock Trooper
Member # 4154
|
written Monday, March 29 2004 14:27
Profile
Put a space between the if and the first parenthesis. I don't know if the space matters, but its worth a try. -------------------- You're a moron if you think I'm not. Posts: 213 | Registered: Friday, March 26 2004 08:00 |
Apprentice
Member # 4127
|
written Sunday, April 4 2004 16:24
Profile
quote:It is a good idea to check out the tech support page page, as I and others have been sending all these issues to Jeff. This is a bad documentation bug. There are two functions, each of which is poorly documented: char_on_spot() and char_on_loc(). The function char_on_spot() is NPC only. You are clearly checking for player characters here. Change it to char_on_loc(). Posts: 48 | Registered: Saturday, March 20 2004 08:00 |
Apprentice
Member # 4127
|
written Monday, April 5 2004 17:21
Profile
One more thing. To make it a little more efficient, you want to write (now that I know the UBB for code) Posts: 48 | Registered: Saturday, March 20 2004 08:00 |