![]() |
PO Server JavaScript Help
Hi there! I'm currently in the process of starting a PO server with a bunch of people from another forum. We have got the tiers down, and the server's header is almost complete. Everything is pretty much done, besides scripting. However, none of us really knows JS that well, so I was wondering if someone with some knowledge on Javascript programming could take a look at the script we currently have written and answer a (few?) question(s).
The way PO works now, complex bans (read: Drizzle+Swift Swim) have to be enforced through scripting. We have wrote the code for that, and the server's control pannel script check does not find any errors in the code. However, when selecting a tier where Drizzle+SS is banned, while using a team that contains the said ability combination, the server simply allows it, and no warning message pops up. I'm going to paste the code below, and would really appreciate it if someone could point out what is wrong. Code:
({ afterLogIn : function(source) { |
Hi, Exclamation!
In general, you'll have more luck posting these questions over in the PO forums. You can also check out Smogon's scripts and modify them to suit your purposes. Regarding your actual question, I don't see anything wrong with your function, but where are you calling it? Just defining the function doesn't do anything. You have to call it from afterChangeTeam and beforeChangeTier. |
Thanks a lot for your help, Antar. So, basically, to call a function after a specific action I have to write "afterAction : function", right? And, logically, to call it before I'd have to do the same but with the word "before" replacing "after", right? But how am I able to do both? To call the fuction after and before two specific actions? Please keep in mind I am a total newcomer when it comes to coding, be it JavaScript or anything else.
|
Exclamation!, look at how it's done in the Smogon scripts I linked.
But basically, swiftSwimCheck is a stand-alone script, and then you have: Code:
function beforeChangeTier(playerId, oldTier, newTier) { |
I finally got it to work. Thanks, Antar!
|
| All times are GMT -4. The time now is 2:11:57 PM. |