![]() |
My script isn't working, what to do. A step by step guide.
How i check my scripts.
I understand that i am quite the nooby scripter, but i figured that there are more noobier scripters out there. And i was hoping this method i use might help more people. This method is strictly about problems that the npc server doesn't show when you update your script. This is the script that i will be using to demonstrate this method, i have deliberately faulted it, because i thought it would be clearer like this then working with a functional script. PHP Code:
NOw here is the method i use: I take this line: PHP Code:
And i put it after the first conditional, like this. PHP Code:
my player will say "succes". I will delete the player.chat i have put in my script, and put it after the next conditional. Like this. PHP Code:
which means that there is an error somewhere in the script between here and the last conditional. The error is obviously that player.z starts at 0, so as long as our player is on the ground, nothing will happen. Once we fix this, this script is still not working, because there is also an error further ahead in the script. So if you know how your script is supposed to work, you can check it step by step, in the order of which your script is supposed to work. And you should be able to locate the errors. Now that you have located the errors, you can use the /scripthelp command on the RC, Check the wiki. http://wiki.graal.us, search the forum if a topic about it exists, ask a friend for help, and if all of that didn't work, post a topic on the forums about your problem. I hope this has helped some people, and again, i know that i'm not a good scripter(yet). But i think this method might help some people. And help people understand how their scripts work. And how to fix them if they are not working. And, although i might have better put this at the start, in case you don't understand what the script is supposed to do. this is a script that makes your player jump in the air, although not over objects yet. |
Hmm- what is it you're trying to do? like a jump script?
|
Quote:
|
I did- but really it sounded as though you had a problem, not how you debug your graal codes lol
|
It also helps to use functions instead of excessive amounts of nesting.
|
I don't mean to sound rude- but can you also explain what your code is supposed to do? thank you
|
Quote:
Quote:
|
Quote:
|
Quote:
HTML Code:
function onKeyPressed(code, key) { |
Not a bad help. I'm sure it will help many people. It's ok to script things into your scripts to help you see what's going on.
|
sleep() is terrible by the way, guys. Use scheduleevent/timeout or waitfor depending on what you need.
|
Quote:
|
Quote:
|
Quote:
|
Debugging takes a little logic and problem-solving skills. If you lack that, good luck!
|
| All times are GMT +2. The time now is 12:40 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.