Magnificent Ornk Donald Hebb Posted March 27, 2004 Share Posted March 27, 2004 This script does nothing: Code: 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. Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody wz. As Posted March 27, 2004 Share Posted March 27, 2004 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)) Link to comment Share on other sites More sharing options...
Magnificent Ornk Donald Hebb Posted March 27, 2004 Author Share Posted March 27, 2004 Nope- Doesn't work. Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody Namothil Posted March 28, 2004 Share Posted March 28, 2004 Looks like it should work. Did you make sure the state is actually being called? (Put a print_str outside the conditional.) Link to comment Share on other sites More sharing options...
Magnificent Ornk Donald Hebb Posted March 28, 2004 Author Share Posted March 28, 2004 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.) Link to comment Share on other sites More sharing options...
Garrulous Glaahk UA Posted March 28, 2004 Share Posted March 28, 2004 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. Link to comment Share on other sites More sharing options...
Magnificent Ornk Donald Hebb Posted March 28, 2004 Author Share Posted March 28, 2004 Boolean checks don't use semicolons. That aside, I'm not entirely sure what you're getting at. Link to comment Share on other sites More sharing options...
Garrulous Glaahk UA Posted March 28, 2004 Share Posted March 28, 2004 Quote: Originally written by Snuff ling kin: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. 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. Link to comment Share on other sites More sharing options...
Well-Actually War Trall Khoth Posted March 28, 2004 Share Posted March 28, 2004 Try making it print the result of is_char_on_spot. Link to comment Share on other sites More sharing options...
Garrulous Glaahk Eldiran Posted March 29, 2004 Share Posted March 29, 2004 Put a space between the if and the first parenthesis. I don't know if the space matters, but its worth a try. Link to comment Share on other sites More sharing options...
Burgeoning Battle Gamma Walker White Posted April 4, 2004 Share Posted April 4, 2004 Quote: Originally written by Tentacle Monster: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. 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(). Link to comment Share on other sites More sharing options...
Burgeoning Battle Gamma Walker White Posted April 6, 2004 Share Posted April 6, 2004 One more thing. To make it a little more efficient, you want to write (now that I know the UBB for code) Code: beginstate 31;if (char_on_loc(19,36) >= 0 && char_on_loc(19,36) <= 3) { print_str("You are standing on the mat.");} else { print_str("You are not standing on the mat.");}break; Link to comment Share on other sites More sharing options...
Recommended Posts