• Welcome to Valhalla Legends Archive.
 

Channel Type's?

Started by BaDDBLooD, March 07, 2004, 09:32 PM

Previous topic - Next topic

Kp

Quote from: hismajesty on March 08, 2004, 02:19 PM
Seeing as how Kane doesn't use VB they may be the comment character used in his language (I forget the name, but it's said to be similar to VB). I guess, the Mac version of VB. :P

Kane uses REALBasic, iirc.  (Yes, that's the capitalization it uses too.)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Eli_1

#16
Quote from: hismajesty on March 08, 2004, 02:19 PM
Seeing as how Kane doesn't use VB they may be the comment character used in his language (I forget the name, but it's said to be similar to VB). I guess, the Mac version of VB. :P

I wasn't trying to criticise Kane about it, was just trying to make aware that the value of the constants like kChannelFlags_Public wasn't 1//0x1, it was 1 with a comment of 0x1...  :P

I think he uses Real Basic REALBasic btw

BaDDBLooD

Frozen, where can i get those 2 Functions?
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

tA-Kane

#18
Quote from: Kp on March 08, 2004, 03:46 PMKane uses REALBasic, iirc.  (Yes, that's the capitalization it uses too.)
Actually, it's not. It's REALbasic (note the lowercase 'b').

Quote from: Eli_1 on March 08, 2004, 03:49 PMI wasn't trying to criticise Kane about it, was just trying to make aware that the value of the constants like kChannelFlags_Public wasn't 1//0x1, it was 1 with a comment of 0x1...
Yes. What does VB use for comments? /**/? Or single-quote?

REALbasic uses double-slash (//) and single-quote (') for comments identification.

I prefer to use double-slash since it's also used in C and C++, but REALbasic's method for commenting (eg, you select some code and select the "Comment" menu item, it checks to see if the beginning of the line is a comment-identifier, and if it is, then it removes it, if not, then it adds a single-quote to the beginning of the line.

Quote from: BaDDBLooD on March 09, 2004, 09:50 PMwhere can i get those 2 Functions?

You can make GetBit by using your language's "raise to the nth power" function, or if your language doesn't have that, you can use multiplication and an if statement.

There's an even easier way if your language has a bitshift function.

I'll list examples in C here, but I don't remember the keyword in C to "raise to the nth power"... porhaps Yoni might? :P
unsigned long GetBitByMultiplication(int BitNum){
 int i;
 unsigned long rVal;
 
 for (i = 0, rVal = 1; i < BitNum; i++){
   rVal *= 2;
 }
 return rVal;
}

#define GetBitByBitShift(BitNum)  (1 << BitNum)
//now to clean up, we should define GetBit as either of these... since GetBitByBitShift is the cleanest (and the fastest), we'll use that...
#define GetBit GetBitByBitShift

I haven't tested this code; I wrote it from memory, but it should work. Shame on me if that's not the case.

edit: actually, you don't even need the if statement.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Adron

Quote from: tA-Kane on March 10, 2004, 12:15 PM
I'll list examples in C here, but I don't remember the keyword in C to "raise to the nth power"... porhaps Yoni might? :P

You don't raise to the nth power with a C keyword... You may call pow, which uses floating point math and the fpu, but normally you'd use bitshifts where possible.

Fr0z3N



Private Function IsBit(ByVal BitString As String, ByVal BitNumber As Integer) As Boolean
   If Mid(BitString, 16 - BitNumber, 1) = "1" Then
       IsBit = True
   Else
       IsBit = False
   End If
End Function

Private Function DecToBin(ByVal Dec As Long) As String
   Dim Temp As String, Retrn As String ' as string so that we don't Get number limitations


   Do
       Temp = str(Dec Mod 2)
       Retrn = Temp & Retrn
       Dec = IIf(Right(str(Dec), 2) = ".5", Dec - 0.5, IIf(Dec Mod 2 > 0, Dec - 1, Dec)) / 2
   Loop Until Dec = 0
   DecToBin = Replace(Retrn, " ", "")
End Function



tA-Kane

Quote from: Adron on March 10, 2004, 02:16 PMYou don't raise to the nth power with a C keyword... You may call pow, which uses floating point math and the fpu
My mistake.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

BaDDBLooD

Why don't clan recruitment, and kbk info show up?
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

Eric

Quote from: BaDDBLooD on March 10, 2004, 03:34 PM
Why don't clan recruitment, and kbk info show up?
[13:37:45] Joining public channel: Clan Recruitment
[13:37:48] Joining public channel: KBK Info

Perhaps you forgot to add or incorrectly added the public channel flag.

Eli_1

Quote from: tA-Kane on March 10, 2004, 12:15 PM
Yes. What does VB use for comments? /**/? Or single-quote?


VB uses single-quote also

tA-Kane

Someone slap me for not paying attention, I feel embarassed. :-[

Sorry for any confusion I made for GetBit instead of IsBit. It's still good code though.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

BaDDBLooD

Lord, would you post your Flag function?
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.