how to determine the value 6 is in the array ?
I'm sure most people will loop it
yeah ~ this is so basic ~
Now let me show you 3 other methods
Method No.1 -> use while loop
Method No.2 -> compare with strings
Method No.3 -> use array as pointers
And of course don't forget, rAthena's *countinarray
OK seriously this one is cheating-------------------------------------------------------
Of course all 3 methods has its own weakness
Method no.1 - it run an extra index within the while-loop
this one will throw error
Method no.2 - when using *countstr, countstr("#1#1#1#", "#1#"); will return 2
means, "#1#1#1#" is for *compare script command,
"#1##1##1#" is for *countstr
Method no.3 cannot use string, like IP address
.@abc["127.0.0.1"] <-- of course doesn't work
External Links:
Help removing duplicate value from arrayHow to make list ID for mobs (method No. 1)
Special Party Warper (method No.2)
Please help this script about mac-address (method No.2)
getitemname2 function (method No.3)
party soul link (method No.3)
No comments:
Post a Comment