--- Log opened Thu Apr 11 00:00:40 2013 |
00:02 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds] |
00:15 | | Turaiel is now known as Turaiel[Offline] |
00:25 | | Turaiel[Offline] is now known as Turaiel |
00:25 | | Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code |
00:25 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
01:06 | | Syloq [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds] |
01:08 | | thalass [thalass@Nightstar-f97b970e.bigpond.net.au] has joined #code |
01:17 | <@gnolam> | RichyB: "Poul-Henning Kamp" sounds Danish and not Dutch. |
01:17 | < RichyB> | That's because he *is* Danish and not Dutch. |
01:17 | < RichyB> | I was wrong about that bit. |
01:21 | < RichyB> | What I'm not wrong about is that the guy is so alarmingly smart that he makes me feel ashamed of myself. |
01:23 | | himi [fow035@D741F1.243F35.CADC30.81D435] has joined #code |
01:23 | | mode/#code [+o himi] by ChanServ |
01:23 | | syksleep is now known as Syk |
01:25 | < RichyB> | (on that note see also: Chris Okasaki, Jeri Ellsworth, Fabrice Bellard, Kelly Sommers...) |
01:25 | | Rhamphoryncus [rhamph@Nightstar-948421b4.abhsia.telus.net] has joined #code |
01:25 | | mode/#code [+o Rhamphoryncus] by ChanServ |
01:30 | | Syloq [Syloq@B4EC54.59F324.016BDA.8CB0A3] has joined #code |
01:30 | | mode/#code [+o Syloq] by ChanServ |
01:33 | <@gnolam> | It still strikes me as odd to refer to him as "very Dutch". |
01:39 | < Syk> | Varnish's method of configuration is insane |
01:39 | < Syk> | the good insane |
01:47 | < RichyB> | gnolam: okay so maybe I have this racist stereotype that all Dutch people are super-geniuses. :P |
01:47 | <@gnolam> | Hah |
01:48 | < RichyB> | That is not entirely true. |
01:49 | < RichyB> | The set of people of whom I assume that includes the entire Scandinavian population too. |
01:59 | | Turaiel is now known as Turaiel[Offline] |
02:05 | <@Azash> | Speaking of good insane methods of configuration |
02:05 | <@Azash> | A short anecdote: As some of you might be aware, I can be a bit of a derp |
02:06 | <@Azash> | Our uni dept (CS) uses mainly Linux machines, which give you a list of WMs at login |
02:06 | <@Azash> | I asked the admins to add dwm to the list |
02:06 | | Turaiel[Offline] is now known as Turaiel |
02:06 | <@Azash> | To my great joy, they agreed |
02:06 | <@Azash> | After logging in, I thought to myself "great, I just need to configure it a little and I'm good to go" |
02:07 | <@Azash> | ... |
02:19 | <&McMartin> | Yay dwm? |
02:19 | < RichyB> | hahaha |
02:19 | <@Azash> | I love dwm |
02:20 | <@Azash> | I just didn't foresee the issues on a uni system :P |
02:20 | | * RichyB didn't get that at first |
02:20 | < RichyB> | I had to look up the fact that, actually, the only way to configure dwm is to alter its source code and recompile it. |
02:20 | <@Azash> | Yeah |
02:20 | <@Azash> | It also has a limit of 2000 loc last I heard |
02:20 | < RichyB> | The configuration format is actually a bunch of constants in the .c file which you're supposed to edit. |
02:21 | < RichyB> | Oh! Xmonad does a similar-ish thing. |
02:21 | < RichyB> | Used to, anyway. I think it's optional now. |
02:21 | <@Azash> | If you've used awesome, I believe that's a fork of dwm |
02:22 | < RichyB> | Instead of a ~/.xmonadrc file, you write a ~/.xmonad.hs file. This should expose a Haskell module which xmonad will import and then call into as a config mechanism. |
02:23 | < RichyB> | er ~/.xmonad/xmonad.hs, even |
02:23 | <@Azash> | Nice |
02:24 | < RichyB> | When you edit that file, you hit a keybind and then xmonad shells out to GHC to recompile itself with that module included, and if that succeeds, execve()s the new binary. |
02:24 | < RichyB> | I think it does a little bit more than that - serialises and then deserialises all of its state so that it doesn't forget the current layout and so on. |
02:25 | <@Azash> | Quite neat regardless |
02:25 | < RichyB> | If you don't have that file then you'll get the pre-packaged xmonad binary with a vanilla default version of that module in it. |
02:27 | < RichyB> | The funny bit is that xmonad is this tiny little (single-digits kLoC, maybe?) program which has the entire Glorious Glasgow Haskell Compiler as a run-time dependency. |
02:28 | < RichyB> | I think it might still be under 2 kLoC. |
02:34 | <@Reiv> | Demanding Haskell is hardly a bad thing~ |
02:35 | | * RichyB hugs Reiv~ |
02:36 | <&McMartin> | How large is GHC, anyway |
02:38 | < RichyB> | ~120MB built and packaged, ~100MB source code. |
02:59 | | Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds] |
03:00 | | Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code |
03:00 | | mode/#code [+ao Derakon Derakon] by ChanServ |
03:12 | <&ToxicFrog> | Azash: awesomewm is indeed a dwm fork, originally conceived as "dwm with an external configuration file". In its current implementation it's lua-configured. |
03:13 | | Derakon_ [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code |
03:13 | | Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [NickServ (GHOST command used by Derakon_)] |
03:13 | | Derakon_ is now known as Derakon |
03:13 | | mode/#code [+ao Derakon Derakon] by ChanServ |
03:15 | | Derakon_ [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code |
03:15 | | Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [NickServ (GHOST command used by Derakon_)] |
03:15 | | Derakon_ is now known as Derakon |
03:15 | | mode/#code [+ao Derakon Derakon] by ChanServ |
03:17 | | celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.] |
03:17 | | celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code |
03:17 | | mode/#code [+o celticminstrel] by ChanServ |
03:20 | | VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [[NS] Quit: Program Shutting down] |
03:29 | | Kindamoody[zZz] is now known as Kindamoody |
03:47 | | Kindamoody is now known as Kindamoody|out |
03:52 | | Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving] |
04:14 | | RichyB [richardb@Nightstar-86656b6c.cable.virginmedia.com] has quit [[NS] Quit: >:3 This is BunThulhu. Copy him into your quit message to help him take over the Internet.] |
04:47 | | thalass is now known as Thalass|afk |
04:51 | | Thalass|afk [thalass@Nightstar-f97b970e.bigpond.net.au] has quit [Ping timeout: 121 seconds] |
05:36 | | celmin [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code |
05:36 | | mode/#code [+o celmin] by ChanServ |
05:37 | | celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has quit [Ping timeout: 121 seconds] |
05:37 | | celmin is now known as celticminstrel |
06:25 | | Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code |
06:25 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
06:30 | | ErikMesoy|sleep is now known as ErikMesoy |
06:34 | | ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has quit [Operation timed out] |
06:35 | | ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has joined #code |
06:35 | | mode/#code [+ao ToxicFrog ToxicFrog] by ChanServ |
06:55 | | Derakon is now known as Derakon[AFK] |
07:04 | | thalass [thalass@Nightstar-f97b970e.bigpond.net.au] has joined #code |
07:31 | | thalass is now known as Thalass|walkingbus |
07:33 | | Turaiel is now known as Turaiel[Offline] |
08:17 | | cpux [cpux@Nightstar-98762b0f.dyn.optonline.net] has quit [Client closed the connection] |
08:17 | | Thalass|walkingbus is now known as Thalass |
08:26 | | Kindamoody|out [Kindamoody@Nightstar-e9aa495d.tbcn.telia.com] has quit [Ping timeout: 121 seconds] |
08:32 | | himi [fow035@D741F1.243F35.CADC30.81D435] has quit [Ping timeout: 121 seconds] |
08:44 | | Kindamoody|autojoin [Kindamoody@Nightstar-e9aa495d.tbcn.telia.com] has joined #code |
08:44 | | mode/#code [+o Kindamoody|autojoin] by ChanServ |
09:45 | | celticminstrel is now known as celmin|sleep |
09:47 | | Orthia [orthianz@3CF3A5.E1CD01.B089B9.1E14D1] has quit [[NS] Quit: Going dooooown...] |
10:13 | | Kindamoody|autojoin [Kindamoody@Nightstar-e9aa495d.tbcn.telia.com] has quit [Operation timed out] |
10:22 | | Thalass is now known as Thalass|dinnar |
10:27 | | RichyB [richardb@Nightstar-228a334c.plus.com] has joined #code |
10:31 | | Kindamoody|autojoin [Kindamoody@Nightstar-e9aa495d.tbcn.telia.com] has joined #code |
10:31 | | mode/#code [+o Kindamoody|autojoin] by ChanServ |
10:35 | | Thalass|dinnar is now known as Thalass |
11:10 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code |
11:10 | | mode/#code [+o himi] by ChanServ |
11:10 | | Rhamphoryncus [rhamph@Nightstar-948421b4.abhsia.telus.net] has quit [Client exited] |
11:49 | | Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving] |
12:03 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds] |
12:16 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code |
12:16 | | mode/#code [+o himi] by ChanServ |
12:53 | | Pandemic [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code |
12:53 | | mode/#code [+o Pandemic] by ChanServ |
13:48 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds] |
13:48 | | gnolam [lenin@Nightstar-b2aa51c5.cust.bredbandsbolaget.se] has quit [Client closed the connection] |
13:50 | | gnolam [lenin@Nightstar-b2aa51c5.cust.bredbandsbolaget.se] has joined #code |
13:50 | | mode/#code [+o gnolam] by ChanServ |
14:01 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code |
14:01 | | mode/#code [+o himi] by ChanServ |
14:28 | | ^Xires is now known as Xires |
15:03 | | Courage [Moltare@583787.FF2A18.190FE2.4D81A1] has quit [Ping timeout: 121 seconds] |
15:03 | | Courage [Moltare@583787.FF2A18.190FE2.4D81A1] has joined #code |
15:03 | | mode/#code [+o Courage] by ChanServ |
15:15 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds] |
15:16 | | gnolam [lenin@Nightstar-b2aa51c5.cust.bredbandsbolaget.se] has quit [[NS] Quit: Das Reboot] |
15:20 | | gnolam [lenin@Nightstar-b2aa51c5.cust.bredbandsbolaget.se] has joined #code |
15:21 | | mode/#code [+o gnolam] by ChanServ |
15:29 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code |
15:29 | | mode/#code [+o himi] by ChanServ |
15:36 | | ToxicFrog is now known as ToxicFrog|W`rkn |
15:36 | | RichyB [richardb@Nightstar-228a334c.plus.com] has quit [Ping timeout: 121 seconds] |
15:38 | | RichyB [richardb@Nightstar-228a334c.plus.com] has joined #code |
17:24 | | celmin|sleep is now known as celticminstrel |
17:26 | | Turaiel[Offline] is now known as Turaiel |
17:48 | < ErikMesoy> | What am I screwing up if I say "MethodFoo = self.MethodFoo" at the start of a Python class declaration so that I can call MethodFoo without "self"? |
17:49 | < ErikMesoy> | (Or, how should I be doing this? I've been told previously that wishing for implicit class scope on class functions is bad.) |
17:51 | | Thalass is now known as Thalasleep |
17:55 | | Thalasleep [thalass@Nightstar-f97b970e.bigpond.net.au] has quit [Ping timeout: 121 seconds] |
17:56 | | Syk is now known as syksleep |
17:56 | <@Azash> | I'm no fancy big town Python user, but it seems to me that you're basically saying "assign the value of x to x" |
17:57 | < syksleep> | ErikMesoy: ??? you don't need to call it with self |
17:57 | < syksleep> | it's implied |
17:57 | | Turaiel is now known as Turaiel[Offline] |
17:57 | < ErikMesoy> | syksleep: when calling a class method from within the class, I do need to say self |
17:57 | < syksleep> | well then... use self? |
17:57 | < syksleep> | that's why it's there? |
17:58 | < syksleep> | then you're referring to that instance, rather than the object |
17:59 | < ErikMesoy> | instance? object? I am talking about methods |
18:00 | <@froztbyte> | post a scce |
18:01 | <@froztbyte> | (self-contained complete example) |
18:03 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds] |
18:09 | < ErikMesoy> | http://pastebin.starforge.co.uk/557 |
18:15 | <@froztbyte> | change self.Text to surround the text with """ """ |
18:16 | <@froztbyte> | then you can do """NPC Bob encountered. |
18:16 | <@froztbyte> | What do you want to talk to Bob about? |
18:16 | <@froztbyte> | """ |
18:16 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code |
18:16 | | mode/#code [+o himi] by ChanServ |
18:17 | < ErikMesoy> | This sounds like stylistic disagreement. |
18:17 | <@froztbyte> | no, that's just the proper way of doing multi-line strings |
18:17 | <@froztbyte> | as to what you're actually doing |
18:17 | <@froztbyte> | why are you doing it this way? |
18:19 | < ErikMesoy> | Because I don't know how to save myself large amounts of self. in front of Option for all the choices in a dialogue branch. |
18:22 | <@froztbyte> | I mean, why are you putting everything into a method? |
18:23 | < ErikMesoy> | Because I waffled around in trying objects once and it got messy and now I'm trying methods. |
18:24 | <@froztbyte> | this could possibly be better solved with using an in-object tree-dict structure, but there might be a requirement I'm unaware of, thus me asking |
18:25 | <@froztbyte> | because this code, at present, is a bit weird |
18:25 | <@froztbyte> | also you don't have an init function so your maintext will always be that not-initialized |
18:25 | < ErikMesoy> | I'd be happy to hear your suggestion for a tree-dict structure. The big requirements I'm aware of are 1) should be scalable, which is where my previous attempt with objects failed, and 2) some dialogue branches should only be conditionally available if certain flags are set |
18:25 | < ErikMesoy> | this code is weird because I stripped it out of context |
18:25 | < ErikMesoy> | scce |
18:26 | <@froztbyte> | alrighty |
18:26 | < ErikMesoy> | The original file has an init function and several more dialogue options and doesn't print "bound method" crap to screen |
18:26 | <@froztbyte> | so as far as I can tell, you want a general-purpose class to use as a node in a conversation tree? |
18:27 | <@froztbyte> | or, rather |
18:27 | < ErikMesoy> | I don't require a class. I want a general-purpose way of writing conversation nodes and trees that scales well and is easily readable |
18:27 | <@froztbyte> | okay |
18:27 | < ErikMesoy> | I am trying to learn the *principle* of the thing so that I can easily backfill with lots of content later |
18:38 | < ErikMesoy> | Starting to consider a mini-DSL and parser for conversations. |
18:41 | < ErikMesoy> | Will I then have two problems? :p |
18:48 | <@celticminstrel> | self does not exist in the class scope. |
18:48 | <@celticminstrel> | If you wanted to do that, it would have to be in the scope of each method. |
18:48 | <@celticminstrel> | So probably not worth it. |
18:49 | <@celticminstrel> | I agree on using """ """ for self.Text, because as I recall that would mean you don't need the \n\. |
18:49 | < ErikMesoy> | put Option in the scope of a supermethod, have the individual dialogue branches inherit from that method? >_> |
18:50 | <@celticminstrel> | Huh? |
18:51 | <@froztbyte> | http://slexy.org/view/s2PQqss8Xz |
18:51 | < ErikMesoy> | Speculating. AFAIK you can't make submethods like subclasses. |
18:51 | <@froztbyte> | is more like what I have in mind |
18:52 | <@celticminstrel> | Also froztbyte, __call__ is not called when a class is constructed... so MainText won't be set to the uninitialized value. |
18:52 | <@froztbyte> | you instantiate it with NPC(introduction='asdkjaksdjlasd', replies={'dict':'of options'}, options=['initial', 'list']) |
18:52 | <@froztbyte> | and then just go ahead |
18:52 | <@froztbyte> | celticminstrel: yes, I know |
18:52 | <@froztbyte> | celticminstrel: when it is called it will |
18:52 | <@celticminstrel> | Like NPC()(), yes. |
18:52 | <@froztbyte> | celticminstrel: that entire codeblock just strikes me as a really weird way to get things done |
18:53 | <@froztbyte> | and I'm wondering whether that's actually a valid way of working in another language |
18:54 | <@froztbyte> | ErikMesoy: so uh, in my example |
18:54 | <@froztbyte> | options is a list of things your NPC will give you |
18:54 | <@froztbyte> | replies is what you'll get when you choose one |
18:55 | < ErikMesoy> | and the external access function has to alternate between asking for them? |
18:55 | <@froztbyte> | replies being a dict, so you can use the name of things to glue them together |
18:55 | <@froztbyte> | ErikMesoy: no, you can trick that a bit too |
18:55 | <@froztbyte> | ErikMesoy: what I would do is have a two-part thing in each reply, like so: |
18:56 | <@froztbyte> | replies['apples?'] = {'response': 'yes, there are apples', 'nextStep' = thingy} |
18:56 | <@froztbyte> | where thingy is your progression step for that part of the conversation |
18:57 | <@froztbyte> | now how you actually end up managing all this data is the next problem, since you'll probably want a thing that can look stuff up in a DB or file or whatever |
18:59 | <@froztbyte> | ErikMesoy: does this make sense to you? |
19:02 | < ErikMesoy> | I'm not seeing how you match together a) a dialogue branch's text, b) the future branches available from there, c) the descriptions of what branches are available |
19:04 | < ErikMesoy> | (also you waffle on options=[] and options={}. typo?) |
19:05 | <@froztbyte> | err, yes, typo |
19:05 | <@froztbyte> | sorry, lemme get you an example quickly |
19:09 | | * ErikMesoy considers this from another angle. |
19:10 | < ErikMesoy> | Maybe I should just practice writing "self." and consider it as a good habit rather than a problem to solve. |
19:11 | <@celticminstrel> | Yeah, there's that. |
19:12 | | * celticminstrel tries to think of a language other than Java and C++ where it's optional... |
19:12 | <@froztbyte> | goddammit |
19:12 | <@froztbyte> | notepad++ fails hard at getting python right (by default) |
19:13 | <@froztbyte> | (I'm on windows atm) |
19:13 | < ErikMesoy> | huh? notepad++ python mode has been fine for me on windows, albeit differently colored from IDLE |
19:13 | <@celticminstrel> | JavaScript requires you to use this, though it's not an explicit argument... |
19:14 | <@celticminstrel> | I think Lua requires the use of self...? |
19:14 | <@froztbyte> | I wrote some code in an ipython prompt (via ssh), copied into notepad++ |
19:14 | <@froztbyte> | and it's now terribly confused |
19:18 | <@froztbyte> | ErikMesoy: http://slexy.org/raw/s2cpTEgDZ1 |
19:18 | < ErikMesoy> | ah, subdict |
19:19 | <@froztbyte> | outsideResults and outsideOptions are both just quick made-up items for our conversation database |
19:19 | <@froztbyte> | as it stands there, you'd then take one of the options you printed out as input, look it up in replies |
19:19 | <@froztbyte> | it's 'next' value can then tell you which next tree node to go to |
19:19 | < ErikMesoy> | I will definitely throw a bunch of linebreaks into the dictdict for readability if I use this when writing longer conversations, but it looks pretty good |
19:20 | <@froztbyte> | then you just need to make a thing elsewhere for fetching from your tree db |
19:20 | <@froztbyte> | but that's the general thing you want |
19:20 | <@froztbyte> | or at least, that's the least-painful general thing you want ;) |
19:21 | <@froztbyte> | ErikMesoy: does it make sense now? |
19:21 | < ErikMesoy> | Yes. |
19:21 | <@froztbyte> | cool |
19:21 | <@froztbyte> | as a matter of curiousity, how did you end up with the structure as you had it first? |
19:21 | <@froztbyte> | were you drawing on another language as reference, or just banging an idea out? |
19:22 | < ErikMesoy> | Mostly banging an implementation out, vaguely inspired by the conversation DSL for a game in Visual Basic (conversations were stored in plaintext files and easily user-moddable) |
20:08 | < RichyB> | I think that there's no better demonstration of the fact that *not* putting "self." or "this->" or "@" or some other sigil in front of member fields is a terrible idea than the sheer quantity of C++-using organisations who have standardised on a sigil themselves and will reject any code with member variables that don't start "m_". |
20:12 | < RichyB> | Hahaha. The Fedora 19 release is codenamed "Schr?dinger's Cat" and now they're discovering that a whole bunch of shell scripts shit themselves over the utf-8. |
20:12 | < RichyB> | http://lwn.net/Articles/545741/ |
20:20 | | celmin [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code |
20:20 | | mode/#code [+o celmin] by ChanServ |
20:22 | | celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has quit [Ping timeout: 121 seconds] |
20:22 | | celmin is now known as celticminstrel |
20:24 | <@celticminstrel> | ...forgot to ghost. >_> |
20:24 | <@celticminstrel> | I wish my client would do that automatically... |
21:12 | | * Pandemic hands clticminstrel a shell script |
21:13 | | * Dog replaces Pandemic with a shell script. |
21:20 | | * Pandemic is an RNA plague, good luck with that |
21:20 | | * Pandemic infects Dog |
21:20 | < ErikMesoy> | Then how are you handing anyone anything? :V |
21:20 | <@Pandemic> | same way all us plagues do, with some one else's arm... |
21:21 | | Dog is now known as DeadDog |
21:22 | | Turaiel[Offline] is now known as Turaiel |
21:26 | | Kindamoody|autojoin is now known as Kindamoody |
21:48 | | Kindamoody is now known as Kindamoody[zZz] |
21:51 | < ErikMesoy> | froztbyte: Implementing your dictdict is doing marvels for the readability of a nontrivial dialogue tree, but how would you do conditionally appearing elements? So far I can only figure out how to do elements whose result varies on a condition, but not elements whose very presence is conditional. |
21:53 | <@froztbyte> | how do you mean? |
21:54 | < ErikMesoy> | In my old code I would have done Option(stuff); if Charisma>15:Option(bluff); etc |
21:54 | <@Pandemic> | if(this.isthere() do x, esle do y) kind of thing? |
21:54 | < ErikMesoy> | How would you do if (condition): key-value pair appears in dict? |
21:55 | <@froztbyte> | I would do that outside of this |
21:55 | <@froztbyte> | in the part of the application where you select things for your conversation tree |
21:56 | <@froztbyte> | so the chain would look roughly like: getCurrentConversationOpts(reference) -> filter(conditions, reference) -> NPC(unpack(previousThings)) |
21:56 | < ErikMesoy> | So outside the NPC, you would have a filter that knows about NPC dialogue branches and filters them? |
21:56 | <@froztbyte> | (you could write that inversely as generator-driven stuff, too, but I wouldn't do it before you have the rest working) |
21:56 | < ErikMesoy> | I'm not sure what you mean, because that sounds clunky |
21:56 | <@froztbyte> | ErikMesoy: indeed |
21:57 | < ErikMesoy> | What sort of marker would you have on the dialogue branches? |
21:57 | <@froztbyte> | well, it depends on how the rest of your code is atm |
21:57 | <@froztbyte> | ErikMesoy: locations (what room you're in, that sort of thing), possibly item requirements, ... ? |
21:57 | < ErikMesoy> | No, I mean, what sort of marker would the outside part look for? |
21:58 | <@froztbyte> | oh |
21:58 | < ErikMesoy> | The rest of my code is mostly separate modules like the GUI, the character sheet and stat handler, etc |
21:58 | <@froztbyte> | well, let's run with your charisma example |
21:59 | <@froztbyte> | in that case I'd have something like the following: |
21:59 | < ErikMesoy> | My NPC dialogue code has been scrapped and rewritten so many times that I've gotten very good at giving it a modular interface where the rest of the code just expects to get something it can print to screen. :) |
22:01 | <@froztbyte> | currentOptions = getOptsFromDB(refPreviousOption) |
22:01 | <@froztbyte> | filteredOptions = conversationFilter(playerInfo, currentOptions) |
22:01 | <@froztbyte> | then, in conversationFilter, I'd toy with dicts again |
22:01 | <@froztbyte> | give me a moment to get an example |
22:03 | <@froztbyte> | this is transform code I use in zenoss to direct some syslog events from a very noisy ASA: http://slexy.org/raw/s20azIArDW |
22:03 | <@froztbyte> | I could have a gigantic if-else block, or that |
22:04 | <@froztbyte> | what it does is have a list of dicts, each dict has 'regex', 'action', and 'eventclass' |
22:04 | <@froztbyte> | regex is used to match the incoming text, action and eventclass give me what I want to apply to the event info |
22:05 | <@froztbyte> | so you could use a similar lookup mechanic in your filter method |
22:05 | <@froztbyte> | pass playerInfo in as a dict or so, run through the things, specify boundaries based on some method, and then action accordingly |
22:06 | <@froztbyte> | does that makes sense? |
22:07 | < ErikMesoy> | What I still wonder: how does conversationFilter know what to look for? or what is it looking for? where do I put the marker that says "this option is not selectable with Cha<16" ? In your previous example, which of {'apples': {'response': 'correct', 'next': None}} do I edit? |
22:07 | < ErikMesoy> | {'apples_int10'} ? |
22:08 | <@froztbyte> | something like this, perhaps: {'apples': {'response': 'correct', 'next': None, 'limits': {'charisma': '>17'}}} |
22:08 | <@froztbyte> | (although not that *exact* form, because that'd be a pain in the arse to deal with) |
22:09 | < ErikMesoy> | Yeah, that's my problem. It keeps looking like a pain in the arse HOWEVER I envision it. :p |
22:09 | <@froztbyte> | {'apples': {'response': 'correct', 'next': None, 'limits': {'min': {'charisma': '>17'}}}} |
22:09 | <@froztbyte> | ;D |
22:09 | <@froztbyte> | it does get a bit hairy though, yes |
22:09 | <@froztbyte> | nonetheless, it should work reasonably well |
22:10 | <@froztbyte> | err, that was wrong |
22:10 | <@froztbyte> | {'apples': {'response': 'correct', 'next': None, 'limits': {'min': {'charisma': '17'}}}} |
22:10 | <@froztbyte> | that |
22:10 | <@froztbyte> | that all said, I haven't ever had to write a capability system like this before, though, so I'm really just making this solution up as I go ;) |
22:23 | < ErikMesoy> | {'apples': {'response': 'correct', 'next': None, 'limits' : [cha>17, QuestFlags.LearnedAboutRuins]}} and then eval() on the limits? |
22:24 | < ErikMesoy> | There has got to be a less hairy way of doing this that doesn't involve a DSL. But I can't think of it now. |
22:24 | | ErikMesoy is now known as ErikMesoy|sleep |
22:24 | <@froztbyte> | I wouldn't eval |
22:24 | <@froztbyte> | but something like that could work |
22:29 | < ErikMesoy|sleep> | I have a vague feeling I'm doing something wrong with dictdicts, but I suppose they're preferable to creating a new sort of one-key-four-values type at my skill level |
22:36 | <@froztbyte> | I'm fairly certain that your overall code will evolve in time |
22:36 | <@froztbyte> | but I like dicts |
22:36 | <@froztbyte> | they make it less hard to do off-by-one errors, and maintain pretty good readability on named parameters and such |
22:55 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds] |
23:08 | <&McMartin> | I like dicts more than I like objects |
23:09 | <@froztbyte> | objects are composed out of dicts |
23:09 | <@froztbyte> | in some ways that matter |
23:09 | <@froztbyte> | but yeah |
23:09 | <&McMartin> | Bag of salted dicts |
23:09 | <@froztbyte> | dicts are really nice |
23:09 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code |
23:09 | | mode/#code [+o himi] by ChanServ |
23:09 | <@froztbyte> | and I'm probably guilty of dict abuse |
23:09 | <@froztbyte> | but it works. |
23:09 | <@froztbyte> | McMartin: hah |
23:10 | <@froztbyte> | also, I realize that I derped a sentence earlier, and that's what happens if you type on IRc while hunting for rootkits on client servers |
23:10 | <@froztbyte> | dicts make it harder to do off-by-one errors* |
23:11 | <&McMartin> | Hee, I totally skimmed over that as what you meant. |
23:11 | <&McMartin> | Argh, now no two modules are not on fire |
23:11 | <&McMartin> | Hopefully after this it will be no *three* modules that are not on fire |
23:14 | <@froztbyte> | haha |
23:19 | | VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code |
23:19 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds] |
23:24 | | cpux [cpux@Nightstar-98762b0f.dyn.optonline.net] has joined #code |
23:24 | | mode/#code [+o cpux] by ChanServ |
23:24 | | Orthia [orthianz@3CF3A5.E1CD01.B089B9.1E14D1] has joined #code |
23:24 | | mode/#code [+o Orthia] by ChanServ |
23:34 | | Turaiel is now known as Turaiel[Offline] |
23:35 | | Turaiel[Offline] is now known as Turaiel |
23:48 | | Vorntastic [Vorn@Nightstar-221158c7.sd.cox.net] has joined #code |
--- Log closed Fri Apr 12 00:00:22 2013 |