Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

General Coding Thread

Featured Replies

Im starting this thread to discuss coding, and maybe get some people into coding. Now this isnt about coding API callouts or something, this is just general coding to create a game or something. Heres an example:

 

Basic Code can be like this, say your doing a maze, your need to get from start to finish, here is how the code might look. 

 

moveForward();
turnLeft();
turnRight();
moveForward();

 

You can get more advanced, and make things become more automatic like:

 

if (isPathForward()) {
moveForward();
} else {
turnRight();
}

 

To simplify the code:

If Path Is Ahead: Move Forward

If not: turn right

 

Then it can get a bit more complex, like here

 

while (notFinished()) {
if (isPathForward()) {
moveForward();
} else {
turnRight();
}
}

 

To explain that its the same thing:

If Path Is Ahead: Move Forward

If not: turn right

Repeat until turning right creates a path forward

 

 

You can also make it repeat a certain number of times.

 

If anyone wants help with anything explained, just ask.


I just found this, it teaches you JS. https://www.khanacademy.org/computing/cs/programming/drawing-basics/p/intro-to-drawing , I really want some people to get into coding, as you can create anything you want, make anything happen. Its a great way to express creativity, and a really fun hobby.

  • Author

Theres so much to learn, im suprised no one has said anything or posted on the topic yet :c.


I just made this. Pretty cool how I could make a picture with just text. Look at the code corresponding to the picture

 

c3fe13dcbd7a084c91b0969d652cb14e.png

I wish I could script, and I want to learn but I'm too lazy and my head begins to hurt after a few seconds of looking at the code.

 

Furthest I ever got was creating a script for ARMA 2 where you could "end it all". Blow your brains out, in other words. Worked well if you had been surrounded by the police in a confined space.

  • Author

You can also do things with variables, say your making a face, you want to change the eye size, normally you need to do width and height individually for each eye (lets assume your guy has 2 eyes)

 

If you dont know already ';' means the end of a command

 

Here are his eyes:

Ignore the fill, this is just the color of the eyes.

 

// eyes
fill(46, 46, 41);
ellipse(157, 151, 30, 30);
ellipse(157, 151, 30, 30);
 
Say I wanted to change the width and height (30 is x and y to get a perfect circle)
Id have to do it one by one, so this is why you can use a variable, eg:
 
var eyeSize;
 
eyeSize = 35
 
// eyes
fill(46, 46, 41);
ellipse(157, 151, eyeSize, eyeSize);
ellipse(304, 142, eyeSize, eyeSize);
 
This changes any variable named eyeSize to 35, the variable takes place of a parameter and is used to simplify work

 


Instead of doing

 

var eyeSize;
 
eyeSize = 35;
 
you can simplify it by doing
 
 
var eyeSize = 35;
 

 


fill(0, 0, 0);
var eyeSize = 20;
ellipse(170, 150, eyeSize, eyeSize); // left eye
ellipse(230, 150, eyeSize, eyeSize); // right eye

This allows you to change the size of the eye by adjusting the variable. 

Edited by iiKonrad

  • Author

If your building a face, and you want to change the size of his head, you only change the face variable, and you'd manually need to resize the eyes and mouth to look good, so this is why you can use fractions

var faceSize = 287;            //This is the circle, his actual head
var mouthSize = faceSize/2;    //Size of the mouth,which is always half the facesize
var eyeSize = faceSize/7;      //eyesize which is always a seventh of the face
var x = 200;
var y = 193;


  

Using this, scaling just the face size scales the eyes and mouth, based on a fraction of the face itself 


What program did you use to do those? I am trying to get into and starting out with the basics gets you somewhere.

 

This is Java Script or JS for short. You can use an HTML, although to get started use this https://www.khanacademy.org/computing/cs/programming/drawing-basics/p/intro-to-drawing

 

This goes over what I taught, as they explain it so someone can understand it, I myself am not an actual teacher and I use the info I know and explain it the way they do and sometimes better


So you guys know the whale that follows your mouse? Well heres how this is done, except we didnt make a whale, we made a circle.

// mouseX and mouseY

strokeWeight(3);
stroke(57, 0, 214);
fill(0, 210, 247);

draw = function() {
    
    background(255, 255, 255);
    
    ellipse(mouseX, mouseY, 30, 30);
    
};

This is the product of the code above

 

http://gyazo.com/40a882cdbf5c1712e3b2a16d3c21517a

 

using pineAppleFishes;
using System;
using blah;
using somethingElse;

//These things above are called references. The ones above(with the exception of System) are made up and should not be used in your code unless you have these DLL's on your computer. 
//The scripthook.dll in your GTAIV directory is a reference as well. This does not mean every DLL is referable. 

//";" is needed at the end of every single line of code. The exceptions are classes, methods and cases(cases are a little complex and shouldn't be followed in this brief explanation. Follow up in your own time). 



//This is a single line comment

/*
Comments can be done like so as well.(Between two backslash astris's)
Other things may work for various languages, but the following code is in c# (CSharp)
*/



//A class is the first thing in your script
public class FirstClass 
{
    static void Main(string[] args)
    {



                //void means this method will not return any value, yet code will run
 
                //Variables:
                /*
                In C# every variable has a type: Int(Whole numbers), string("TEXT Inside These Quotation marks"), float(Numbers with decimals but with an "f" afterwards for the definition of float(5.5f)),double(Same as a float but more precise and no use of the letter "f" afterwards needed). There are more variable types but aren't necessarily used to often. 
                */

                //Lets make a few: 

                string myString = "Hello, this is a string";
                int myInt = 5;
                double myFirstDouble = 5.76775342332;
                float myFloat = 5.5f;

                /*
                These are basic demonstrations. You can make anything possible(to certain degrees) with variables.
                */

                //Lets put all this into test. 
                //The below code is for use with the console library within Visual Studio. Although you //can compile C# scripts with a standalone compiler. (Search at your own discretion)




                //Sets variables
                string myString2 = "5.5";
                double myDouble = double.Parse(myString2);
                //This code above converts the string to a double


                //This will write the myDouble variable to the console and it should be 5.5
                Console.WriteLine(myDouble);
            
                //Keeps the console from closing
                Console.Read();
    }
}

This is not a full tutorial, this is only something I have made up in the last 5 or so minutes. 

Sweet jesus stop using processing.

Not only is it Java for 4 year olds, but it has the worlds worst IDE ever. 

Try saving that shit to a different file location. Oh it deleted all of your code? Fun. Try telling it to "Save As" in the same folder. Nope can't overwrite because saving it in the same folder is a stupid idea.

 

I had to do a university project in Processing. I don't ever want to touch that again, ever.

 

I respect people are completely new to coding. But don't start with Processing. Pick up a full language like Java directly, or C# or hell even VB if you feel like it.

Live Streaming daily from 8pm GMT (UK) at https://twitch.tv/OfficialLukeD - I play a variety of things 😄

Join my official discord server for support, general chat and my stream schedule! https://discord.gg/Mddj7PQ

  • Author

Sweet jesus stop using processing.

Not only is it Java for 4 year olds, but it has the worlds worst IDE ever. 

Try saving that shit to a different file location. Oh it deleted all of your code? Fun. Try telling it to "Save As" in the same folder. Nope can't overwrite because saving it in the same folder is a stupid idea.

 

I had to do a university project in Processing. I don't ever want to touch that again, ever.

 

I respect people are completely new to coding. But don't start with Processing. Pick up a full language like Java directly, or C# or hell even VB if you feel like it.

I havent started with java and Im not really new to coding. I started with lua. It's similar to java though. C# is easy..Just a question do you speak ECMA script? I've been starting to learn that over the past couple of weeks.

I havent started with java and Im not really new to coding. I started with lua. It's similar to java though. C# is easy..Just a question do you speak ECMA script? I've been starting to learn that over the past couple of weeks.

Java is easy, and if you find C# easy you'll have no issue with java really.

No I don't speak it. Generally speaking though humans don't speak computer languages :P

 

On a serious note no I've never used ECMA.

Live Streaming daily from 8pm GMT (UK) at https://twitch.tv/OfficialLukeD - I play a variety of things 😄

Join my official discord server for support, general chat and my stream schedule! https://discord.gg/Mddj7PQ

  • Management Team

As for IDE, on Windows Visual Studio is the way to go. With some plugins to improve IntelliSense like ReSharper (especially to enhance C# experience, though some people might dislike the JetBrains look) and/or Visual Assist (especially for C++), and for instance VisualSVN for source control, there aren't many things you can't do. Considering getting .NET Reflector if you plan to do .NET RE is a good idea too. For general PE file analysis, IDA (with Hex-Rays and ClassInformer), OllyDbg, CE, ReClass and an up-to-date PEiD is a set up hard to fool. Plus tools like Scylla and/or ImpREC for rebuilding PEs in case of packed targerts and you should be able to handle most, if not all, PE files out there. Just in case someone wanted to know :P

 

@iiKonrad: If you know C# already, Java is an even greater waste of time as it would have been either way.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

@LMS: .Net Reflector has become a commercial product (which one needs to pay for). I recommend ILSpy which does the same and looks the same but it's completely free.

 

As for "coding" in general: I suggest anyone who is truly interested in it should buy a good book about it. Learning software development is way too much stuff to put in a forum thread.
Also the MSDN Library is THE place to go for every serious .net developer as it explains each and every part of the .net framework, including example code.

BTW: Personally I don't like the term "coding" or "coder". The latter is almost a swear word among professionals! Coders know nothing about software architecture. Ever heard of design patterns? :wink:

Edited by Cyron43

  • Management Team

@LMS: .Net Reflector has become a commercial product (which one needs to pay for). I recommend ILSpy which does the same and looks the same but it's completely free.

 

As far as I know, ILSpy lacks support for Add-ins like Reflexil or Codesearch, which makes it pretty useless for more advanced tasks.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.