def badLanguage(bot, trigger): """Easter egg command that insults a random language from this list. Feel free to add lots more languages >:) (Possibly including C???) """ langs = [ "Ruby", "Python", "C++", "PHP", "Rust", "Go", "Perl", "C#", "Java", "Scala", "Objective-C", "F#", "Haskell", "Clojure", "BASIC", "Visual Basic", "HTML", "CSS", "Javascript", "Actionscript", "D", "Fortran" ] info(bot, None, "%s is a bad language :)" % random.choice(langs))
def thanksMessage(bot, trigger): """Command to thank a user. """ if (trigger and trigger.group(2)): info(bot, trigger, "Your thanking has been noted.") else: info(bot, trigger, "You're welcome <3")
def usedCompilierInfo(bot, trigger): """Command to answer the many what compiler is he using """ info( bot, trigger, "Casey compiles from a batch file using MSVC on windows, and has told us he uses Clang to compile on GNU/Linux, BSD, and OS X. You can get the same version of MSVC which he uses on stream completely free as part of Visual Studio 2013 Community Edition here: http://goo.gl/BzGwMC (More: !build, !batch, !unity)" )
def archiveInfo(bot, trigger): """Info command that prints out the forum/youtube archive links. """ info( bot, trigger, 'Annotated Episode Guide: https://goo.gl/O5ljen :: YouTube Archive: http://goo.gl/u3hKKj' )
def streamInfo(bot, trigger): """Info command that displays basic information about the stream itself. """ info( bot, trigger, "In this stream, game programmer Casey Muratori is walking us through the creation of a game from scratch in C. The game is being developed for educational purposes: he will explain what he is doing every step of the way. For more information, visit http://goo.gl/fmjocD" )
def gameInfo(bot, trigger): """Info command that displays basic information about the game being built. """ info( bot, trigger, "Handmade Hero is a 2Dish top-down game inspired by classic Zelda games and modern games like The Binding of Isaac. The entire development of the game is being catalogued in these streams. (More: !art, !lang)" )
def whyNoTemplatesInfo(bot, trigger): """Command to answer the many why Casey avoids using C++ templates where possible """ info( bot, trigger, "Casey avoids using C++ templates where not absolutely necessary, as they lead to longer compile times and make debugging harder. See also: http://mollyrocket.com/forums/molly_forum_402.html" )
def thanksMessage(bot, trigger): """Command to thank a user. """ if (trigger and trigger.group(2)): info(bot, trigger, "%s would like to express their gratitude." % trigger.nick) else: info(bot, trigger, "You're welcome <3")
def siteInfo(bot, trigger): """Info command that prints out the site/forum links. """ info( bot, trigger, 'HMH Website: http://goo.gl/fmjocD :: HMH Forums: http://goo.gl/X5JDvT' )
def milkInfo(bot, trigger): """Info command that prints out info about almond milk. """ info( bot, trigger, "One of Casey's drinks of choice is Almond Milk, a delicious and refreshing beverage. Some common brands are Silk and Almond Breeze. Over Summer, Casey has been making his own lemonade." )
def getTime(bot, trigger): """Info command that prints out the current time in PST. For the purposes of the handmade hero stream, we don't really care about other time zones. """ now = arrow.now('US/Pacific') info(bot, trigger, "The current time in Seattle is %s" % (now.strftime("%I:%M %p %Z")))
def gettingStartedLearning(bot, trigger): """Command for basic learning instructions for all those where to start learning questions we get during the stream """ info( bot, trigger, "Programming can actually be quite simple if you start out right. For absolute beginners, try khanacademy.org or codecademy.com for garden-path tutorials and explanations, or c.learncodethehardway.org/book/ for a more self-directed introduction to C programming, LearnXinYminutes is a quick way to get a overview of a language found here http://goo.gl/ZEDxDt. See !learnC for more." )
def learningC(bot, trigger): """Command describing how you can begin learning C, like this """ info( bot, trigger, "One way to start programming in this manner is to watch the Intro to C series at https://hero.handmadedev.org/jace/guide/ to get a general feel of things. Later, read 'The C Programming Language' by Brian W. Kernighan and Dennis M. Ritchie and work through all the exercises, LearnXinYminutes can be used to see the basics of C http://goo.gl/qmluuM. The most important part is to start coding and to make lots of things in code. Good luck!" )
def renderInfo(bot, trigger): """Command to give render information to the chat target """ info( bot, trigger, "We are currently using software rendering in order to implement our own renderer. Ultimately the game will take advantage of hardware acceleration (i.e. using OpenGL, Direct3D, etc.) to maximize performance. See also !opengl." )
def renderInfo(bot, trigger): """Command to give openGL information to the chat target """ info( bot, trigger, "While Casey will rewrite the renderer using OpenGL in the future - see !render - the current OpenGL code is to allow for vsync, giving a more predictable frame time." )
def buyInfo(bot, trigger): """Info command that prints out where you can buy the game/support the project. """ info( bot, trigger, "The Handmade Hero art assets and full source code can be purchased at http://goo.gl/y20Q9C . You can also support Casey monthly at http://www.patreon.com/cmuratori" )
def usedBuildBatchInfo(bot, trigger): """Command to answer the many why Casey builds HMH the way he does """ info( bot, trigger, "On windows, Casey compiles with MSVC from a batch script, also called by Emacs for rebuilds. The program builds as a single translation unit (STU) using #include to compile all involved files in one go, which we call a unity or STU build. The script needs a change only when adding a dependency. See also: Day 011, http://goo.gl/8ATplA (More: !editor, !compiler)" )
def wristInfo(bot, trigger): """Info command that prints out info about Casey's wrist braces """ info( bot, trigger, "The wrist braces Casey wears help make typing more comfortable and prevent Repetitive Strain Injury. They were made by Medi-Active (the ones without the thumb brace) but are no longer in production." )
def emacsVersion(bot, trigger): """Info command that provides information about the emacs version. """ info( bot, trigger, "The version of emacs that Casey uses is GNU Emacs 23.4.1 (i386-mingw-nt6.1.7601), released in 2012." )
def ideInfo(bot, trigger): """Info command that provides information about the editor (emacs) used by Casey. """ info( bot, trigger, "Casey uses Emacs to edit his code because that is what he is used to. There are a lot of editors out there, however, so you should use whatever you feel most comfortable in. (See also: !emacsversion)" )
def caseyInfo(bot, trigger): """Info command that prints out info about Casey. Could be refactored into multiple commands for better clarity. """ info( bot, trigger, "Casey Muratori is a 38 year old software engineer living in Seattle, Washington. He started Handmade Hero to give the general public a better idea of what coding a game from scratch is like based on his experiences in the industry. For a full bio, see http://mollyrocket.com/casey/about.html" )
def artCreatorInfo(bot, trigger): """Command to state who the art is done by TODO: maybe look to casey to get a link the artists profile for viewing """ info( bot, trigger, "The art in Handmade Hero is created by Yangtian Li (http://www.yangtianli.com/), an artist Casey knows whom he contracted using the funds provided by purchases of the game." )
def langInfo(bot, trigger): """Info command that provides a description of the language and style used on the stream. Could be split into two commands, one for simple info and one about the structural choices. """ info( bot, trigger, "The language used in the stream is a subset of C++ that is very C-like with a few differences, such as the use of operator and function overloading. Since we're writing everything from scratch, we will not be using the C or C++ standard libraries wherever possible." )
def nextSchedule(bot, trigger): """Info command that prints out the expected time of the next stream """ nextStream = getNextStream() if( nextStream != None): info(bot, trigger, "The stream should next be live on %s PST" % nextStream.start.strftime("%a at %I:%M %p")) else: info(bot, trigger, "No more streams scheduled in the bot, Try checking www.handmadehero.org")
def timer(bot, trigger): """Info command that prints out the time until the next stream. """ nowTime = now() streamTime = getNextStream(nowTime) # Make "now" the default argument? #TEST CODE #stream.scheduleStream(newTime) # sets the time of any existing stream on that day to the new time, or creates one if there is no entry #stream.setStreamLength(date, lengthInMinutes) # set the length of the stream (not including Q&A) on that date to the given length info(bot, trigger, timeToStream(streamTime, nowTime))
def currentSchedule(bot, trigger): """Info command that prints out this week's schedule """ startOfWeek = getStartOfDay() if (startOfWeek.weekday() <= FRIDAY): startOfWeek = startOfWeek.replace(days=-(startOfWeek.weekday()-MONDAY)) else: # It's a weekend, go forward to the next week startOfWeek = startOfWeek.replace(days=+(SUNDAY-startOfWeek.weekday())+1) endOfWeek = startOfWeek.replace(days=+7) streams = getStreamsBetween(startOfWeek, endOfWeek) streamTimes = " :: ".join([stream.start.strftime("%I %p on %a").lstrip("0") for stream in streams]) info( bot, trigger, "Schedule for week of %s: %s (times in PST)" % (startOfWeek.strftime("%m/%d"), streamTimes) )
def currentSchedule(bot, trigger): """Info command that prints out this week's schedule """ nowDate = now() if (nowDate.weekday() <= FRIDAY): while(nowDate.weekday() > MONDAY): nowDate = nowDate - timedelta(days=1) else: # It's a weekend, go forward to the next week while(nowDate.weekday() > MONDAY): nowDate = nowDate + timedelta(days=1) times = [] while(nowDate.weekday() <= FRIDAY): #check from 12AM for arbitrary reasons times.append(getNextStream(datetime.combine(nowDate, time(hour=0, tzinfo=timezone("PST8PDT"))))) nowDate = nowDate + timedelta(days=1) info(bot, trigger, "Current schedule: %s " % " :: ".join([t.strftime("%I %p on %a").lstrip("0") for t in times]))
def timer(bot, trigger): """Info command that prints out the time until the next stream. """ now = arrow.now(); currentStream = getStreamAt(now) if(currentStream == None): # Check if there is a stream coming up. nextStream = getNextStream() if(nextStream == None): return info(bot, trigger, "No more streams scheduled in the bot, Try checking www.handmadehero.org") else: return info(bot, trigger, "Next stream is in %s" % getDurationString(nextStream.start - now )) if( currentStream.start < now and now < currentStream.getQaStart() ): return info(bot, trigger, "%s into stream (%s until Q&A) if Casey is on schedule" % (getDurationString(now - currentStream.start), getDurationString(currentStream.getQaStart() - now))) if( currentStream.getQaStart() < now and now < currentStream.getEnd() ): return info(bot, trigger, "%s into the Q&A (%s until end) if Casey is on schedule" % (getDurationString(now - currentStream.getQaStart()), getDurationString(currentStream.getEnd() - now)))
def hug(bot, trigger): """Easter egg info command that attempts to provide human warmth and empathy in times of emotional trauma. """ info(bot, trigger, "Were I not a transient being circling through an ether of intangible bits and bytes, I would hug you, with all the human emotional context it implies")
def rules(bot, trigger): info(bot, trigger, "The Handmade Hero moderator team volunteers their time in order to keep chat civil and clean during stream time. Spamming, repetitive arguments that clog up the chat, or refusal to cooperate with a reasonable request from a moderator may result in a ban from the chat at the moderators' sole discretion.")
def milkInfo(bot, trigger): """Info command that prints out info about almond milk. """ info(bot, trigger, "One of Casey's drinks of choice is Almond Milk, a delicious and refreshing beverage. Some common brands are Silk and Almond Breeze. Over Summer, Casey has been making his own lemonade.")
def caseyInfo(bot, trigger): """Info command that prints out info about Casey. Could be refactored into multiple commands for better clarity. """ info(bot, trigger, "Casey Muratori is a 38 year old software engineer living in Seattle, Washington. He started Handmade Hero to give the general public a better idea of what coding a game from scratch is like based on his experiences in the industry. For a full bio, see http://mollyrocket.com/casey/about.html")
def archiveInfo(bot, trigger): """Info command that prints out the forum/youtube archive links. """ info(bot, trigger, 'Annotated Episode Guide: https://goo.gl/O5ljen :: YouTube Archive: http://goo.gl/u3hKKj')
def wristInfo(bot, trigger): """Info command that prints out info about Casey's wrist braces """ info(bot, trigger, "The wrist braces Casey wears help make typing more comfortable and prevent Repetitive Strain Injury. They were made by Medi-Active (the ones without the thumb brace) but are no longer in production.")
def nightNight(bot, trigger): info(bot, trigger, "Night night <3")
def never(bot, trigger): info(bot, trigger, "Programming is not really about the code. See moderator AbnerCoimbre's informal lecture on the subject here: http://y2u.be/Lzc3HcIgXis or a more extensive talk from Mike Acton here: http://y2u.be/rX0ItVEVjHc")
def ask2ask(bot, trigger): info(bot, trigger, "Don't ask to ask a question, simply ask your question. Many regulars use IRC, so we will see your question eventually. If you can't stay long, you may also ask your question on the !forum")
def bestEditor(bot, trigger): """Easter egg command that endorses either emacs or vim. Feel free to add more editors. """ editors = ["emacs", "vim", "sublime", "notepad++", "notepad2", "ed", "nano"] info(bot, None, "%s is the best editor :)" % random.choice(editors))
def hmhcon(bot, trigger): info(bot, trigger, "HandmadeCon 2015 will be held on Krampusnacht in Seattle. More specifically: Saturday, December 5th, 2015, from 10AM to 6PM PST, in the auditorium at the central branch of the Seattle Public Library. There are 275 tickets total, at $45/ticket (or $35/ticket if ordered before November 5th). Read the latest info at http://handmadecon.org")
def manifesto(bot, trigger): info(bot, trigger, "You can read The Handmade Manifesto here: http://handmadedev.org/manifesto/")
def design(bot, trigger): info(bot, trigger, "Handmade Hero is primarily a demonstration of game _programming_, and the design of the game is intended only to facilitate that by employing complex mechanics and interesting interactions, and may not necessarily innovate in any particular direction. If you'd like to see a lecture on game design from moderator GarlandoBloom, see http://y2u.be/0zVjdEhHmGo")
def nextSchedule(bot, trigger): """Info command that prints out the expected time of the next stream """ streamTime = getNextStream(now()) info(bot, trigger, "The stream should next be live on %s" % streamTime.strftime("%a at %I:%M %p"))
def ExplainUGT(bot, trigger): info(bot, trigger, "Use UGT to greet people! It's always morning when you arrive, and always night when you leave ;) You can also use !o/ and !\o/.")
def creativeAsk(bot, trigger): info(bot, trigger, "Handmade Hero is being streamed in the Creative section of twitch because twitch administration asked Casey to do so. It is unclear if there is a larger reason behind the decision.")
def userlist(bot, trigger): info(bot, trigger, "Are you on IRC and missing a user list? Use the raw command in your IRC client (/raw or /quote usually, or just /cap) to issue the following command: CAP REQ :twitch.tv/membership For the change to take effect you will need to use /cycle (if supported) or /part and /join in that order. It is recommended to add this to your connect command.")
def randomNumber(bot, trigger): """Easter egg info command that returns a randomly-selected number. """ info(bot, trigger, "Your random number is %s" % (random.randint(100) if random.random() < 0.0001 else 4))
def siteInfo(bot, trigger): """Info command that prints out the site/forum links. """ info(bot, trigger, 'HMH Website: http://goo.gl/fmjocD :: HMH Forums: http://goo.gl/X5JDvT')
def creativeAsk(bot, trigger): info( bot, trigger, "Handmade Hero is being streamed in the Creative section of twitch because twitch administration asked Casey to do so. It is unclear if there is a larger reason behind the decision." )
def scripting(bot, trigger): info(bot, trigger, "We will not be creating a scripting language for Handmade Hero because we have a hot-reloading feature! We can keep all the code in one language with all the benefits that scripting languages typically try to offer.")
def quotelist(bot, trigger): info(bot, trigger, "A list of all saved quotes is available here: https://goo.gl/YYT8rN.")