Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Help] playerspecificpages

1433731975

Edited 1433734459
I am trying to make an api command that lets players move their page view as they want. It looks like I am doing everything correctly. Log() even shows that that playerspecificplages is changing correctly. However, players are reporting that their view is not updating. I have tried it myself and it does not work. I have tried looking online and through the forums, but I have not found anything. Here is the key excerpt from my code. Is there something that I could be forgetting? //get the player pages object var playerPages = Campaign().get("playerspecificpages"); log(playerPages); //if there are no exceptions yet, get ready to make an exception if(!playerPages){ playerPages = {}; } //update the page for the current player playerPages[msg.playerid] = Pages[0].id; //save your changes Campaign().set("playerspecificpages",playerPages); //tell the player that it worked sendChat("System","/w " + msg.who + " Viewing " + input[1] + "."); log(Campaign().get("playerspecificpages"));
1433734752
The Aaron
Pro
API Scripter
The above is incomplete. What is creating the Pages array? Ditto the input array What does ithe log() output show?
1433735243

Edited 1433736123
Found a work around. It appears that roll20 will forget to update the player's viewed pages unless playerspecificpages started out as equal to false. So if I throw in a Campaign().set("playerspecificpages",false) then everything will work fine. Edit: Didn't see the earlier post. I stated that it was an excerpt from the wider code so I only pulled out the relevant code. Input is the player input diced up into words. As for Pages, var Pages = findObjs({_type: "page", name: input[1]}); I tried manually dragging the player to the page and checked the log. {"-JrFxtfPZVFybOSsIXix":"-Jpua8rsw-qLsLeALLsd"} Manually dragging their portrait worked. I dragged them to a different page and asked them to use the api command. I then checked the log. {"-JrFxtfPZVFybOSsIXix":"-Jq5r-WtR8On5KCG6SFd"} {"-JrFxtfPZVFybOSsIXix":"-Jpua8rsw-qLsLeALLsd"} The api command did not change the player's view. I do want to again say that taking the path {"-JrFxtfPZVFybOSsIXix":"-Jq5r-WtR8On5KCG6SFd"} false {"-JrFxtfPZVFybOSsIXix":"-Jpua8rsw-qLsLeALLsd"} by adding in a Campaign().set("playerspecificpages",false) solves the problem.