ID:1823439
 
This is what boredom does to you:
mob
var
Attacking=FALSE;//TRUE; when they are doing a combo
AttackSequence=0;//Which attack they are on
WaitPeriod=0;//How long they need to wait before doing anything else
verb
Combo() {
if(src.Attacking==FALSE||src.AttackSequence>0) {//if they aint thuggin already
src.Attacking=TRUE;//they ready to f**k sum1 up
var/target = get_bounds();//find a h** to s**t on
if(src.AttackSequence==0) {//beginner's luck b***h
src.Combo1(target);//now f**k them up
return;//run like a thirsty h**
}
if(src.AttackSequence==1) {//f**k the sequels
src.Combo2(target);//beat the s**t out of sequels
return;//run like a thirsty h**
}
if(src.AttackSequence==2) {//f****n' trilogies
src.Combo3(target);//get that s**t outta here
return;//run like a thirsty h**
}
}
}
proc
ComboWait(var/delay) {
var/AS = src.AttackSequence;//attack sequence be old as s**t
sleep(delay);//sleep muthaf**ka do you USE it?
if(AS==src.AttackSequence) {//if they be thirsty h**s
src.AttackSequence=0;//f**k her right in the p***y
src.Attacking=FALSE;//right in their f**king face m8
}
}
Combo1(mob/target) {
if(target==null) {//you playin bro?
src.Attacking=FALSE;//what the f**k do you take me for, a b***h?
return;//f**k you too
}
else {//ready to f**k this b***h up?
world << "[target]1";//kickin **s and take names
//damage that h**
src.AttackSequence++;//press z to win
spawn(1);//drop it like it's hot
src.ComboWait(20);//I'm Chris Hansen, have a seat over there for a second.
return;//your master called and he said f**k you
}
}


And thus the skeletal code form of my attacking system was built!
This comments are glorious. Just saying.
Imagine starting a project with this guy as your programmer, and then he ditches your project, and the next programmer you hire has to try and figure out what everything does with those comments. Rip in pepperonis 2015.
Just wondering, ever heard of the switch() proc or the ! operator?
In response to NNAAAAHH
Oondivinezin
This comments are glorious. Just saying.
3code5me bruh goml fite me irl

EmpirezTeam wrote:
Imagine starting a project with this guy as your programmer, and then he ditches your project, and the next programmer you hire has to try and figure out what everything does with those comments. Rip in pepperonis 2015.
2069*

NNAAAAHH wrote:
Just wondering, ever heard of the switch() proc or the ! operator?
Yup, I have. I've used switch in java and the ! operator is the "NOT" operator. Hence, I was bored and just did whatever.
Indeedidillitily. I was unaware of switch being a function in java. Does it behave the same as in DM?
Java's switch is non-blocking. You have to break before each case otherwise, it'll continue into the next case without meeting the condition.
In response to Super Saiyan X
In DM, we do that by providing multiple constants:
switch(expression)
if(constA, constB, constC, ...)
statement


In Java,
switch(expression) {
case constA:
case constB:
case constC:
statement;
break;
}
In response to Kaiochao
Kaiochao wrote:
In DM, we do that by providing multiple constants:
> switch(expression)
> if(constA, constB, constC, ...)
> statement
>

In Java,
> switch(expression) {
> case constA:
> case constB:
> case constC:
> statement;
> break;
> }



Well, sure, but that's not what I meant. Someone switching from DM to Java might have an issue getting used to do switches like this:

switch(expression) {
case constA:
statementA;
break;
case constB:
statementB;
break;
case constC:
statementC;
break;
}


Because, in DM, you do just do this:

switch(expression)
if(constA)
statementA
if(constB)
statementB
if(constC)
statementC


So, someone might keep doing that in Java:
switch(expression) {
case constA:
statementA;
case constB:
statementB;
case constC:
statementC;
}


Which, would be unintended behavior - if caseA meets the condition, every case after caseA would execute, not just caseA.
In response to Super Saiyan X
Super Saiyan X wrote:
> switch(expression) {
> case constA:
> statementA;
> case constB:
> statementB;
> case constC:
> statementC;
> }
>

Even though you can do that in BYOND, wouldn't someone still be able to use break statements just like in Java for it's DM counterpart? I mean, in DM you don't have to use ; but some people do it anyways because they are used to it from Java.
Even though you can do that in BYOND, wouldn't someone still be able to use break statements just like in Java for it's DM counterpart? I mean, in DM you don't have to use ; but some people do it anyways because they are used to it from Java.

Reread what SSX is saying. You can't do that in DM.

DM's switches don't support fall-through cases and they don't support the case keyword. In other languages, this is what's called a fall-through:

switch(expression)
case 0:
case 1:
case 2:
case 3:
//do something
break;


In C++ you can actually do a range of values using the ... expression:

switch(expression)
case 0 ... 3:
//do something
break;


DM doesn't support the fall-through pattern. Instead, we have a couple different patterns for mimicking C++-style switches:

switch(expression)
if(1,3,5,9)
//do something
if(10 to 100)
//do another thing
else
//do something else


So yeah, be careful with which switch patterns you use in DM. The fall-through pattern trains you to think about switch cases a bit differently in other languages. Fall-through does not apply in DM.
In response to GameAnalysis
The difference there is not the semicolon, but the flow of the code. In Java, "break" keeps the code from continuing to the next "case" (which happens automatically). In DM, break doesn't apply to switch(), so you can't use it at all, and cases can't mix.
Oh ok, I didn't see that. I should probably read previous posts before replying to current ones xD
It seems to be exclusive to gcc, actually.

http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Case-Ranges.html
I'm not sure the point of the post was to start an argument. o.o