• What are you working on? V10
    2,002 replies, posted
Thanks to the person that clarified the stuff for division in RPN, you have to do it for subtraction as well. I have functions working now. This is fun! [code] Input : 9.7 ceil Answer: 10.0 [/code]
I've been working on a steam bot using OSW and Lua, mostly just to learn scripting and integrating. [img]http://ace.saxservers.net/stuff/SteamBot.gif[/img] The Magic 8-Ball plugin: [lua]local PLUGIN = CreatePlugin("Magic 8-Ball", "Lets people play with a Magic 8-Ball") PLUGIN.Responses = { "As I see it, yes", "It is certain", "It is decidedly so", "Most likely", "Outlook good", "Signs point to yes", "Without a doubt", "Yes", "Yes - definitely", "You may rely on it", "Reply hazy, try again", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful" } PLUGIN.Hooks = { OnGroupMessageRecieved = "GMessageRecieved", OnFriendMessageRecieved = "MessageRecieved", OnGroupMessageSent = "GMessageSent", OnFriendMessageSent = "MessageRecieved" } function PLUGIN.MessageRecieved(sender, chatid, msgtype, message) response = PLUGIN.CheckMessage(msgtype,message) if response == nil then return end Steam.SendChatMessage(sender,1,"The Magic 8-Ball says: " .. response .. "!") end function PLUGIN.GMessageRecieved(sender, reciever, chatid, msgtype, message) response = PLUGIN.CheckMessage(msgtype,message) if response == nil then return end Steam.SendGroupMessage(reciever,1,"The Magic 8-Ball says: " .. response .. "!") end function PLUGIN.GMessageSent(reciever, chatid, msgtype, message) response = PLUGIN.CheckMessage(msgtype,message) if response == nil then return end Steam.SendGroupMessage(reciever,1,"The Magic 8-Ball says: " .. response .. "!") end function PLUGIN.CheckMessage(msgtype, message) if msgtype == "ChatMsg" then if string.find(string.lower(message),"8-ball:") then if string.find(message,"?") then response = PLUGIN.Responses[math.random(#PLUGIN.Responses)] return response end end end return nil end PLUGIN:Register()[/lua] You can download it here: [url=http://ace.saxservers.net/stuff/SteamBot.rar]Download[/url] If it crashes and creates an error log then please send the log to me.
[QUOTE=ace13;22216066] [lua] if string.find(string.lower(message),"8-ball:") then if string.find(message,"?") then[/lua][/QUOTE] [lua]if message:lower():find("8-ball:") and message:find("?") then[/lua]
[QUOTE=thelinx;22216133][lua]if message:lower():find("8-ball:") and message:find("?") then[/lua][/QUOTE] [lua]if message:lower():find("^8-ball:.+?$") then[/lua] (You might have to escape that ? with % regardless, though)
[QUOTE=jA_cOp;22216914][lua]if message:lower():find("^8-ball:.+?$") then[/lua] (You might have to escape that ? with % regardless, though)[/QUOTE] [lua]if message:lower():find("^8%-ball:.+?$") then[/lua] [editline]07:18PM[/editline] You have to escape the '-'. [editline]07:18PM[/editline] For some reason you don't need to escape the '?'.
[QUOTE=jA_cOp;22216914][lua]if message:lower():find("^8-ball:.+?$") then[/lua] (You might have to escape that ? with % regardless, though)[/QUOTE] I totally knew there was a way to do that but expressions always manage to fuck with my mind. This post does totally not deserve king of page. Rate me gay.
[QUOTE=MakeR;22216976] For some reason you don't need to escape the '?'.[/QUOTE] Yeah I remember something like that, but it's undefined, so for the sake of forward compatibility it should be escaped. It's probably because it's not preceded by a character class. [editline]03:21AM[/editline] [QUOTE=thelinx;22216994]I totally knew there was a way to do that but expressions always manage to fuck with my mind. This post does totally not deserve king of page. Rate me gay.[/QUOTE] Lua patterns are actually pretty light-weight compared to regular expressions, you should really look into them, they're more sane than they first appear :v:
I just started learning how to write a boot loader and the compiled result is surprisingly simple: [img]http://dl.dropbox.com/u/2399384/compiledasm.png[/img] However, when compiling for Windows what's all the extra stuff that's always there? Instructions for Windows how to load your application?
[QUOTE=Overv;22217279] However, when compiling for Windows what's all the extra stuff that's always there? Instructions for Windows how to load your application?[/QUOTE] Do you mean the PE32 (.exe and .dll) file format?
[QUOTE=turb_;22211955]I'll listen to your baseless criticism when you post impressive content of your own, until then, get the fuck out.[/QUOTE] [url]http://www.facepunch.com/showpost.php?p=21916914&postcount=449[/url] i've created some sort of fallacy paradox.
[QUOTE=jA_cOp;22217416]Do you mean the PE32 (.exe and .dll) file format?[/QUOTE] Yes.
Making a wordsearch creator [img]http://imgkk.com/i/-8re.png[/img] Spot the "Hezzy". Eventually I will make a nice GUI for it and get it to write to a PNG or even if I am being fancy a PDF
[QUOTE=pondefloor;22217509][url]http://www.facepunch.com/showpost.php?p=21916914&postcount=449[/url] i've created some sort of fallacy paradox.[/QUOTE] this man has a point
[QUOTE=Overv;22217526]Yes.[/QUOTE] The headers contain a lot of metadata about the program. While a flat code file (usually .bin) contains pure code, formats like PE32 and ELF contain entire programs. Data is separate from code, in both read-only and read-write sections. Other sections also exist, like a section for relocation data; code usually contains relative memory addresses, which are converted to virtual memory addresses at load-time, after the process has been allocated and placed in memory. The PE32 headers also contains a section for embedded resources, and a small header at the very start including a code snippet to make it compatible with the old MZ (also .exe) format. If you run a modern PE32 executable under MS-DOS, the aforementioned code snippet is run. Linkers usually just have it print a message like "This program can not run in DOS mode", or similar. The headers also include information about the code itself, like whether or not it's 64-bit, and where the entry point is, and whether it's a console application, windows GUI executable, or DLL. If you want to know more about it, the MSDN documentation is pretty good, and there exists less specific documentation explaining the structure as a whole.
[QUOTE=Overv;22217526]Yes.[/QUOTE] [url]http://en.wikibooks.org/wiki/X86_Disassembly/Windows_Executable_Files[/url]
[QUOTE=Mr. Kobayashi;22217681]Making a wordsearch creator [img]http://imgkk.com/i/-8re.png[/img] Spot the "Hezzy". Eventually I will make a nice GUI for it and get it to write to a PNG or even if I am being fancy a PDF[/QUOTE] Found it! You should probably put grid lines in between the letters. I guess that comes with the gui though.
Porting the whole of my RPG into C# because my language was too goddamn slow at level generation. I can use Lua in C#, which will be much faster and obviously has more functionality than my language. Done resource loading, and was able to make it much more swish due to how I can actually use generics in C# where AS3 only has fake ones for the Vector class. Working on UI now, and got a UIFrame class drawing with any size and border style :3:
Well I finished my quiz [code] #include <cstdio> #include <cstdlib> #include <iostream> #include <cmath> #include <string> //Thank you Supply! using namespace std; string answer; int failure(); // questions int q1(); int q2(); int q3(); int q4(); int q5(); int winzor(); int credits(); int main() { system("cls"); cout << "Greetings! Welcome to the Magical Turnip Quiz show! \n I am your host, Danny! \n *The audience applauds* \n Are you ready for your first question? <y/n>" << endl; cin >> answer; if (answer == "y" || answer == "Y") { system("cls"); cout << "Great! Let's begin! [press enter to continue] \n"; system("pause >Nul"); q1(); } else { system("cls"); cout << "Sorry to hear that. Till next time then."; system("pause >Nul"); return 0; } } int q1() { cout << "First question: Who invented the Cotton Gin? \n"; cin.ignore(numeric_limits<streamsize>::max(), '\n'); getline(cin, answer); if (answer == "eliwhitney" || answer == "Eli Whitney") { system("cls"); cout << "Correct! The Cotton Gin (short for Cotton Engine) was patented on March 14, 1794 by Eli Whitney. \n You move onto the next round! \n <PRESS ENTER TO CONTINUE>"; system("pause >Nul"); q2(); return 0; } else { failure(); } } int q2() { system("cls"); cout << "Okay, here's the second question. True or false: The members of the genus Basiliscus can run on water. <T/F> \n"; cin >> answer; if (answer == "t" || answer == "T") { system("cls"); cout << "Correct! The members of the genus Basiliscus are often refered to as the 'Jesus Christ Lizard.' \n You move onto the next round! \n <PRESS ENTER TO CONTINUE>"; system("pause >Nul"); q3(); return 0; } else { failure(); } } int q3() { system("cls"); cout << "You've been doing good so far, but let's see how you do with question 3! \n Are tomatoes vegitables or fruits? \n"; cin.ignore(numeric_limits<streamsize>::max(), '\n'); getline(cin, answer); if (answer == "fruit" || answer == "Fruit" || answer == "fruits" || answer == "Fruits") { system("cls"); cout << "Right again! The tomato has ovaries, and is therefore a plant botanically. \n Congratulations! You move onto the next round. \n <PRESS ENTER TO CONTINUE>"; system("pause >Nul"); q4(); return 0; } else { failure(); } } int q4() { system("cls"); cout << "Alright, fourth question. \n Was the most pirated game of the year 2009: \n A. Spore \n B. Modern Warfare 2 \n C. The Sims 3 \n D. None of the above \n <ANSWER WITH THE LETTER> \n"; cin >> answer; if (answer == "B" || "b") { system("cls"); cout << "I'm sorry... YOU'RE RIGHT! Modern Warfare 2 was the most pirated game in 2009 with 4.1 million downloads! Let's hope you weren't one of them! Next question! \n Great job! You moved onto the next question! \n <PRESS ENTER TO CONTINUE>"; system("pause >Nul"); q5(); return 0; } else { failure(); } } int q5() { system("cls"); cout << "Mkay, the pressure is on. Fifth and final question! \n How many members were there in the Apollo 11 flight to the moon? \n"; cin.ignore(numeric_limits<streamsize>::max(), '\n'); getline(cin, answer); if (answer == "3" || answer == "Three" || answer == "three") { system("cls"); cout << "You are right! While he never set foot on the moon, Michael Collins was the Command Module Pilot, who orbited the moon while Armstrong and Aldrin were bouncing about. \n So far so good! You move onto the next question! \n <PRESS ENTER TO CONTINUE>"; system("pause >Nul"); winzor(); return 0; } else { failure(); } } int winzor() { system("cls"); cout << "CONGRATULATIONS! YOU WON! \n Your prize is one magical turnip. Yay! \n Press enter twice to go to the credits! \n"; cin.ignore(numeric_limits<streamsize>::max(), '\n'); getline(cin, answer); if (answer == "credits" || "Credits") { credits(); return 0; } if (answer == "exit" || "Exit") { exit(EXIT_SUCCESS); } else { main(); } } // credits int credits() { cout << "Credits! \n Lead Programmer: Connor West (AKA Danny the Magical Turnip, AKA Dacheet) \n Secondary Programmer/Troubleshooter: Daniel Bloom (AKA Supply Man) \n Program: C++ and Code::Blocks \n Thanks for playing!"; system("pause >Nul"); } //Failure message (if you fail a question) int failure() { system("cls"); cout << "Aw! I'm sorry, you're incorrect! Goodbye! \n"; system("pause >Nul"); main(); return 0; } /* Template system("cls"); cout << ""; cin.ignore(numeric_limits<streamsize>::max(), '\n'); getline(cin, answer); if (answer == "" || answer == "" || answer == "" || answer == "") { system("cls"); cout << ""; system("pause >Nul"); q4(); return 0; } else { failure(); } */ [/code] Now I want to make a Windows application. But I don't know where to start/what to make.
[QUOTE=Dacheet;22220643]Well I finished my quiz[/QUOTE] Good work! As an extension to improve you C++ skills you could try using arrays and structs, where you have a Question struct containing each question and possible answers etc., then store all the questions in an array of Question structs and loop through them instead of having a separate function for each one. [url=http://www.fredosaurus.com/notes-cpp/structs/structs.html]Struct[/url] [url=http://www.cplusplus.com/doc/tutorial/arrays/]Array[/url] [url=http://www.dreamincode.net/forums/topic/13919-understanding-loops-in-c/]Loops[/url]
[QUOTE=Robert64;22221253]Good work! As an extension to improve you C++ skills you could try using arrays and structs, where you have a Question struct containing each question and possible answers etc., then store all the questions in an array of Question structs and loop through them instead of having a separate function for each one. [url=http://www.fredosaurus.com/notes-cpp/structs/structs.html]Struct[/url] [url=http://www.cplusplus.com/doc/tutorial/arrays/]Array[/url][/QUOTE] Thanks! I might actually use those tutorials for a new project. I just started working on a D&D type Choose-Your-Own-Adventure game. The arrays and structs might help me a lot! [editline]06:01PM[/editline] I'm not sure how I would use them to combine adventures, though. Cause I want branching paths, and having them all in functions would be a pain in the ass to keep track of...
Arrays aren't exactly something that could help you with something. They are an extremely important part of any language. Loops too. You should learn to use them any way.
Wait wait wait Robert64 you wrote an interpreter in an interpreted language that's already pretty slow :V? Also I bet if you rewrote your language in C# even you'd see significant speed increase.
Added 3D boolean (inequality) plotting: [img]http://img526.imageshack.us/img526/2058/3dboolplot1.png[/img] I don't think too many graphers support this.
How'd you do that? Just render a grid of points in the area? It looks neat, like connecting wires.
Yeah. Inequalities in 3D give you volumes of space, and 3D volumes are incredibly hard to represent. For a non-graphics-intensive application like my grapher, a simple grid of points works well enough.
[QUOTE=pondefloor;22217509][url]http://www.facepunch.com/showpost.php?p=21916914&postcount=449[/url] i've created some sort of fallacy paradox.[/QUOTE] delicious inconsistency due to ego
Does it show only integer-only inequality values aswell?
[QUOTE=BAZ;22222951]Does it show only integer-only inequality values aswell?[/QUOTE] What do you mean?
As in, can you make it only plot integer boolean values? It would be useful for people who want to, for example, maximise profit of two products but they can't make 1.25 of a product. [editline]12:55AM[/editline] I'm not too good at explaining it, but basically linear programming. [url]http://en.wikipedia.org/wiki/Linear_programming[/url]
No, you can't. Though I still don't fully understand how exactly that would help, considering you could always just consider the whole numbers if that's what you're looking for.
Sorry, you need to Log In to post a reply to this thread.