Suppose ifThis is going to make me cry. Have no knowledge with binary.
Bro, say, i = 0, and j=0
what is this trying to call?
$WOE_CONTROL[.@i+3]&(1<<.@j)
also, what does & do in that function? and what actually is it trying to do?
Thank you very much for patience bro.Suppose ifThis is going to make me cry. Have no knowledge with binary.
Bro, say, i = 0, and j=0
what is this trying to call?
$WOE_CONTROL[.@i+3]&(1<<.@j)
also, what does & do in that function? and what actually is it trying to do?
$WOE_CONTROL[0],1,3,4,7;
i=0 that means .@i+3 = 0+3 = 3, it will call $WOE_CONTROL[3](which have value 7 as mentioned on above line)
So if .@j = 2
(1<<2) = 4, putting all in the statement , it will look like "7&4" Which will be true, & means that the first value contains second value or not(don't know how to explain if you are not familiar with binary)
& Defination on Script_Command:
The bitwise operator AND (&is used to test two values against each other, and results in setting bits which are active in both arguments. This can be used for a few things, but in Hercules this operator is usually used to create bit-masks in scripts.
Bitwise Opeartions Defination on Wikipedia: http://en.wikipedia.org/wiki/Bitwise_operation
7&4 will return 4Thank you very much for patience bro.
if (7&4)will return true because 7 contains 4?
did I understand it correctly?
$Castles=array( "prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05", "payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05", "gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05", "aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05", "arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05", "schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05"); $Days = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); $result = mysql_query('SELECT * FROM mapreg WHERE varname="$WOE_CONTROL"'); $WOE_CONTROL = array(); while($row = mysql_fetch_array($result)) { $WOE_CONTROL[$row['index']] = $row['value']; } $x=0; while($x<count($WOE_CONTROL)) { echo '<br />'; echo $Days[$WOE_CONTROL[$x]]; echo '<br />'; echo $WOE_CONTROL[$x+1] .":00 - ". $WOE_CONTROL[$x+2] .":00"; $j=0; while($j<30) { if ($WOE_CONTROL[$x+3]&(1<<$j)) { echo " ~ ".$Castles$[$j]; } if ($x+4 < count($WOE_CONTROL)) {echo " "}; $j=j+1; } $x=$x+4; }
LOL ... you did well thoughI thought can let you handle ... oh wellEdit:Annie Viewing topic, probably would answer better than me.
prontera,156,184,5 script sdfhsdkfjs 100,{ .@nb = query_sql( "select `index`, `value` from mapreg where varname = '$WOE_CONTROL'", .@index, .@value ); for ( .@i = 0; .@i < .@nb; .@i++ ) .@woe[ .@index[.@i] ] = .@value[.@i]; dispbottom "There are currently "+ .@nb / 4 +" sessions configured"; for ( .@i = 0; .@i < .@nb; .@i += 4 ) { dispbottom " --- Session No."+( .@i/4 +1 )+" --- "; dispbottom "War on "+ .days$[ .@woe[.@i] ] +". Starts from "+ .@woe[.@i+1] +":00 until "+ .@woe[.@i+2] +":00"; .@c = 0; deletearray .@castle$; for ( .@j = 0; .@j < 30; .@j++ ) if ( .@woe[.@i+3] & 1 << .@j ) .@castle$[.@c++] = .castles$[.@j]; dispbottom "at these castles : "+ implode( .@castle$, "," ); } end;OnInit: setarray .days$[0],"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"; setarray .castles$[0], "prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05", "payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05", "gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05", "aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05", "arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05", "schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05"; end;}
We use essential cookies to make this site work, and optional cookies to enhance your experience.