So im making a phone simulation thing like how @Watrmeln did, im making a password/pin system using buttons or the built in text input asset. Is there a way of making this???
Make another textbox call it password and then put this in the textbox where you are going to type the password in: var password = password.value if(this.value = password) { GotoNextFrame // or what ever you want it to do when you type the password }
I just used diff frames and gotoandstop triggers, I’m a supernoob and that was the simplest way to get it done. If you do some minor peeking it’s quite simple
How??? Sorry i didn’t quite get it
I think what BSA means is refer to the text boxes value as “this.value”
Here’s how I would do it:
Add text box to canvas
Name the clip inside of textbox as “box”
Exit the clip, and add an update script to the textbox on the canvas
Refer to the value of the textbox as
this.box.value; /* Use to refer to value */
or
this.box.inputElem.value /* Use to change the value */
To create a password/ username system, I would create an array of possible passwords that you might wanna use, and one with usernames for every password (every password has its own username based on the array order).
project.passwords = ["PW1","PW2"];
project.usernames = ["UN1","UN2"];
You can add more passwords/ username to the array to add a new password or username
And then, I set project.password to the value of a text box, and project.username to another.
Next, I checked if the username is inside of the array and the password is the correct one
// When enter is clicked or player submits the info
if(isKeyJustPressed('enter')){
// If the username is part of the array
if(project.usernames.indexOf(project.username)!==-1){
// If the password is the correct one for this username
if(project.passwords.indexOf(project.password) === project.usernames.indexOf(project.username)){
// Correct password results
alert("welcome "+project.username);
}else{
// Incorrect password
alert("Incorrect password");
}
}else{
// Incorrect password or username
alert("Incorrect password or username");
}
}
Here’s an example:
Password_ Usernames1-29-2021_7-45-53.wick (5.6 KB)
i get an error on the textboxes, it says TypeError: this.model.project is null
Try this version:
Password_ Usernames1-29-2021_9-29-41.wick (6.6 KB)
Let me know if the error is still there
In this file you should be able to create an account by adding a username and password to the array of passwords and usernames.
Before the account is created, the program will have to check if the username is available, and if it’s a valid username and password (if username or password textboxes are empty, then it’s invalid).
If you save the password and username arrays on a server, then you would be able to log in using the username and password you created from any device.
Feel free to edit the file or use the code inside
is there any way to make it go to a new frame without the text poxes pointlessly sticking around, cause now it’s working fine!
Oh yes, I see, the unload script for the textboxes seems to not be working.
(@Jovanny reported this bug somewhere)
Here’s a fix:
Password_ Usernames1-29-2021_10-31-46.wick (6.9 KB)
It should take you to the next frame once you sign in or create an account
Edit:
I just changed the file so that when you pause the editor the text boxes don’t stay there either
The textinput called password is the place you make your password in and it detects if the text input where you type the password in = the password
still doesn’t work, can you examine what’s wrong?
systematix660a1-29-2021_12-14-30.wick (4.0 MB)
it says theres an error on line 7, there is no line 7
nvm its just the .3 revision, it works on 1.19.0, do you know where the scrips that goes to the next frame is?
Edit:
My bad, it’s inside of textbox2 box’s unload script
Project >> textbox2 >> box >> Unload Script
(You can probably move it elsewhere)
where in the default script?
i might stick to the old clunky way, this is too buggy and confusing for a supernoob like me, don’t take it personally.
Here, I removed the username textbox and all the code connected to it, let me know if this is what you needed:
Password_ 1-30-2021_7-31-33.wick (6.6 KB)