redndahead Posted February 11, 2004 Share Posted February 11, 2004 (edited) Alright not so lazy and decided to do it. Must be in between 2 and 62 Here it is Func DecConvert($dec,$Div) If $div > 62 or $div < 2 Then Return(-1) EndFunc EndIf $ans = "" $letterValues = ".........ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" While $dec > $Div - 1 $val = mod($dec,$div) If $val > 9 Then $val = stringmid($LetterValues,$val,1) EndIF $ans = $val & $ans $dec = int($dec / $div) Wend If $dec > 9 Then $dec = stringmid($LetterValues,$dec,1) EndIF Return($dec & $ans) EndFunc Not too bad only 20 lines of code. red Edited February 11, 2004 by redndahead Link to comment Share on other sites More sharing options...
redndahead Posted February 11, 2004 Share Posted February 11, 2004 Fun Test Script $ans = DecConvert(8513821109,60) MsgBox(0,"",$ans) Exit Func DecConvert($dec,$Div) If $div > 62 or $div < 2 Then Return(-1) EndFunc EndIf $ans = "" $letterValues = ".........ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" While $dec > $Div - 1 $val = mod($dec,$div) If $val > 9 Then $val = stringmid($LetterValues,$val,1) EndIF $ans = $val & $ans $dec = int($dec / $div) Wend If $dec > 9 Then $dec = stringmid($LetterValues,$dec,1) EndIF Return($dec & $ans) EndFunc By the way did these work for you Lemures? since you were the one that asked for it? red Link to comment Share on other sites More sharing options...
CyberSlug Posted February 11, 2004 Share Posted February 11, 2004 Nice You should remove the "EndFunc" that follows Return(-1). It is not needed and AutoIt 3.0.93 complains about it. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
redndahead Posted February 11, 2004 Share Posted February 11, 2004 (edited) Didn't know that it automatically returned. Cool saved me a line of code. =) I must say though i haven't tested bartokv's code it is really cool that you can convert anything. Impressive red Edited February 11, 2004 by redndahead Link to comment Share on other sites More sharing options...
Lemures Posted February 12, 2004 Author Share Posted February 12, 2004 lol, god i love this community.... anyways, using using the dec->bin code, i completed my thingy.. lol... http://www.rage3d.com/board/showthread.php...readid=33741645see if any of you can figure it ou! Link to comment Share on other sites More sharing options...
Valik Posted February 12, 2004 Share Posted February 12, 2004 Which function did you end up using? Link to comment Share on other sites More sharing options...
Bartokv Posted February 12, 2004 Share Posted February 12, 2004 And anyway who uses anything higher except for base 16?I agree with you there. I mainly use decimal/hexadecimal, and occasionally binary... (Try to avoid octal whenever possible)I didn't really post my code as a recommended solution. I just thought about an interesting way achieve the desired results, and decided to post the code strictly for the absurdity factor. ...To paraphrase Larry, I used a sledge hammer to drive a finishing nail. Link to comment Share on other sites More sharing options...
trids Posted February 12, 2004 Share Posted February 12, 2004 Another way to stroke the cat .. http://www.hiddensoft.com/forum/index.php?...findpost&p=4838 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now