quote:
Originally posted by Eljay
The way that your code is structured is fine, obviously return will not be executed and execution of that function will continue so I don't know what Cookie is on about there (I actually prefer coding like that, much easier to read and debug without everything being needlessly nested).
After you posted I looked at his proposed code again (several times)... Only after like 5 times looking at those few lines of coding, I realized I made a mistake.
But this was exactly because he did NOT nested the
if structure between brackets { }. So reading and debugging made easier if you don't nest stuff? I realy dont think so... It's more confusing and mistakes happen more quickly, especially when you split things out on several lines. (and reading other scripting topics, such mistakes happen all the time)... edit: see again
here (and I can probably keep on updating with more links regulary)...
But thanks for pointing out my mistake.
So, yes, using a negative check like that and returning the _original_ message will work, but besides I think it is not logic to do, it does make code more confusing and execution slower (you should not notice it though)...
Furthermore, the moment you want to make your check a bit better (eg: taking in account the casing of the command, and other tid bits), use regular expressions, want to use more than one command, or want to check on other things too (eg: who the contact is or whatever), your code quickly becomes more confusing and harder to follow if you use a negative check. And you'll find that you'll quickly revert to a positive check in such cases anyways for such stuff.
quote:
Originally posted by The-Phantom
quote:
You would be surprised to know how many people start scripting without properly reading the docs (and then comming here for help) Anyways, I posted that because you asked about changing recieved text. Those are the basics to know for doing that. If that is not what you wanted then I misunderstood you. In that case, could you maybe rephrase your question?
Well, I meant that it is impossible to have a message appear as "received" even though I didn't actually receive it.
So you want to show a kind of status message? Then this doesn't have much to do with changing recieving text. You actually want to _add_ text, if I'm not mistaken.
You indeed can't directly add text to the history window, but you can use
DisplayInfoMessage to show a status message in the chat window. Or you can use toasts.