Changing String

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
JJ2197
Legendary Genius
Posts: 1311
Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah

Changing String

Post by JJ2197 »

I want to know if I were to say "a" it would make it "b"
Like for instance if I were to say -a then made it display to myself it would show b

This was my attempt

function StringConv takes string s returns string
if s=="a"then
return "b"
endif
return s
endfunction

if SubString(s,0,2)=="-a"then
call DisplayTextToPlayer(p,0,0,StringConv(s))
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Changing String

Post by weirdone2 »

You'll have to make s=SubString(GetEventPlayerChatString(),1,2)
User avatar
JJ2197
Legendary Genius
Posts: 1311
Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah

Re: Changing String

Post by JJ2197 »

But I don't want it just for 1,2 I want it to do it wherever I say it... =/
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2507
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Re: Changing String

Post by Xantan »

then do multiple comparisons.

if x = s,1,2 , else if x = s,2,3, else... it wont work in the whole thing
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Changing String

Post by weirdone2 »

So something like this?

function StringConv takes string s returns string
local integer i=0
local string ss=""
local integer is=StringLength(s)
loop
exitwhen i>is
if SubString(s,i,i+1)=="a"then
set ss=ss+:b"
else
set ss=ss+"-"
endif
set i=i+1
endloop
return ss
endfunction

Then just make a trigger that registers "" and then it will detect any msg and if the msg contains any a's in it it will display a msg to you with the b for example if somewere were to say "hey what up" it would display "------b----" of cource if they said something like "hello" you would just get "-----"
User avatar
JJ2197
Legendary Genius
Posts: 1311
Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah

Re: Changing String

Post by JJ2197 »

I still want it to show all the string though... like if I said abc it would display bbc... you know... =/

Otherwise this isn't going to work at all for what I have planned...
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Changing String

Post by weirdone2 »

...

function StringConv takes string s returns string
local integer i=0
local string ss=""
local integer is=StringLength(s)
loop
exitwhen i>is
if SubString(s,i,i+1)=="a"then
set ss=ss+"b"
else
set ss=ss+SubString(s,i,i+1)
endif
set i=i+1
endloop
return ss
endfunction
User avatar
JJ2197
Legendary Genius
Posts: 1311
Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah

Re: Changing String

Post by JJ2197 »

Not sure what the ... was for, but thanks it works great...
Though if you care what I am going to use it for... Multi-colors on my say command... 8)
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Changing String

Post by weirdone2 »

My ... represented my silence in the fact that you couldn't figure out hwo to change the - into the orginal chat. ;/

*scolds jj* :P
User avatar
JJ2197
Legendary Genius
Posts: 1311
Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah

Re: Changing String

Post by JJ2197 »

Oh... I just didn't want to do any thinking :lol:
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate