I don't know what it's called but I need help with it
ALSO weird how they said they "didn't choose to be a mod-" ok I'll stop before I possibly get banned for no reason, that's all I've got anyway (hopefully)
yea you get it lol
Oh, also, is there a way I can count how many of a specific type of... erm.. listing(?) I have?
Like how many "hidden" achievements I have left, or just the total of achievements and completed achievements?
INTERNECION Disrespectful??? nah bro went to far
INTERNECIONLvl 62
- Edited
- Windows
2kChubz Lying about what I say. Manipulating someone else to think lies. Being disrespectful to me by not heeding the warning I gave you exactly 24 times. And not actually answering my question of us becoming friends so that this controversy can be over. Does jack shit for coding and only making things worse whenever you are online. You only come on to insult me and try and humiliate me. Well i am mod now so I can do something about this injustice. SUSPENDED FOR ONE DAY. For being disrespectful to a mod and not listening to me when I gave you a chance SEVERAL TIMES or helping anyone with what you say and only adding to the problem
INTERNECIONLvl 62
- Edited
- Windows
Mellow I only upvote my own stuff so I can piss off chubz since he cares so much about it. I never chose mod. BRENDAN JUST GAVE IT TO ME. To stop a controversy that Chubz and colack created and escalated to the point where I nearly banned both of them and kept it that way so that it was peaceful at last. I neeever wanted to be here. I only came here because of HACKERS on code.org and I wanted to stop there goddamn reign. AND THEN ALL OF A SUDDEN I got into arguments with people because ALL I DID WAS TRY AND HELP FOR THE TRILLIONTH TIME and being denied that because people didn't like my so-called "unorthodox" way of helping others. AND I EXPLAINED MYSELF CLEAR AND CUT ABOUT SEVEN TIMES OVER. MOST OF THE GODDAMN FORUM WAS ON MY SIDE BECAUSE THEY KNEW I DID NOTHING WRONG. SO please think before you speak and get the other persons side before it gets you somewhere you don't like, that person's bad side. This is a warning. I do not want to have to tell you this again. You are very lucky that you didn't break anymore rules yourself cuz I do not want to deal with people like them ANY LONGER. WE ARE DONE HERE. I am not bringing this up again
INTERNECIONLvl 62
- Windows
Do you understand. it is 12:00 AM I am not dealing with this
ackvonhuelioLvl 41
Mellow
imma kill two birds with one stone on this
varrience probably has a better way but...
so anyways here how to for loop
for(var i = 0; i < 5; i++){
}
- the var i = 0 means your making a variable called i which starts at 0
- the i < 5 means the loop keeps repeating while i is less than 5
- the i++ means i increases by one every time the loop repeats
SO, in total, the loop repeats five times.
now, to incorporate with arrays:
for(var i = 0; i < array.length; i++){
}
you'll notice its the same as before, except for part two where it now says i < array.length instead of i < 5
this means that the for loop repeats array.length times, which means it repeats once for each object/achievement in the array
so now we can go through each achievement in the array by using array[i]
(the ith object in the array, and since i is changing once for each object in the array, we cover all the objects)
to sum it up you'd need something like this:
var numCompleted = 0;
for(var i = 0; i < achievements.length; i++){
if(achievements[i].completed === true){
numCompleted += 1;
}
}
again, hope this helps and im sure varrience has a better way of doing this but until then your welcome
INTERNECIONLvl 62
- Edited
- Windows
ackvonhuelio hey ack I need some help. How do I come off as stern but not angry or pissed? I know you cannot type emotion however I know that you have done this before. So please help a brother out.
VarrienceLvl 25
Mellow possibly... not sure exactly what your trying to do, but i'll give 2 examples to try and answer what your trying to do, the
first is to add a property that keeps track of that in the object that will update manually, unlike arrays objects don't have a .prototype.length attribute
second is to encase multiple arrays of objects containing a Boolean on if they have been unlocked
the two examples will be showcased below for those who want to learnvar obj = { pro: true, noob: false, achivements: 1 total: 15 } // we can then update it at any time a new achievement is unlocked var loser = true; if(loser && !obj.noob){obj.noob = true; achivements++} console.log("you have "+obj.total-obj.achivements+" left keep it up!") // the second way is below here which is basically what Ack did var accomp = [ {title: "Ruiner", unlocked: false} {title: "Participation Award", unlocked: false} {title: "Secret Customer", unlocked: true} ]; // to calculate how many achievements we have left we must iterate through the Array function accompLeft(){ var left = accomp.length; // stores total achievements for(var i = 0; i < accomp.length; i++){ if(accomp[i].unlocked){left--} // here we access an accomp [ index ] and a .property from that index } return(left) }
personLvl 62
just stop f@cking arguing all the time goddammit
i am not going throught 48 posts >:(
VarrienceLvl 25
- Edited
Varrience well... the last one i wrote was pseudo code so it won't actually run so if your looking for something to play around with and understand how it works this is the better example of what i was showing off.... not sure if i should remove the previous post though
var obj = {
pro: true,
noob: false,
achivements: 1,
total: 15
}
// we can then update it at any time a new achievement is unlocked
var loser = true;
if(loser && !obj.noob){obj.noob = true; obj.achivements++}
console.log("you have "+(obj.total-obj.achivements)+" left keep it up!")
// the second way is below here which is basically what Ack did
var accomp = [
{title: "Ruiner", unlocked: false},
{title: "Participation Award", unlocked: false},
{title: "Secret Customer", unlocked: true}
];
// to calculate how many achievements we have left we must iterate through the Array
function accompLeft(){
var left = accomp.length; // stores total achievements
for(var i = 0; i < accomp.length; i++){
if(accomp[i].unlocked){left--} // here we access an accomp [ index ] and a .property value from that index
}
return(left)
}
console.log("you have "+accompLeft()+" left keep it up!")
ackvonhuelio Varrience
Yoo thank you guys so much! This helps a great ton!
Unfortunately, my dumb little brain isn't quite able to grasp what's going on in Varrience's examples, but hopefully I'll be able to understand it later. Still, it means a lot, thank you guys!
INTERNECION Number one thing not to do when you don't want to sound pissed is to not use all caps. All caps 99% of the time mean that you are shouting, and if you're shouting, it's going to be assumed that you are indeed angry. It especially does not help you when you combine a warning with all caps. It comes across more as an angry threat than a warning. Instead, use italics when you want to put emphasis into a certain part. (yea I used caps for 2 words that one time then remembered the tilted I was a thing so 👍)
Oh and, using words that refer to the offender is also usually unhelpful. For example, you should say
"This goes against our rules, please don't do that again"
Instead of
"You are breaking our rules, don't do that again"
INTERNECIONLvl 62
- Windows
Mellow Well I usually use all caps for emphasis and not for yelling. I mean what will I yell at the screen for? It isn't like it just booted up my i.p. adress from out of nowhere. Haha