ubotapprentice 1 Posted February 17, 2011 Report Share Posted February 17, 2011 how do you trim a username to 10 characters? and what is the easiest way, cause i need to do it over and over for every account creation bot been made.? Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted February 17, 2011 Report Share Posted February 17, 2011 If you have dev license you can use $subtext to trim any text. Quote Link to post Share on other sites
UBotBuddy 331 Posted February 17, 2011 Report Share Posted February 17, 2011 Here ya go http://screencast.com/t/lOPMyOh5BRnO Quote Link to post Share on other sites
ubotapprentice 1 Posted February 17, 2011 Author Report Share Posted February 17, 2011 sorry i dont have dev license..........standard license. Quote Link to post Share on other sites
Super Dave 26 Posted February 17, 2011 Report Share Posted February 17, 2011 With the standard license you'll need to first make sure the page you have loaded has javascript elements so that ubot can use js functions. If you need help with getting a page to load javascript so that this stuff works send me a PM and I'll walk you through a hack for non-js enabled pages.. Let's assume the page has JS loaded already. From there, I'd set #variable = to an eval of : "{1}".substring(0,X); {1} is the ubot filler for your variable you want trimmed, and X is the length you want it trimmed to. Eval tells ubot to 'evaluate' what's in the box. In this case we're telling ubot to use javascript to load the string and cut a chunk out, starting at the 0 position going until the Xth character. Hope this helps Quote Link to post Share on other sites
JohnB 255 Posted February 17, 2011 Report Share Posted February 17, 2011 You also have the option (if that's the way your script is set up) to use Dave's eval in a set command at the beginning of the script since ubot defaults to a js enabled page. So if your ui text box is #username and the input is dangthisisalongusername, you can immediately use a set command to re-set the variable and shorten it. If that;s not possible (i.e. the string is not in the ui inputs elements) then you will need the workaround Dave is referring to. John Quote Link to post Share on other sites
ubotapprentice 1 Posted February 17, 2011 Author Report Share Posted February 17, 2011 ok Let's assume the page has JS loaded already. From there, I'd set #variable = to an eval of : "{1}".substring(0,X); can you help on that? i dont know how to set a variable like that. this is what i did? set #variable1 content: $eval on eval i type "{1}".substring(0,10); and below eval i put the variable again.. #variable1 Quote Link to post Share on other sites
ubotapprentice 1 Posted February 17, 2011 Author Report Share Posted February 17, 2011 can someone send the actual node to see how its done? Quote Link to post Share on other sites
Super Dave 26 Posted February 17, 2011 Report Share Posted February 17, 2011 Here ya go. Take a look around the web for more details on what you can do with javascript. It can run in the 'eval' node, or under actions you have the 'run javascript' nodeexample.shortstring.ubot Quote Link to post Share on other sites
ubotapprentice 1 Posted February 18, 2011 Author Report Share Posted February 18, 2011 thanks works wonders 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.