Author Topic: Programming Megathread  (Read 144050 times)

Lower camel case is my favorite. It just feelsRight.
* Kochieboy cringes

PleaseGo heckOff = "nerdo"; xd




Torque
This small section of code returns a message using /replyTopic
You can use /setReplyColor, /setReplyFont, and /setReplySize to change how your message looks
Code: [Select]
//Font Color
function serverCMDsetReplyColor(%writer,%hex)
{
    if(strLen(%hex) != 6)
       return;

    %writer.replyHex = %hex;
}
//Font Face
function serverCMDsetReplyFont(%writer,%font)
{
    %writer.replyFont = %font;
}
//Font Size
function serverCMDsetReplySize(%writer,%size)
{
    if(%size > 32 || %size < 4)
       return;

    %writer.replySize = %size;
}
//Reply
function serverCMDreplyTopic(%writer,%msg)
{
    %final = "<color:"@%writer.replyHex@"<font:"@%writer.replyFont@":"@%writer.replySize@">"@ %msg @" ";
    messageAll("<color:fff000>" @ %writer.name @ " : " @ %final @ " ");
}
Of course there are some checks missing that should be in place such making sure the size is an integer, and setting a "default" size/color/face if %writer.customReply is false.

i definitely prefer camelcase, probs cus that's just what i learned. it's really unintuitive for me to reach for that part of the keyboard and separate_words_out_like_this or-like-this. i personally find it a lot easier to just pressShift which one of my fingers usually rest on
I learned camelcase first too, but that didn't make it any easier to read

Torque
This small section of code returns a message using /replyTopic
You can use /setReplyColor, /setReplyFont, and /setReplySize to change how your message looks
Code: [Select]
//Font Color
function serverCMDsetReplyColor(%writer,%hex)
{
    if(strLen(%hex) != 6)
       return;

    %writer.replyHex = %hex;
}
//Font Face
function serverCMDsetReplyFont(%writer,%font)
{
    %writer.replyFont = %font;
}
//Font Size
function serverCMDsetReplySize(%writer,%size)
{
    if(%size > 32 || %size < 4)
       return;

    %writer.replySize = %size;
}
//Reply
function serverCMDreplyTopic(%writer,%msg)
{
    %final = "<color:"@%writer.replyHex@"<font:"@%writer.replyFont@":"@%writer.replySize@">"@ %msg @" ";
    messageAll("<color:fff000>" @ %writer.name @ " : " @ %final @ " ");
}
Of course there are some checks missing that should be in place such making sure the size is an integer, and setting a "default" size/color/face if %writer.customReply is false.

/setReplyFont Impact:128><div:1><shadow:0:32>




yesterday for one of my finals i had to do the hour of code thing. it was p easy, even when i did it with text instead of blocks. i picked the star wars thing and at the end i got to make a "game" by messing with variables and characters, but it was some nightmarish thing where whenever you hit a "good" character it would spawn another "bad" character and whenever you hit a "bad" character it would change the obstacle layout. i got stuck in the obstacles and the game eventually lagged to hell but it was fun to make.

potential day 5 spoilers for the advent of code thing incoming

https://github.com/foxscotch/advent-of-code/blob/master/day-05/p2.py

this almost feels like cheating. man I love regex
I have just now decided to try to use regex as much as I possibly can to solve the rest of the problems
I did use it already once, for day 2, but at that time it would have actually been far simpler to just use the split method of the string, sooo
« Last Edit: December 19, 2015, 03:54:29 AM by Foxscotch »

so today i tried c++ sfml today, and i made a window class. i made a pointer to a new sfml window to a m_window object, intellisense reports fine but when i try the code, this stuff happens:


the code:
window.cpp


main.cpp


the code in red brackets is what the debugger tells me there is an error
any clues?

EDIT: fixed it, had to remove the type declarator before m_window in the constructor
« Last Edit: December 19, 2015, 10:58:09 AM by pefu19 »

This might be a stupid question, but could somebody explain Regex's to me? I know they're regular expressions for sorting and stuff, but I have no clue how they work.