Hey all! I've been noticing a lot of crappy Extensions hitting DSiExtensions recently, so I figured I'd lend a hand on the matter.
Replace all of the smileys with "". I don't know why, but it replaced some parts of the code with a winking smiley.
Part one - Utilities Seeing as this is the most popular of the three categories, I'll start with Utilities. These are, frankly, pretty easy to make. There are practically infinite possibilities, and if you know the basics, you can make a killer Extension.
For a demonstration, let's make a passcode lock. These are simple, but the make good demonstrations for prompts and alerts. For this, we'll have to make a bookmark of any site. I seriously hope you know how to do this.
Now edit the bookmark. Edit the name of the bookmark. In this case, we'd rename it to "Passcode Lock". Do this by going to your favorites, pressing "Edit", then tapping your desired bookmark.
Now for the coding section of the whole thing. While editing your bookmark, replace the whole URL (web address) on the editing screen with "javascript:". Remember: No quotes. Be sure to include the word EXACTLY. You must include the ":". Caps DOES matter.
Save your Extension. You have your setup. Now we gotta go to the difficult stuff; the stuff that most developers cry about. That's right: the coding. Since the coding needs experience, I'd reccomend learning basic JavaScript before uploading your Extension. If you're too lazy (it's perfectly fine to admit it; I was lazy at my coding when I first started), that's fine; I'm open for people who want an Extension made. Just ask me, and I'll make a good attempt to make your Extension for you. Or you could try to make your own, of course. That's probably the best option.
To begin your first Extension (in this case, the Passcode Lock), we'll start with a variable prompt. These are those cool little polyp boxes that have text inputs on them.
They typically go like this:
var example=prompt("Text to appear above text input","Text to appear inside text input"
So, for a passcode input, we'd add this to our code:
var pass=prompt("Enter passcode to lock device with:","Password"
We can now use the variable "pass" to get the text that the user has put into the input box.
Next, we'll go with a classic: the variable confirm. Confirm boxes are very similar to prompts: they are popup boxes that have "Cancel" and "OK" buttons at the bottom, but they lack the text input. Example:
var example=confirm("Are you sure?"
In our Lock Extension, we'll use this to confirm wether or not we want the entered passcode. Add this to the Extension:
var sure=confirm("Are you sure you want to use this password? "+pass+"? If so, press OK. To quit, press Cancel."
Notice the "+pass+" section. This causes a break in the code and inserts the "pass" variable we assigned earlier in the form of a prompt. So if the user entered "Blar" as the passcode, it will be transferred to the confirm, saying "Are you sure you want to use this password? Blar?..."
To see if the user tapped OK or not, we'll use something like this:
if(sure=false){ void 0 }
This little code will go to the variable named "sure" (if you recall, this is the name of the confirm we just added) and check if they tapped "Cancel". If they tapped "Cancel", the variable would return "false" to anything that uses it. So, this code will check if it returned "false", and if it does, it would run the code between { and }. For those who are unaware, "void 0" just stops the code from going other places (besides redirects to other sites). So if we were to use this code on a page:
document.body.innerHTML+="Blar";
We would think it would add "Blar" to the page without anything stopping it. But you get taken to a new page. It's the same page, but styles and things like that are all out of whack. So you could change that code to:
document.body.innerHTML+="Blar"; void 0;
And that problem is instantly fixed. Pretty easy, huh?
Back to the Lock example. We will now assign what happens if the user hits "OK" instead of "Cancel". Apply this code to the bookmark:
else{ }
The code you put between the { and the } will be what happens if the user DOESN'T hit Cancel. We'll put a basic alert there. Alerts are simple popups that have no user input whatsoever. In other words, there is text and the "OK" button. That's pretty much it. We'll use that to trigger the next prompt. So we'll have the code:
else{ alert("Press OK to unlock" }
Simple enough so far? If you think so, read on ahead.
As you probably have noticed by now, events in a JavaScript code happen in order. So whatever code you put in front of the alert is, you guessed it, what happens immediately after they press OK. let's continue with our code. We'll add a prompt for someone to enter the password.
else{ alert("Press OK to unlock" var enterpass=prompt("Enter passcode to unlock:" }
We are almost done with our Extension, so let's get moving!
We will use the "if" command again, bit this time it'll be used to check in the password is correct or not.
[b]else{ alert("Press OK to unlock" var enterpass=prompt("Enter passcode to unlock" if(enterpass==pass){ void 0 } else{ }
As you may guess, this new "if" command will take the variable "enterpass" and check if it's the same as the other variable "pass". If it is, it would run the code "void 0". If you want, you could replace that with an alert or something, such as:
if(enterpass==pass){ alert("Passcode correct. Your device is now unlocked." }
But I would personally stick with "void 0". It saves space and you can add other flashy stuff to make it look a bit more professional.
Now for the final step! We will now use a famous DSiExtensions code that usually has no purpose except to make the unlucky person who uses it turn off their DSi because it wouldn't stop looping the code inside of it. I wouldn't recommend uploading this code in itself (it makes it more likely to be deleted, after all), but if you combo it with something, it can be quite useful. Add this code:
else{ while(1){ alert("INCORRECT PASSCODE! Please shut off your DSi." } }
This will make the alert loop forever, forcing the user to turn off their DSi.
Your full code should be:
javascript: var pass=prompt("Enter passcode to lock device with:","Password" var sure=confirm("Are you sure you want to use this password? "+pass+"? If so, press OK. To quit, press Cancel." if(sure=false){ void 0 } else{ alert("Press OK to unlock" var enterpass=prompt("Enter passcode to unlock:" if(enterpass==pass){ void 0 } else{ while(1){ alert("INCORRECT PASSCODE! Please turn off your decice." } }
See? That's all there is to it. If you can master that, you already know the basics. If I were you, I'd run the Extension. If it works as you want, feel free to upload it. Otherwise, edit it until you feel like such.
Part 2 - DSiPaint Addons I'm not going to make any examples on these. I'm not going to give you any tips, either. This is because I want DSiPaint addons to be YOUR OWN CREATION. However, since I'm the oh-so-nice kind of guy that would, I'm going to give you the link to the chat script. No, you cannot and will not get banned for using it. In fact, I encourage you guys to giv it a look. You might find some cool info and codes from there.
Lol, you made like tons of fails. I got it to work, thanks to my skills of awesome!
:{ D
Mustacheod smiley!
But, Stuffman, you are my king. I want to learn javascript, but not through those tutorials they have... Too hard to understand. Your is awesome! Soon, I'll be able to hack peoples computers so they cannot escape!
Did you know you can enter javascript in the adress bar of the internet browser on computers? Its true! So I'm gonna do it. >
Yeah, if there's no spaces, then it auto-emotes the characters. He updated it 2 weeks ago, Smileys are universal[site-wise]. Profiles, Sigs, Blogs, BB's...