4 posts
Posted 17 October 2012 - 03:03 AM
http://pastebin.com/4xkUALe1attempt to call number
Not sure where i goofed up.. Can someone look over this and assist me with any mess up i might have done thanks.
Purpose is to trigger off via item detector and give a total count for each item that passes.
864 posts
Location
Sometime.
Posted 17 October 2012 - 03:29 AM
It's because you haven't created the y variable.
Add y = 1 at the top..
That should work.
4 posts
Posted 17 October 2012 - 03:35 AM
tried .. getting same thing attmpt to call number …. but further down y = rs.getBundledInput("back") only area i see where might be issue is line 50 on the print. where is calling for ???count ????
it prints other stuff and if like other languages it reads top down ??? and its passing the first 2 prints
2088 posts
Location
South Africa
Posted 17 October 2012 - 06:29 AM
print("|", i," ", color[i], " ","|",count[i]," ", " "," |",colors.test(y, 2^(i-1)))
To concatenate text with other variables you use ..
print("|"..i.." "..color[i].." ".."|"..count[i].." ".. " ".." |"..colors.test(y, 2^(i-1)))
That line is difficult to read lol, I might have screwed up somewhere
4 posts
Posted 17 October 2012 - 09:06 PM
yes sorry lots of nothingness in line anyways just info in sections for display. anyways i did try not sure what the difference is from ",count," and "..count.." same line new issue attempt to concatenate string and boolean.. I am gonna look up that concatenate string cause not a clue what that is supose to mean… thanks for the help so far all.. Note: this was pose to be a simple script but no it being not nice
2088 posts
Location
South Africa
Posted 18 October 2012 - 05:41 AM
Concatenate means to join words. Like the use of the ' in I'm - it's used to concatenate I and am.
8543 posts
Posted 18 October 2012 - 03:58 PM
Concatenate means to join words. Like the use of the ' in I'm - it's used to concatenate I and am.
That's a contraction, not a concatenation.
2088 posts
Location
South Africa
Posted 18 October 2012 - 04:08 PM
Concatenate means to join words. Like the use of the ' in I'm - it's used to concatenate I and am.
That's a contraction, not a concatenation.
Lmao, my english is fading away…
1688 posts
Location
'MURICA
Posted 18 October 2012 - 04:38 PM
print("|", i," ", color[i], " ","|",count[i]," ", " "," |",colors.test(y, 2^(i-1)))
To concatenate text with other variables you use ..
print("|"..i.." "..color[i].." ".."|"..count[i].." ".. " ".." |"..colors.test(y, 2^(i-1)))
That line is difficult to read lol, I might have screwed up somewhere
Unless I'm mistaken and it was changed in computercraft, print() can take a variable number of arguments, which is what he's doing here.
Using commas in print() is perfectly valid.
2005 posts
Posted 18 October 2012 - 07:26 PM
Yes, print can take an argument list. But when you want the output to be formatted in a specific way, it's often better to concatenate the string and use a single argument. Otherwise things end up mashed together. You can still make it work, though.
4 posts
Posted 19 October 2012 - 01:59 AM
thanks for the info and assist it is working now "..count.." wasnt working and throwing up concatenate issue. went back to doing
",count," and fixed some typing errors
2088 posts
Location
South Africa
Posted 19 October 2012 - 01:43 PM
print("|", i," ", color[i], " ","|",count[i]," ", " "," |",colors.test(y, 2^(i-1)))
To concatenate text with other variables you use ..
print("|"..i.." "..color[i].." ".."|"..count[i].." ".. " ".." |"..colors.test(y, 2^(i-1)))
That line is difficult to read lol, I might have screwed up somewhere
Unless I'm mistaken and it was changed in computercraft, print() can take a variable number of arguments, which is what he's doing here.
Using commas in print() is perfectly valid.
Is this in CC 1.4?
8543 posts
Posted 19 October 2012 - 03:31 PM
print("|", i," ", color[i], " ","|",count[i]," ", " "," |",colors.test(y, 2^(i-1)))
To concatenate text with other variables you use ..
print("|"..i.." "..color[i].." ".."|"..count[i].." ".. " ".." |"..colors.test(y, 2^(i-1)))
That line is difficult to read lol, I might have screwed up somewhere
Unless I'm mistaken and it was changed in computercraft, print() can take a variable number of arguments, which is what he's doing here.
Using commas in print() is perfectly valid.
Is this in CC 1.4?
Yes, and at least several versions prior. It's still a good idea to always concatenate when you want concatenation, though.
2088 posts
Location
South Africa
Posted 19 October 2012 - 03:45 PM
Well I'm still using V1.33. That's why I didn't know about it :P/>/> And I still would prefer to use double dot, because I'm now use to it.
8543 posts
Posted 19 October 2012 - 03:52 PM
Well I'm still using V1.33. That's why I didn't know about it :P/>/> And I still would prefer to use double dot, because I'm now use to it.
As I just said, it's been in for several versions. That functionality is certainly in 1.33, so the version you're on has no bearing. Also, that version is highly outdated. You should update to 1.41, if you want to stay on 1.2.5, or later versions for 1.3.2.
2447 posts
Posted 19 October 2012 - 06:03 PM
It was in the very first version of ComputerCraft and is standard Lua behaviour.
2005 posts
Posted 19 October 2012 - 06:38 PM
Yeah, the main reason not to use it is that concatenate actually produces a string that can be used in other situations which demand a string rather than an argument list of things that can be printed. That builds up good habits. I also feel like concatenate (by making a string) gives better control over formatting the output (which is useful at times), but this is more an impression. Really, when all the arguments passed in would be valid if concatenated, the output should be pretty identical.