Jump to content

char_on_spot...?


Recommended Posts

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

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

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

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

Guest
This topic is now closed to further replies.
×
×
  • Create New...