ID:55338
 
So you want to program in something specific, huh? The first step is NOT to go to Developer's How-To but to first think it out:
  1. What are you attempting to make (and what needs to be in to make it)
  2. What do you know so far which can help make this
  3. What don't you know what to do
  4. What resources are available to help solve the above


If you do not know the answer to #1... ugh.

Now, let me give a hypothetical situation: you are trying to make a turn based battle system.
  1. What are you attempting to make (and what needs to be in to make it)
    • We're making a turn-base system for battling, which needs:
      • A datum (well, not really needed but makes thing simple)
      • Something to keep track of who's turn it is
      • Make the program go to the next person when everything is complete for that person
  2. What do you know so far which can help make this
    • We know how to make a datum (if you don't, you'll learn soon - it's not hard at all)
    • We can make a variable to keep track of who's turn it is
    • We can make the program wait at a certain point by using an infinite loop, such as "while(!ready)sleep(1)", to pause the procedure wait until the next person turn comes


  3. What don't you know what to do
    • We know what to do, answered all the questions.

  4. What resources are available to help solve the above
    • We don't need to use any resources since we have no questions


Now to put it together:
Battle  //  OMG, we just made a /Battle datum.
var
p_turn = 0 // This will keep track of which player's turn it is
players[2]
GameOver = 0
NextTurn = 0

New(mob/m1, mob/m2) // Called when created
if(m1 && m2)
players = list(m1, m2)
else
CRASH("Where's everyone? :(")

p_turn = rand(1,2) // randomly pick which player's turn it is
Start_Battling() // Okay, lets start the fight

proc/Start_Battling()
while(!GameOver) // We want this procedure to keep happening until the game is over
var/mob/M = player[p_turn] // Set who's turn it is
M << "It is your turn. Hurry!" // The purpose of M defined here is not for the message but shows that you can modify certain variables at the beginning of M's turn here.

while(!NextTurn) sleep(1) // While the player is not ready, this proc will "pause" here until NextTurn = a true value, such as when M attacks

M << "It's the end of your turn."

p_turn = 3-p_turn // If it was player 1 turn, now it is #2's turn and vice versa
NextTurn = 0
// Loops back to the top due to the while()

Finish_Battle() // The while() loop stop when GameOver != 0, "" or null. This is called after the while() loop stops

Of course, if you do not know the answer to one of the questions (EXCEPT for #1, you SHOULD KNOW the answer to that), that's when you should make a post in Developer's How-To... with as much detailed explanation of what exactly you want to achieve. The people replying will help point you figure out how to make the rest.

Taking the time to make a skeleton map of what you need will help out a lot.
Interesting theory, but how many newbies that dash to Developer How-To understand (or even know of) datums?