From: superuser
No that's not the issue. This happens only with R_LastChatMessage. For instance, with
function Foo(): string;
begin
result := 'abcdefg'
end;
try
while(Pos('lay a trap here', Foo()) <> 0) do
wait(200);
except
writeln(ExceptionParam());
end;
the violation does not happen.
That's because the function is NOT indirectly called.. yes your calling Foo() directly and foo returns a result.. it's using that result (string).. thats y u don't get a violation.
Just try what I said with the interfaces and u will see.. I use R_Lastchatmessage all the time and don't get access violation unless I do it the way u did in the first post..
when u use R_LastChatMessage as a parameter, it doesn't just return the string directly like your foo function.. but rather it returns a function that returns a string… thats why u get that error. It returns:
R_GetInterfaceText(Interface, i); which returns a string.. so your using a function as a parameter which uses another function to get its result will definitely give u access violation.
In calculus you'd actually have to get the value of the function inside first.. then use that value to solve the outer function.. the computer doesn't do that for u.. its the programmer's job to do the inside function first and then pass the result to the outer function.. C++ is strict on this too.. u can never use a function inside a function (used as a parameter).
Oh and I just compiled your first post.. I didn't get any errors.. Infact I found something weird with it.. it outputs:
<col=0000ff>Meh
whenever I do writeln(LastChatMessage);
EDIT: Use this: R_TrimHTML(R_LastChatMessage); that will take out the <Col=0000ff> thing.. see if it helps u. Oh yeah it also shows username..
so username: message.. might wanna trim that off.
Edit2: In reply to ur post below:
From: superuser
Sorry, but that is just bull :) This is 100% valid and working:
And the same should go to PS, and it will at least for Pascal itself. Besides, computer doesn't do anything for you when talking about programming, the compiler/interpreter does ;)
So the way I see this, is that this version of PS has a bug in it.
I like the ignorance.. first off ur code proves nothing.. thats not a function inside a function now is it? Thats functions inside classes.. no one said thats illegal. Functions inside functions are.. well declaring them are. Secondly The link below to Coh3n's post does exactly what I just told u to do.. which is to assign R_LastChatMessage to a variable.. Last but not least, u can be picky and call it a compiler/interpreter.. either way its still the programmer's job to do the work and the computer gives the result not the compiler/interpreter.. when u run a program it runs through ur computer bud, not ur compiler.. Last but not least.. if my post is bull, explain why it works then. Coh3n's post does exactly what I said. Good luck with ur scripting.