• What do you need help with? Version 1
    5,001 replies, posted
Extremely new to LUA, need an idea for something simple to write.
Different question, is there any way to send a null character as one byte with DataOutputStream?
[QUOTE=mastermaul;23525802]Extremely new to LUA, need an idea for something simple to write.[/QUOTE] Well it's "Lua", for starters :frown:
It looks like an acronym to me :colbert:
Nope, Lua is 'moon' or something in Portugese
[QUOTE=mastermaul;23529801]It looks like an acronym to me :colbert:[/QUOTE] It's NOT! :crying:
But now that you mentioned it, I guess I never noticed. Probably been pronouncing it wrong then. :v: But to the original point, any ideas?
maul make an aimbot in gmod lua, they're piss easy to do
[QUOTE=mastermaul;23530224]But now that you mentioned it, I guess I never noticed. Probably been pronouncing it wrong then. :v: But to the original point, any ideas?[/QUOTE] Pick up LÖVE, have some fun :)
[QUOTE=ButtsexV2;23530292]maul make an aimbot in gmod lua, they're piss easy to do[/QUOTE] I'd rather not be a terrible person.
[QUOTE=mastermaul;23530410]I'd rather not be a terrible person.[/QUOTE] then make an ESP script, those are even easier. make it show how much health each person has.
[QUOTE=mastermaul;23530224]But now that you mentioned it, I guess I never noticed. Probably been pronouncing it wrong then. :v: But to the original point, any ideas?[/QUOTE] LOO-Ah
I've been pronouncing it ell you [url=http://cdn-www.cracked.com/phpimages/topic/3118/summary_image.jpg]ayy[/url]. [editline]10:25PM[/editline] Also LOVE looks really simple, thanks.
Thanks for answering my question instead of delving into the whole LUA/lua fiasco that has plagued the board since its creation guys. I love you e: poo buttes
[QUOTE=rsugar;23532062]Thanks for answering my question instead of delving into the whole LUA/lua fiasco that has plagued the board since its creation guys. I love you e: poo buttes[/QUOTE] Oh sorry. Since we havn't replied to your post within a reasonable time-frame I'll be issuing you a full refund. Thanks for using Facepunch.
[QUOTE=rsugar;23532062]Thanks for answering my question instead of delving into the whole LUA/lua fiasco that has plagued the board since its creation guys. I love you e: poo buttes[/QUOTE] Fine, I'll do it. But you could've used [noparse][cpp][/cpp][/noparse] tags. It's hard enough to read as it is. [QUOTE=rsugar;23524347] global.hpp [code] void startgame() { TCODConsole::root->clear(); TCODConsole::root->flush(); mapisgen = true; while (gameisrunning & !TCODConsole::isWindowClosed()){ TCODConsole::root->printCenter(40,15,TCOD_BKGND_NONE,"Rogue Town Alpha Build"); while(mapisgen){ genwilderness(); TCODConsole::root->flush(); } } } [/code] [/QUOTE] global.hpp will cause multiple definition linker errors if you include it into more than one code module (compiled .cpp file). Don't put code in header files. You also want to pretty it up with some whitespace - indentation in particular would do wonders. [QUOTE=rsugar;23524347] map.hpp [code] bool mapisgen; char map[500][500]; void genwilderness() { int i,j,k,r; //i = x; //j = y; while(j<=60){ for (k=0;k<500;k++) { r = rand() % 3 + 1; if (r == 1) { map[i][j] = 'T'; } else if (r == 2) { map[i][j] = ','; } else if (r ==3) { map[i][j] = '.'; } i++; if(i == 500) { i=0; j++; } TCODConsole::root->setChar(i,j,map[i][j]); } } mapisgen = false; } [/code][/QUOTE] 'j' is not initialized when first used, which means it can have any imaginable value. You probably wanted to initialize it to zero. You should also get into the habit of declaring variables in the right scope and place, and naming them something informative. Variables should be declared [I]as late as possible[/I], which in your case means you can actually do "declare & initialize" for all i, j, k and r (j being declared and initialized to 0 just before the while loop). 'i', 'j', 'k' and 'r' are not particularly good variable names in this piece of code - 'i' and 'j' could be expressed as 'x' and 'y' (as they are indexes for your 2D array). 'r', I guess, is fine, if a bit short. 'k' should then be 'i', because it's the loop [B]i[/B]terator.
^^ Thank you for your help [QUOTE=blankthemuffin;23532167]Oh sorry. Since we havn't replied to your post within a reasonable time-frame I'll be issuing you a full refund. Thanks for using Facepunch.[/QUOTE] This facepunch service is horrid, what kind of business are you running here? Edit: Ok, I've moved around the code a bit, but I'm still having problems. The wilderness generator does generate wilderness, but only in one column and loops forever, re-generating wilderness.
Guys is there anyway to convert the returned value of the cmath function atan2 to degrees? Google isn't too much of a helping hand for me. [editline]05:35PM[/editline] nevermind, I found out that I don't even need to convert them for some reason v:v:v
Isn't it the same as converting any angle in radians to degrees?
Degrees = Radians * (180/Pi) I need to put that on a quick-paste thing, I've said it so many times
Aren't you supposed to know that by heart anyway?
Probably, but people are constantly asking that You'd think they'd never taken a maths class :v:
Lua problem: I can't really explain it so I'll try and boil it down to something like this: -snip- I want both TestVarA and TestVarB printed :( Although if this should 100% work then I may have fucked up elsewhere. [editline]03:55PM[/editline] Scratch that, it does seem to work but not with a function inside the second CLASS if I repeat the pattern again [editline]03:59PM[/editline] Sorry, I hadn't actually tested it again since yesterday and apparently it all works now. [editline]05:32PM[/editline] Ok, why can't I do this: [Cpp]public static T GetClassProperty< T >( string type, string property_name ) { return ( T ) lua_interpreter.GetTable( type )[ property_name ]; }[/Cpp] When T is int and lua_interpreter.GetTable( type )[ property_name ] is a double?
Trying to make a Sprite follow the mouse using this tutorial [URL]http://www.berecursive.com/2008/c/rotating-a-sprite-towards-an-object-in-xna[/URL] for the maths. I'm using SFML. It works fine, only problem is that when the object reaches the mouse it jitters around it. That's because it travels, for example, 5 pixels per frame, and it doesn't exactly "land" on the cursor position, so it goes back and forth by 5 pixels. What's the best way to fix this?
[QUOTE=SupahVee;23570269]Trying to make a Sprite follow the mouse using this tutorial [URL]http://www.berecursive.com/2008/c/rotating-a-sprite-towards-an-object-in-xna[/URL] for the maths. I'm using SFML. It works fine, only problem is that when the object reaches the mouse it jitters around it. That's because it travels, for example, 5 pixels per frame, and it doesn't exactly "land" on the cursor position, so it goes back and forth by 5 pixels. What's the best way to fix this?[/QUOTE] Check if the object is less than 5 pixels away, and if it is move it to be exactly on the mouse.
Or move it only if it's further than 5 pixels away.
What do I need help with? Well... Basically, what I am trying to achieve is take typed characters (integers), assign them to an array, then print that array. The code, [code] #include <stdio.h> #define N 100 int main(void) { int a[N], i, *p; p = a; for (i = 0; getchar() != '\n'; ++i) { p[i] = getchar(); } for (i = 0; p[i] != '\0'; ++i) { printf("%d", p[i]); } return 0; } [/code] yields some pretty wierd results, I understand that I am printing the ASCII values of the array or the memory bytes assigned to the array?
Well, to start off, it skips half of the characters because you're reading half of them with the getchar() in your for loop condition, while not storing the value. You're also not adding a null terminator to the array anywhere. This is how it should be: [cpp]int main(void) { int a[N], i, *p; char c; p = a; for (i = 0; ( c = getchar() ) != '\n'; ++i) { p[i] = c; } p[i] = '\0'; for (i = 0; p[i] != '\0'; ++i) { printf("%d ", p[i]); } getchar(); return 0; }[/cpp]
[QUOTE=Overv;23586207]Well, to start off, it skips half of the characters because you're reading half of them with the getchar() in your for loop condition, while not storing the value. You're also not adding a null terminator to the array anywhere. This is how it should be: [cpp]int main(void) { int a[N], i, *p; char c; p = a; for (i = 0; ( c = getchar() ) != '\n'; ++i) { p[i] = c; } p[i] = '\0'; for (i = 0; p[i] != '\0'; ++i) { printf("%d ", p[i]); } getchar(); return 0; }[/cpp][/QUOTE] Thanks, skipping half the characters was my bad, tried it as a test then forgot to take it out, but the null terminator is completely new to me. Although It still doesn't produce the desired results -EDIT: Oh wait changed "%d" to "%c", oops.
You might also wanna do ( c = getchar() ) != '\n' && i < 100 so it doesn't overflow. Or use the fgets function.
Sorry, you need to Log In to post a reply to this thread.