Lucius 7 Posted March 24, 2013 Report Share Posted March 24, 2013 How do I enter a variable inside a ui block text? Quote Link to post Share on other sites
magoo 31 Posted March 24, 2013 Report Share Posted March 24, 2013 The ui block text is the variable, whats inside it is the value of the variable. Make sense? Quote Link to post Share on other sites
Lucius 7 Posted March 24, 2013 Author Report Share Posted March 24, 2013 I want to input a variable inside the ui block text. like some text. etc etc.. and another variable with the text. Quote Link to post Share on other sites
magoo 31 Posted March 24, 2013 Report Share Posted March 24, 2013 so, say each line in the ui is set to a different variable?? is that what you need? Quote Link to post Share on other sites
Lucius 7 Posted March 24, 2013 Author Report Share Posted March 24, 2013 I made an autoresponder bot. I want to be able to change the message it sends out once the bot is compiled, altering the message with a ui block text. However, I need to use other variables with my reply. Is there anyway to put in the other variables inside the ui block text? for example i want to use a variable that address the recipient by his/her first name. So i have a #firstname variable.. How do I enter #firstname variable into the ui block text? Quote Link to post Share on other sites
darryl561 177 Posted March 24, 2013 Report Share Posted March 24, 2013 I think this should do what you are asking. Just put that code into a bot in code view and you will see how it works: ui html panel("<html lang=\"en\"><head><style> #containment-wrapper \{ width: 99%; height:222px; background-color: #4D8280; padding: 3px; \} </style> </head> <body style=\"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; cursor: auto; \"> <div id=\"containment-wrapper\"><div id=\"textbox1\" style=\"margin-left: 1px; width: 300px; height: 20px; position: relative; left: 25px; top: 19px; \" > <input variable=\"#firstname\" fillwith=\"value\" placeholder=\"\" style=\" background: #FFFFFF; width: px; border:0px groove #000000;\"> <font style=\"font-family: Georgia; font-size: 15; color: #000000;\">First Name</font> </div><div id=\"blocktext2\" style=\"margin-left: 1px; width: 200px; height: 20px; position: relative; left: 333px; top: -20px; \" > <font style=\"font-family: Georgia; font-size: 15; color: #000000;\">Text</font><br><textarea variable=\"#blocktext\" fillwith=\"value\" placeholder=\"\" style=\" background: #FFFFFF; width: 300px; height: 200px; border: 0px outset #000000;\"></textarea> </div><div id=\"textbox2\" style=\"margin-left: 1px; width: 300px; height: 20px; position: relative; left: 24px; top: 36px; \" > <input variable=\"#lastname\" fillwith=\"value\" placeholder=\"\" style=\" background: #FFFFFF; width: px; border:0px groove #000000;\"> <font style=\"font-family: Georgia; font-size: 15; color: #000000;\">Last Name</font> </div><div id=\"textbox3\" style=\"margin-left: 1px; width: 200px; height: 20px; position: relative; left: 24px; top: 74px; \" > <input variable=\"#email\" fillwith=\"value\" placeholder=\"\" style=\" background: #FFFFFF; width: px; border:0px groove #000000;\"> <font style=\"font-family: Georgia; font-size: 15; color: #000000;\">Email</font> </div><div id=\"colorbutton1\" style=\"margin-left: 1px; width: 200px; height: 20px; position: relative; left: 23px; top: 93px; \" > <button style=\"height: 30px; width: 200px; font-family: Georgia; font-size: 18px; color: rgb(255, 255, 255); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(47, 76, 110); background-position: initial initial; background-repeat: initial initial; \" onmouseover=\"this.style.background=\'#304B63\'\" onmouseout=\"this.style.background=\'#2F4C6E\'\" onclick=\"ubot.runScript(\'addtext()\')\">Add info to text box</button> </div> </div></body></html>", 231) define addtext { set(#blocktext, "{#firstname} {#lastname} {#email}", "Global") } Quote Link to post Share on other sites
magoo 31 Posted March 24, 2013 Report Share Posted March 24, 2013 I made an autoresponder bot. I want to be able to change the message it sends out once the bot is compiled, altering the message with a ui block text. However, I need to use other variables with my reply. Is there anyway to put in the other variables inside the ui block text? for example i want to use a variable that address the recipient by his/her first name. So i have a #firstname variable.. How do I enter #firstname variable into the ui block text?Why didn't you open your thread with a clear explanation like this?? Quote Link to post Share on other sites
Lucius 7 Posted March 24, 2013 Author Report Share Posted March 24, 2013 Thanks, but the above code.. I would have to set the variables manually, wouldn't I? My bot already sets the variables I need. I attached a pic to better explain what I need to do. http://imageshack.us/photo/my-images/842/uiblocktext.png/ Quote Link to post Share on other sites
darryl561 177 Posted March 24, 2013 Report Share Posted March 24, 2013 That code is just an example of how you can set variables to display in a block text, which is what you asked. Had a look at your pic. Why don't you add the text that you have in the block text to a list, you can then easily add your variables that way, and then you can add the list with the variables already added to the block text. Quote Link to post Share on other sites
darryl561 177 Posted March 24, 2013 Report Share Posted March 24, 2013 If this is not what you mean then I'm a bit confused. set(#firstname, "John", "Global") ui block text("Reply Message:", #replymessage) clear list(%reply) add item to list(%reply, "Dear {#firstname}, hi how u doing?", "Delete", "Global") set(#replymessage, %reply, "Global") Quote Link to post Share on other sites
Lucius 7 Posted March 24, 2013 Author Report Share Posted March 24, 2013 I'm not trying to display the value of the #firstname variable in the ui block text.. I'd use a stat monitor for that... I'm trying to set the #blocktext variable with the text and the #firstname variable that i input in the ui block text, when the bot is already compiled.. change the reply message 'on the fly'. When I enter in #firstname variable in ui block text.. it displays ... the variable name instead of its value. Quote Link to post Share on other sites
darryl561 177 Posted March 25, 2013 Report Share Posted March 25, 2013 I don't think you will be able to display the value of the firstname variable that way. If I understand what you are trying to do correctly instead of: Dear '{#firstname}', hi how u doing? I would make it: Dear #@, hi how u doing?then set a new variable: set(#message, $replace(#replymessage, "#@", #firstname), "Global") Try the code below in a bot to see if this will help with what you are trying to do. ui block text("Reply Message:", #replymessage) ui button("Send Message") { sendmessage() } define sendmessage { set(#firstname, "John", "Global") set(#message, $replace(#replymessage, "#@", #firstname), "Global") load html("<textarea variable=\"#bt\" style=\" background: #FFFFFF; width: 300px; height: 270px; \"></textarea>") type text(<variable="#bt">, #message, "Standard") } 1 Quote Link to post Share on other sites
Lucius 7 Posted March 28, 2013 Author Report Share Posted March 28, 2013 ^Nice work around. Thanks for the help. Quote Link to post Share on other sites
whoami 26 Posted December 3, 2015 Report Share Posted December 3, 2015 Thank you very much, works like a charm Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.