LazyBotter 188 Posted July 17, 2013 Report Share Posted July 17, 2013 Hi, Can someone take a look at this code for me? I have been trying to work this one out for a while! set(#Text_To_Replace, "We\'ve done #LINK# everything we can to make UBot Studio as easy #LINK# to learn as possible. Now it\'s up to you. Make an investment into yourself. Start small #LINK# with a few hours of training and watch as your potential unfolds.", "Global") set(#Links, "\{<a href=\"http://link1.com\">link1</a>|<a href=\"http://link2.com\">link2</a>|<a href=\"http://link3.com\">link3</a>|<a href=\"http://link4.com\">link4</a>|<a href=\"http://link5.com\">link5</a>\}", "Global") set(#Text_To_Replace, $replace(#Text_To_Replace, "#LINK#", $spin(#Links)), "Global") load html("<p> {#Text_To_Replace} </p>") What I am trying to do is replace the #LINK# placeholder with a link from the spintax links, my problem is that they are always the same links. I want the links to be random or all different "NOT ALL THE SAME!". Is there a better way to accomplish this?? Cheers Carl Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted July 17, 2013 Report Share Posted July 17, 2013 set(#Text_To_Replace, "We\'ve done #LINK# everything we can to make UBot Studio as easy #LINK# to learn as possible. Now it\'s up to you. Make an investment into yourself. Start small #LINK# with a few hours of training and watch as your potential unfolds.", "Global") set(#new text, "", "Global") clear list(%text to replace) add list to list(%text to replace, $list from text(#Text_To_Replace, " #LINK#"), "Don\'t Delete", "Global") set(#Links, "\{<a href=\"http://link1.com\">link1</a>|<a href=\"http://link2.com\">link2</a>|<a href=\"http://link3.com\">link3</a>|<a href=\"http://link4.com\">link4</a>|<a href=\"http://link5.com\">link5</a>\}", "Global") loop($list total(%text to replace)) { set(#new text, "{#new text} {$next list item(%text to replace)} {$spin(#Links)} ", "Global") } load html("<p> {#new text} </p>") Quote Link to post Share on other sites
LazyBotter 188 Posted July 17, 2013 Author Report Share Posted July 17, 2013 Thats great! Cheers mate!! Maybe one day I will be as good as you! haha Quote Link to post Share on other sites
LazyBotter 188 Posted July 17, 2013 Author Report Share Posted July 17, 2013 Is there a way to stop the link getting added at the end of the line on the last sentence where there is no #LINK#? Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted July 17, 2013 Report Share Posted July 17, 2013 yes changing it for you now. Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted July 17, 2013 Report Share Posted July 17, 2013 set(#Text_To_Replace, "We\'ve done #LINK# everything we can to make UBot Studio as easy #LINK# to learn as possible. Now it\'s up to you. Make an investment into yourself. Start small #LINK# with a few hours of training and watch as your potential unfolds.", "Global") set(#new text, "", "Global") clear list(%text to replace) add list to list(%text to replace, $list from text(#Text_To_Replace, " #LINK#"), "Don\'t Delete", "Global") set(#Links, "\{<a href=\"http://link1.com\">link1</a>|<a href=\"http://link2.com\">link2</a>|<a href=\"http://link3.com\">link3</a>|<a href=\"http://link4.com\">link4</a>|<a href=\"http://link5.com\">link5</a>\}", "Global") loop($subtract($list total(%text to replace), 1)) { set(#new text, "{#new text} {$next list item(%text to replace)} {$spin(#Links)} ", "Global") } set(#new text, "{#new text} {$next list item(%text to replace)}", "Global") load html("<p> {#new text} </p>") 1 Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted July 17, 2013 Report Share Posted July 17, 2013 DANG! took a minute to wrap my head around what was going on in that loop, Bravo TJ nice one! Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted July 17, 2013 Report Share Posted July 17, 2013 thank you 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.