Hi guys,
i just tried messing with the click event and found out that you can click on signs to read their content with this very simple code in a npc in the first level of your world:
Visit Graal Classic Adventure to try it out!
Feel free to use this!
(Some part of me believes this must have already been done by someone else, but I can’t find anything on this forum about it)
// NPC made by Fredi
if (playerenters){
toweapons -sign_click
}
if (mousedown && isweapon) {
if (leftmousebutton){
for (i=0; i<signscount;i+=1){
if (mousex-signs[i].x <2 && mousey-signs[i].y<1 && mousex-signs[i].x>=0 && mousey-signs[i].y>=-1)
{
say i;
}
}
}
}
if (mousedown && isweapon) if (leftmousebutton) for (i=0; i<signscount;i+=1) if (mousex-signs[i].x <2 && mousey-signs[i].y<1 && mousex-signs[i].x>=0 && mousey-signs[i].y>=-1) say i;[/code]
if (mousedown && isweapon) if (leftmousebutton) for (i=0; i<signscount;i+=1) if ((mousex-signs[i].x) in |0,2| && (mousey-signs[i].y) in |-1,1|) say i;[/code]
huahua
Nope. I think it all gets compiled down to the same thing. If you want to optimise the script, try having it exit the for loop after the if conditional is met.
Spooon’s is 100 “instructions” and 189 total bytes. tricxsta’s is 72 instructions and 145 bytes. In Graal terms, tricxsta’s will actually execute faster, though the difference is going to be small.
Gs1 never compiled into bytecode. The scripts are sent plaintext from server to client. The client then interprets the text. Everytime you surf to a PHP page, the server has to compile it in real time (unless you use addons), GS1 works the same way as every client needs to interpret the text sent from the server when connecting. Gs1 scripts aren’t stored/cached like gs2 is.
I wasn’t thinking about the fact that outdated shit is still being used here. Of course I know that 2.22 doesn’t do it the same way, although I wouldn’t be so sure that it isn’t compiled into bytecode. And how the fuck did you double post without annoying auto-merging?
Since GS1 is probably made by Stefan himself (back in the days), I wouldn’t doubt that it would be inefficient piece of turd. The script interpreter loop is what causes the 99% CPU usage in pre 2.31 clients.
The reason the posts wasn’t auto-merged was because I used the tapatalk client on my iphone which bypasses the auto-merge script.