Sign in to follow this  
Followers 0
Guest Py7|-|[]/\/

Problem With StringReplace

9 posts in this topic

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Detranslates Capital Letters From 1337 sk33t to native English.

;Created by the Reaper.

$text = InputBox("Reaper's 1337 Translator.", "Please type in what you would like to translate into 1337 writing.");user input

DetranslateFunc()
Func DetranslateFunc()
   $replaceb = StringReplace($text, "|3", "B", 0, 1)
   $replaceo = StringReplace($replaceb, "()", "O", 0, 1)
   $replaced = StringReplace($replaceo, "|)", "D", 0, 1)
   $replaceh = StringReplace($replaced, "|-|", "H", 0, 1)
   $replacei = StringReplace($replaceh, "1", "I", 0, 1)
   $replacek = StringReplace($replacei, "|<", "K", 0, 1)
   $replacew = StringReplace($replacek, "\/\/", "W", 0, 1)
   $replacem = StringReplace($replacew, "/\/\", "M", 0, 1)
   $replacen = StringReplace($replacem, "/\/", "N", 0, 1)
   $replacec = StringReplace($replacen, "[", "C", 0, 1)
   $replaces = StringReplace($replacec, "5", "S", 0, 1)
   $replacet = StringReplace($replaces, "7", "T", 0, 1)
   $replacev = StringReplace($replacet, "\/", "V", 0, 1)
   $replacex = StringReplace($replacew, "><", "X", 0, 1)

;End Capital Letters

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Begin Lowercase

   $rplca = StringReplace($replacex, "@", "a", 0, 1)
   $rplcc = StringReplace($rplca, "(", "c", 0, 1)
   $rplce = StringReplace($rplcc, "3", "e", 0, 1)
   $rplcl = StringReplace($rplce, "|", "l", 0, 1)
   $rplco = StringReplace($rplcl, "0", "o", 0, 1)
   
   MsgBox(0, "Your translated text is:", $rplco)
EndFunc

Whenver I input a 5, or a 7, it won't translate it into S or T. I don't know why... Please help me figure out the problem...

Share this post


Link to post
Share on other sites



Here's a brilliant idea. How about you use one variable instead of using one variable per line, as I'm fairly certain you've gotten yourself confused and are trying to replace the wrong variable and getting some replacements lost somewhere. Your code is way overcomplicated by the idiotic usage of variables.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

this will work , but i dont understand why urs dosnt

Edit : Damnit cyberslug i cant believe i overlooked that :)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Detranslates Capital Letters From 1337 sk33t to native English.

;Created by the Reaper.

$text = InputBox("Reaper's 1337 Translator.", "Please type in what you would like to translate into 1337 writing.");user input

DetranslateFunc()
Func DetranslateFunc()
  $text = StringReplace($text, "|3", "B", 0, 1)
  $text = StringReplace($text, "()", "O", 0, 1)
  $text = StringReplace($text, "|)", "D", 0, 1)
  $text = StringReplace($text, "|-|", "H", 0, 1)
  $text = StringReplace($text, "1", "I", 0, 1)
  $text = StringReplace($text, "|<", "K", 0, 1)
  $text = StringReplace($text, "\/\/", "W", 0, 1)
  $text = StringReplace($text, "/\/\", "M", 0, 1)
  $text = StringReplace($text, "/\/", "N", 0, 1)
  $text = StringReplace($text, "[", "C", 0, 1)
  $text = StringReplace($text, "5", "S", 0, 1)
  $text = StringReplace($text, "7", "T", 0, 1)
  $text = StringReplace($text, "\/", "V", 0, 1)
  $text = StringReplace($text, "><", "X", 0, 1)

;End Capital Letters

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Begin Lowercase

  $text = StringReplace($text, "@", "a", 0, 1)
  $text = StringReplace($text, "(", "c", 0, 1)
  $text = StringReplace($text, "3", "e", 0, 1)
  $text = StringReplace($text, "|", "l", 0, 1)
  $text = StringReplace($text, "0", "o", 0, 1)
 
  MsgBox(0, "Your translated text is:", $text)
EndFunc
Edited by killaz219

Share this post


Link to post
Share on other sites

CyberSlug thanks a lot, I seem to have overlooked that many times =(. I appreciate all of yours and Valik's help.

Share this post


Link to post
Share on other sites

Does anyone have a runescape account i can have because i need a better account then a lvl 3 or 11 that i have!

I did have a lvl 57 account but he got hackd...Lots or rares(Looks like this )Had bunch of those...please if you could pm me or email me i would really like it....thanks!

Share this post


Link to post
Share on other sites

$szTXT = StringReplace( $szTXT, $ref[$i+1], $ref[$i] )

You also have an extra ` character here:

$ref = "|3`B`()`O`|)`D`|-|`H`1`I``|<`K`\/\/`W`/\/\`M`" & _

"/\/`N`[`C`5`S`7`T`\/`V`><`X`@`a`(`c`3`e`|`l`0`o"

This should work :)

$text = InputBox("Reaper's 1337 Translator.", _
     "Please type in what you would like to translate into 1337 writing.")

DetranslateFunc( $text )

MsgBox(0, "Your translated text is:", $text)

Func DetranslateFunc( ByRef $szTXT )
  If Not StringLen($szTXT) Then Return

  $ref = "|3`B`()`O`|)`D`|-|`H`1`I`|<`K`\/\/`W`/\/\`M`/\/`N`[`C`5`S`7`T`\/`V`><`X`@`a`(`c`3`e`|`l`0`o`"
  $ref = StringSplit($ref,"`")

  For $i = 1 to ( $ref[0] - 1 ) Step 2
     MsgBox(4096,$i, $szTXT)
     $szTXT = StringReplace( $szTXT, $ref[$i+1], $ref[$i] )
  Next
EndFunc

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Thanks, but that ByRef thing is too complex for my simple mind. I will stick with the one I have now =)

Share this post


Link to post
Share on other sites

I'm sorry Larry... But I don't understand it from the Func part down... =( Maybe you could put a comment or two?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0