Author Topic: Debugging scripts  (Read 9481 times)

0 Members and 2 Guests are viewing this topic.

Offline erwin

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
Debugging scripts
« on: August 10, 2014, 03:31:22 pm »
This thread will hopefully list common errors (in syslog), and how to find and fix them. The thread assumes that the errors are not because of nohassle / imm level > 50, so it's meant for errors that occur with players, or imms with nohassle off and level at 50 or below.

Anyone can post on this thread - hopefully with the parts: Error Message -> Examples -> Consequences of (not) fixing it

Hopefully this thread will be unneeded if there's a code upgrade which will show where the errors are (i.e. which lines in the script).
« Last Edit: August 10, 2014, 03:46:57 pm by erwin »

Offline erwin

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
Re: Debugging scripts
« Reply #1 on: August 10, 2014, 03:40:16 pm »
Error: :: osend called without a message

This error comes about because there is nothing to be sent, so here are two examples of where this error comes about:

First example:

This usually occurs when copying and pasting scripts in the client where there is a colour code. Eg, suppose you wanted a line break, and you actually had:

Code: [Select]
%echo% {cx
%send% %actor% {cx
%echoaround% %actor% {cx

However, copying and pasting this in a client would lead to copying and pasting just

Code: [Select]
%echo%
%send% %actor%
%echoaround% %actor%

Hence an error.

Second example:

When a variable hasn't been defined yet, and you want to send / echo it. Suppose you had a quest with dynamically generated passwords, and the variable %password% could be something random, eg

Code: [Select]
set password %random.5%
and later

Code: [Select]
%send% %actor% The password is:
%send% %actor% ...
%send% %actor% %password%

If the second snippet is run first, and %password% hasn't been defined, then the error will occur.

Consequences of this error in syslog: For the first example, not really game-breaking, since it's more of a cosmetic issue (do line breaks look nice?) But for the second example, it might break a quest or two..

How to spot this error: Just search for lines that are of the form:

Code: [Select]
%send% %actor%
%echoaround% %actor%
%echo%
%echo% %blahblah%
%send% %actor% %blahblah%

etc
« Last Edit: August 10, 2014, 03:47:50 pm by erwin »