Detect if a controller is enabled

Hey guys.

I have a request for a (somewhat) simple script. I just want something that can let the game know when a controller has been connected into the computer. Not being actively used, just connected. I'd also like a script call that can check if it's connected during the game, as well. This will greatly help with button prompts and whatnot.

Sorry if this seems vague. If you need any more info from me, feel free to let me know.

Thanks in advance. 
Script: https://gist.github.com/cremno/9113762

Code:
Joystick.attached?  # => true or false
Script: https://gist.github.com/cremno/9113762

Joystick.attached? # => true or false
I will never understand why scripters think that everyone can read RGSS. Probably the least helpful explanation I've ever witnessed.
It means that using:

Joystick.attached?in either a script conditional branch (event command), script call, or in the script editor, will return either true (joystick attached) or false (no joystick attached)

So you could do:

@Lemony: Thank you so much!


It's funny, Mr. Super Cremo took the time to send me an ugly PM telling me to go away for... you know, actually calling him out on having zero instructions. A pointless message, honestly, I know that you don't care. Why take the time to share your work with the community if you are going to be an elitist snob about it?
OP wanted a script call that can be called during the game. The response was a script call. I am not sure where is the confusion here.
Venetian Gondolier, this is not even your thread. If the OP has an issue understanding the instructions, I'm sure he/she is capable of saying so. And as said above, the post you are complaining about is EXACTLY what the OP requested. If you do not understand scripts, perhaps you shouldn't comment on other people's responses to other people's script requests.


Also I am removing the screenshot from your post. If you are going to report something, don't then go and plaster it all over the forum. As I said in my response to your report, the PM you were sent is no more "ugly" than your response to his post here. In fact, YOUR post goes further in breaking community rules than his PM did.
Script: https://gist.github.com/cremno/9113762

Joystick.attached? # => true or false
Wow, that was really quick. I tried it out and works flawlessly! Thank you so much!
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/detect-if-a-controller-is-enabled.23943/