Being new to C++, I used the OSW API to get a string from Lua and send it. If it is nil, then it sends nothing.
[img]http://i.imgur.com/R6qeCM2.png[/img]
So if you didn't know, a while back I built this little Ai that mimics what you say and prints something that belongs to what you said, here's how it works
"My name is Poop"
____"Nice to meet you, Poop"
____"What's up Poop ?"
____"How are you doing, Poop ?"
"How are you ?"
____"I'm fine, thanks"
____"I'm doing alright, thanks"
and so on..
I made it have some initial knowledge from inside the code but I thought it was too lame, so instead I built my own Json table which you can check out [URL="http://limespot.net/api/database.txt"]here[/URL]. Now, why is this useful ? Well, if multiple people have this, I can just update the table instead of people having to download a new version.
[B]Screeniess[/B]
[IMG]http://puu.sh/2jhwq[/IMG]
[B]This is a normal conversation, nothing new learned.[/B]
[IMG]http://puu.sh/2jhPq[/IMG]
[B]In this one, I teach it something new.[/B]
[IMG]http://puu.sh/2jhRG[/IMG]
[B]And now it mimics it back when I ask again.[/B]
[IMG]http://puu.sh/2jhRO[/IMG]
So, if I ever get to have a big enough database, people can have a "normal" conversation.
Also, once you close it, it saves the conversation for future usage, here's how it looks.
How are you ?:I'm fine
What is your name ?:Feez
:Hello
Hello:What is your name ?
I'm fine:Glad to hear that
How are you doing ?:I'm fine
What's up:Not much, you ?
Hello:Hello
Glad to hear that:Thanks
Thanks:What's up ?
Not much either:Alright
Feez:How are you ?
I'm fine:Glad to hear that
Hi:Hi
[QUOTE=cartman300;39945141]Nice, luainterface is nice but i recommend you people [URL="http://dynamiclua.codeplex.com/"]dynamiclua[/URL], it's built upon luainterface.[/QUOTE]
Saying "use X" and giving the only reason as "it's built on Y" doesn't really provide much motivation, can you explain why you recommend it?
[QUOTE=cartman300;39945141]Nice, luainterface is nice but i recommend you people [URL="http://dynamiclua.codeplex.com/"]dynamiclua[/URL], it's built upon luainterface.[/QUOTE]
I tried it out, but afaik i can't call the Lua.NewTable and GetTable methods, or can i? :v:
I also can't get or set global variables to a name that i only know at runtime. (afaik atleast)
[B]Sorry for spamming this thread.[/B]
I've updated some of the graphics, much nicer now imo.
[IMG]http://puu.sh/2jkFc[/IMG]
[IMG]http://puu.sh/2jkGA[/IMG]
[IMG]http://puu.sh/2jkGg[/IMG]
[IMG]http://puu.sh/2jkG6[/IMG]
[IMG]http://puu.sh/2jkFP[/IMG]
Yay, commands!
_brain_help - displays all possible commands,
_brain_print - re-prints the current chatlog,
_brain_wash - cleans the chatlog & database
I've updated the [URL="http://limespot.net/api/database.txt"]database[/URL]
[QUOTE=Chris220;39945498]Saying "use X" and giving the only reason as "it's built on Y" doesn't really provide much motivation, can you explain why you recommend it?[/QUOTE]
I recommend it only because i think it's nice. You guys can still look at the website and decide if you want to use it or no. I posted it here because it's always nice to have some more info/choice.
[QUOTE=Dj-J3;39945539]I tried it out, but afaik i can't call the Lua.NewTable and GetTable methods, or can i? :v:
I also can't get or set global variables to a name that i only know at runtime. (afaik atleast)[/QUOTE]
You can create new table like this lua("a={}");
Setting global variable lua.variable = value
Setting global variable if you know name at runtime lua["variable"] = value
Also there's NewTable function somewhere, i forgot it's exact location.
[editline]17th March 2013[/editline]
[IMG]http://puu.sh/2jnAc[/IMG]
Been porting LimeAssembly to my _boot operating system.
LimeAssembly is my Lime#'s VM "assembler", it's the language to what Lime# compiles.
Next thing i'm gonna do is real x86 assembler interpreter.
[QUOTE=McDunkable;39946528][B]Sorry for spamming this thread.[/B]
I've updated some of the graphics, much nicer now imo.
*pictures*
Yay, commands!
_brain_help - displays all possible commands,
_brain_print - re-prints the current chatlog,
_brain_wash - cleans the chatlog & database
I've updated the [URL="http://limespot.net/api/database.txt"]database[/URL][/QUOTE]
How exact do you have to be to match an entry in the database? Does it match lowercase/uppercase? Also, what does it say if it couldn't find a match?
Instead of writing this...
[CODE]
push "Hello World!"
call print
[/CODE]
I can now write this!
[CODE]
call print "Hello World!"
[/CODE]
I get excited by the weirdest things.
[QUOTE=Z_guy;39947712]How exact do you have to be to match an entry in the database? Does it match lowercase/uppercase? Also, what does it say if it couldn't find a match?[/QUOTE]
The string is made lowercase once you hit enter. If the string doesn't match then it turns red and it will store whatever you say after, for example.
"What is my name ?"
Now it will repeat "What is my name ?" because it couldn't find anything that matches it, all text turns red meaning it is now learning. So if you were to type "McDunkin", the next time you write "What is my name ?" it will reply with McDunkin. If there are multiple entries for "What is my name ?" then it will just randomize the choice.
"> What is my name ?"
"< McDunkin"
Here's another example...
[IMG]http://puu.sh/2jkGA[/IMG]
"I bet you can't understand this!
As I mentioned before, this has another local database where it saves what you've taught it. The database that is online is just some initial knowledge so you don't have to teach it from scratch.
[code]"What is the meaning of life ?": "42",[/code]
FTFY
[editline]17th March 2013[/editline]
Also, you don't spam the thread as long as you post actual content.
[editline]17th March 2013[/editline]
And I realized today that it'd been too long since I worked on my Android app, so I decided to check how the PHP backend of my app was, and I found a fault that I had when I last worked on it, that my PHP script for some reason can't get the attributes of an <value> element. Which broke a lot of my code, since I had relied on info in the attributes, like date, hour and unit. So most of my day has been changing my code to work with the loss of that information.
Next, I realized that my AsyncTask wasn't able to take in any additional info other than the url, and that it'd be a lot better to have different types of requests, defined in the AsyncTask, rather than to pass it an URL. This broke all my views except from the first one, which I had already modified to work with the changes. But it paid off in the end.
[t]http://dl.dropbox.com/u/7644905/2013-03-17%2021.26.40.png[/t]
What you're looking at here, is my app loading some real life data, complete with the closest station and its latest reading. Loaded straight from my webserver. Now I just have to implement the loading of a list of the latest readings and the stations. Still got about a month left untill the competition ends, though.
[editline]17th March 2013[/editline]
I've gotta be the worst host, I had a friend over and I kept working on my app the entire time he was here. But I got him kinda interested in programming again, though!
[sp]I talked to him and helped him cut his hair though, I didn't completely ignore him[/sp]
[QUOTE=Gulen;39948475][code]"What is the meaning of life ?": "42",[/code][/QUOTE]
42 is not the meaning of life, 42 is the answer to the ultimate question of life, the universe and everything. There is a difference. ;)
Woo, managed to find a way to check what the sentence was, for example, when you submit a response, it will check for these: "!", "?", ".", then it will come up with a somewhat appropriate response, now... since I don't want it to think "My! cat! is! on! fire" was exclamatory, instead it will only check for it at the end of the whole response for example.. "Ipoopmypantserrnight!" is exclamatory, and so is "Ipoopmypantserrnight !" and so on, even this: "Ipoopmypantserrnight !", Will post some screenies later.
Now the server only sends files that the client doesn't already have in the cache, or a local file with matching name and hash. (which can be spoofed but not sure how to "fix" that.)
[IMG]http://frameaway.org/ftp/ShareX/2013-03-17_22-06-46.png[/IMG]
So it's been a while since I've posted what I've been working on. For the past month or so, I've been writing a unit testing framework for C++11 that is inspired from python's unittest module, with an emphasis on using absolutely no preprocessor macros. Coincidentally, the library is named 'unittest'. Another focus for the library is absolutely no inheritance whatsoever. You don't inherit from a test, then manually register your steps. Instead you do this:
[cpp]
#include <unittest/unittest.hpp>
auto main () -> int {
using namespace unittest;
test("my-test") = {
task("assert-equal") = [] {
self.assert_equal(1, 2, "optional message");
self.assert_throws<my_exception_type>([]{throw my_exception_type;});
},
task("fails") = [] { self.fail(); },
task("skip") = skip("always-skip") = [] { self.fail(); }
};
run();
}
[/cpp]
I'm gearing up for a 1.0 release (all that's needed is to finish the tutorial in the documentation at this point). You can find the documentation [url=http://unittest.rtfd.org]here[/url] (please note I'm running into some issues with the source for it, so it's not actually showing everything. It's all been written sans the tutorial however) and the actual library [url=https://github.com/mnmlstc/unittest]here[/url]. Just a brief note, this framework assumes you'll be using cmake and ctest. I don't have any interest in supporting [del]inferior[/del] other build systems. Additionally, you need at a minimum gcc 4.7.2 or clang 3.1-ish (whichever custom version came with XCode 6 months ago). Visual Studio support is pretty close. Once they release an actual proper update instead of the CTP, it should theoretically work (And I will be making a minor release once I can enforce it).
My algorithm works quite good now.
The pink lines are the faces outlined:
[t]https://dl.dropbox.com/u/41041550/Coding/C%23/OGLFV/faces.PNG[/t]
It takes a little bit longer to build the chunk for GPU upload, but what I gain in render speed makes it worth it.
That little hex editor's working quite nicely, so I've put a quick front panel interface together and linked in a VM:
[img]http://i.imgur.com/54c6ENA.png[/img]
Wooo :v:
[QUOTE=Chris220;39948899]42 is not the meaning of life, 42 is the answer to the ultimate question of life, the universe and everything. There is a difference. ;)[/QUOTE]
life is a terminal disease contracted at birth
on topic, I'm up to problem 18 in project euler, but I had to skip 16 because lua sucks with big numbers and I'm too lazy to install a module for it
I've got the first parts networking done
[t]http://puu.sh/2jxTg[/t]
Some things ended up simpler than I expected, some things were more complicated. As you might be able to tell from the picture, not much is synchronized yet, but I think I've figured out how I'm going to do it.
Turns out microsoft stores passwords in plaintext.
A while back I thought of and wrote something I call hooktables, which are basically a simple way to deal with lua's __index and __newindex table stuff. Using this I make a data table in every entity, and when it's changed on the server it sends a message to every client to do update theirs.
[editline]17th March 2013[/editline]
The only issue with this is that I have to watch for infinitely recursive loops
[editline]17th March 2013[/editline]
Okay now I'm getting errors when I make a .love that don't happen when I run it through sublime
posted this in electrical but it's programming related too (and I'm shamelessly trying to get as much feedback as possible so here!)
Just finished my Keypad Security Lock project, which I've been working on and off with a break in the middle for the past few weeks now. Held together with sticky pads and hookup wire, I present my latest creation:
[media]http://www.youtube.com/watch?v=YtwQJi1Ke7s[/media]
(excuse the shoddy camera angles, it's tricky to hold the camera and type when the keypad is on the other side of the door!)
Components:
ATmega 328p
Strip board
ABS housing
Full rotation servo (why did I get a full rotation one...)
Reed switch and magnet pair (to accommodate for the stupid decision above)
3x4 matrixed keypad (Internal circuit: [url]http://www.rapidonline.com/pdf/78-0305.pdf[/url])
240v -> 0.7A 5v mains transformer
ribbon cable, hookup wire, resistors, etc.
So, the software side is actually pretty straightforward. I'm using a matrix keypad, so I just use a scanning method to set the columns high, and check if any input is high, and infer which key is pressed depending on which output/input pair is high. You can see that in the source code
Beyond that, it's just some PWM to change the speed and direction of the servo, an array to store the password, a bit of serial debugging using a serial class I made for an earlier project, and some reed switch feedback.
The overall program is essentially "check the sequence of input buttons is correct, if so turn the servo for 170ms" while it's unlocked and "do the same but only turn the servo the other way until the reed switch is active, then stop" when it's in the locked state. I do plan to add on-the-fly password changing so when my housemates figure out the password I can change it without taking it apart. But I have to take it apart to add that feature because I didn't make a programming port :v:
The hardware side was an absolute pain in the ass. The ABS box needed to house the servo, so I had to cut out a hole using just a strip board track cutter because I left all my tools at home (I'm currently at my house at Uni). I ended up cutting a rough rectangle by making numerous holes, then sanding it down to make it look acceptable. The hardest part was hooking up to the pre-existing lock, which I could not modify because I'm renting this house and didn't really want to fix it back up when I moved out/got tired of this lock. So, I opted for hookup wire (I know...) and looped it around the grub screw on the shaft of the lock. It actually worked surprisingly well, and I could thread it through the servos arm holes. On top of this, I needed to ensure the lock didn't turn too much (because the lock eventually goes over a "click" which requires too much force than the servo can handle to go back over), and that the servo could turn the lock enough wherever it was positioned. Oh and the reed switch needed to be positioned enough so that the timed reversal/unlocking of the door was just right (trial and error!). I really should have bought a standard 270 degrees servo, so I could choose the angle and not have to worry about feedback.
Surprisingly, the switches were happy without debouncing. Perhaps that's done in the keypad, it isn't really specified in the datasheet.
So anyway, source code for those interested: [url]http://pastebin.com/tvfxuV92[/url]
I wonder how long til' it falls apart and I get locked outside!
[IMG_THUMB]http://i.minus.com/iqyvjXhSlik0F.png[/IMG_THUMB]
I quite liked the idea of C# bindings for Source so I started my own. Unfortunately the Mono API is somewhat limited and I can only have 1 VM on the client, which means I can't end it when you leave a server, which poses another issue. Instead I've made it so that each plugin is in an AppDomain and they can be unloaded, which puts you in a different world of pain since to share anything between AppDomains requires some form of serialization. It does however make it quite flexible, I'm just not sure how more complex things are going to work...
Tried some more stuff with my music player but I didn't get really far. I did update the UI. Looks like this atm [img]http://i.solidfiles.net/8e4a61c166.png[/img]
Well because I wasn't thinking about creating player entities I accidentally synced the local player as the client player, and haven't added client control stuff yet so the client is a powerless spectator
[QUOTE=sparky28000;39950828]Tried some more stuff with my music player but I didn't get really far. I did update the UI. Looks like this atm [img]http://i.solidfiles.net/8e4a61c166.png[/img][/QUOTE]
What happens when the album art is white
[QUOTE=TrafficMan;39950888]What happens when the album art is white[/QUOTE]
The text and button will blend in with the album art:v:. But the whole program really is just to learn how to use SDL and some other libraries.
There's a type cast error somewhere in explorer.exe :v:
[img]https://dl.dropbox.com/u/5013896/forum/Facepunch/Programming%20WAYWO/3.2013/2013-03-18_03-04-32.png[/img]
Dokan.NET is surprisingly easy to use, I really hope I can get this project off the ground.
[img]http://puu.sh/2jE4E[/img]
I got this little console application running using my LimeAssembly
Here's the source
[url]http://puu.sh/2jE5t[/url]
[QUOTE=sparky28000;39950941]The text and button will blend in with the album art:v:. But the whole program really is just to learn how to use SDL and some other libraries.[/QUOTE]
Make the text and button the opposite of the color behind it.
[QUOTE=Bumrang;39952791]Make the text and button the opposite of the color behind it.[/QUOTE]
I think average hue of the whole image + 180 would work better
[editline]17th March 2013[/editline]
I've got player movement networked really shittily, what's annoying is that the hoster moves really well for himself and everyone else, but clients move weirdly for themselves and really well for the hoster
Sorry, you need to Log In to post a reply to this thread.