Miniwindow error (possibly bigger issue)

Posted by Essidus on Mon 18 Aug 2008 08:07 PM — 6 posts, 22,299 views.

#0
So far, every attempt I've made at using the miniwindows has come back with this error:

Script error
World: main
Execution of line 1 column 82
Immediate execution
Cannot use parentheses when calling a Sub
Line in error:
world.WindowCreate("test", 0, 0, 300, 300, 12, 0, world.ColourNameToRGB("white"))

It sounds like a deeper issue than the mini window scripting, but I wanted to make sure before I start digging deeper. Currently, I'm coding in VBScript
USA #1
The error is pretty much what it says: you're not supposed to use parentheses when you call a sub in VBScript. :-)
#2
*groan* I'm clearly braindead. Sorry for even bothering you guys with this
Australia Forum Administrator #3
Just to make it clear what we mean, it should read:


WindowCreate "test", 0, 0, 300, 300, 12, 0, world.ColourNameToRGB("white")


VBscript has this strange syntactical requirement that you must have brackets if you are calling a function (which returns a value) and must not, if you don't.

However it really depends on whether you want the result. WindowCreate returns a status code, so all you really need to do is request it:


status = WindowCreate("test", 0, 0, 300, 300, 12, 0, world.ColourNameToRGB("white"))

If status <> 0 Then
  Note "Problem creating window"
EndIf


If I may suggest, Lua is the recommended language these days, is about the same difficulty to learn as VBscript (not much) and doesn' t have this syntactic problem.
Amended on Mon 18 Aug 2008 09:02 PM by Nick Gammon
#4
status = WindowCreate("test", 0, 0, 300, 300, 12, 0, world.ColourNameToRGB("white"))

If status <> 0 Then
Note "Problem creating window"
EndIf



Where would that be pasted? In a trigger or in a script file?
Australia Forum Administrator #5
Put it wherever you want to create the window. A script file or plugin would be the normal place.