I am currently working on a project for my computer programming course, creating an rpg game, and have already ran into a problem i’ve spent a few hours trying to fix; came up with the conclusion I couldnt fix it without help.
I have an input textbox with the instance name of “inputname”. The player is supposed to put his name here and then click a button, instance name continuebtn, that will change to frame two on the scene. Frame two has a dynamic textbox with the name of “greetingtb”.
greetingtb already says 'ahh so your name is ’ and after that I would like to add the name that was placed into inputname. What I thought would work was create a variable with the name of playername. I dont know if i wrote this right, i declared it as my first thing in an action layer:
var playername = “”
next, on continuebtn, I coded the following:
on (release){
_root.gotoAndStop(2);
if ((_root.inputname.text=“crap”)||(_root.inputname.text="sh…//and so on. basically, I remove profanity lol//…)){
playername = “@#$%&”;
}
else
{
playername=_root.inputname.text
}
}
Basically this is what’s happening now: the word “crap”, which im trying to avoid, inserts itself into inputname after i click on continuebtn. why? As I mentioned before, I want the text in inputname, which now should be in playername, to be added into the speech in my dynamic textbox on frame 2. How would i code this?