%words = getword(%words, 0) SPC "trappy" SPC getword(%words, 2);
Why you are learning scripting while in some days you won't even have a tv?
How would I use this with variables?Such as:%var = "123 444 987";setword(%var, 1, -= 10);Or something?
function switchWord(%text, %word, %replace) { %r = 0; for(%i = 0; %i < getWordcount(%text); %i++) { if(getWord(%text, %i) $= %word) { %text = setWord(%text, %i, %replace); %r = 1; } } return %r;}
what are you trying to do?in words please
Code: [Select]function switchWord(%text, %word, %replace) { %r = 0; for(%i = 0; %i < getWordcount(%text); %i++) { if(getWord(%text, %i) $= %word) { %text = setWord(%text, %i, %replace); %r = 1; } } return %r;}That should work. And I added a return if it changes any words.
Wouldn't that just be the same as setWord?