Expected top-level declaration but found: Difference between revisions

From OHRRPGCE-Wiki
Jump to navigation Jump to search
mNo edit summary
See Also: fix link
Line 44: Line 44:
=See Also=
=See Also=
* [[Why can't I have more than one script at a time?]]
* [[Why can't I have more than one script at a time?]]
* http://hamsterrepublic.com/ohrrpgce/plotscripttutor.html
* [[Plotscripting Tutorial]]


[[Category:FAQ]]
[[Category:FAQ]]
[[Category:Plotscripting]]
[[Category:Plotscripting]]
[[Category:Error Messages]]
[[Category:Error Messages]]

Revision as of 14:37, 5 September 2007

This error message means you have written your script wrong. Here is an example of a script that would generate this error:

include, plotscr.hsd

define script (1,Hello World,none)

show text box (1)
wait for text box
walk hero (me,north,3)
wait for hero (me)
set hero direction (me,south)

If you tried to compile this script, you would see an error message saying;

ERROR: in line 5 of test.hss
show text box (1)
Expected top-level declaration, but found hardcoded function showtextbox. 
Perhaps there is an extra end or ) earlier in the file

This error can be a little misleading. Sometimes this error does occur because you have an extra end or ) somewhere in your script, but in this example it is happening because you did not use a script command to mark the beginning of your script. The same script, if written correctly, would look like this:

include, plotscr.hsd
include, pstutor.hsi

define script (1,Hello World,none)

script, Hello World, begin
  show text box (1)
  wait for text box
  walk hero (me,north,3)
  wait for hero (me)
  set hero direction (me,south)
end

Notice the script, Hello World, begin that marks the beginning of the script, and the end that marks the end of the script. It is neccesary to separate your scripts this way because a single script file can contain many individual scripts.


See Also