Need a randomizing script for HexChat reddit / irc ---------------------------------------------------------------------- MiddayHobo · 2015-02-23 09:52 I need what seems like a simple (yet impossibly hard when it comes to my, nonexistent, scripting skills) script to use during online RPG sessions instead of dice rolling. For HexChat, so it should be written either in Perl or Python. Here's my idea how it should work: you enter some command like !random or something, followed by a number from the range 0-100, which would mean the probability of success in %, then the script would randomize (basing on that probability) the outcome and give an answer if you succeeded or not. Examples: !random 74 The outcome of your action is: Success! !random 12 The outcome of your action is: Failure... !random 100 The outcome of your action is: Success! (always) It would increase mine (or perhaps not only mine) Game-Related Quality of Life immensely, so if anyone out there likes to help thine neighbour (in this case - me) for whatever reason, I'd be forever thankful. ---------------------------------------------------------------------- caffeinedrinker · 2015-02-24 00:49 https://docs.python.org/2/library/random.html http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/print1.html http://hexchat.readthedocs.org/en/latest/script_python.html ---------------------------------------------------------------------- MiddayHobo · 2015-02-24 10:30 Thank you! Now there only remains the part where you tell me which functions to use and in what order. ---------------------------------------------------------------------- caffeinedrinker · 2015-02-24 15:49 i suggest you find a really simple plugin template and start programming ;) ... im not going to write the code for you but if you get stuck ill help you out ;) ---------------------------------------------------------------------- MiddayHobo · 2015-02-24 21:11 I got stuck! For example, I got this line of code in Python: hexchat.prnt(text1 + word[1] + text2 + "\n\002\00303SUCCESS") But it turned out that it only displays this line of text locally. The proper command to say something visible on the channel is: hexchat.command("say ") But then I don't know how to put variables "text1", "word[1]" and "text2" in there :( Help? EDIT: I figured out how to insert variables and now I have one last problem. I don't know how to use line breaks properly, because when I put \n in there, it indeed does start a new line, but that second one is only displayed locally. I don't know if I explained it clearly, so here it is: hexchat.command("say blahblah\nblahblah") displays this way: blahblah blahblah Other users don't see that second line. I tried using other variations like "blahblah\nsay blahblah", "blahblah\n\say blahblah" but nothing seems to work. Any ideas? ---------------------------------------------------------------------- caffeinedrinker · 2015-02-24 22:57 hmmmm i think i'd need to see the rest of your code to help ... but well done man ;) have you tried hexchat.command("say blahblah1111") hexchat.command("say blahblah2222") ? that would display 2 lines of text ?? ---------------------------------------------------------------------- MiddayHobo · 2015-02-24 23:25 Tried that before, invalid syntax error. ---------------------------------------------------------------------- caffeinedrinker · 2015-02-25 04:28 hmmmm give me a few days and ill have a look at it for you ;) ---------------------------------------------------------------------- caffeinedrinker · 2015-02-25 21:01 http://pastebin.com/g9KnPVep enjoy ;) (just rolls a dice but you can mod it to what you need ;) )