OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: reima on 26 Apr 2005, 11:21:21

Title: Invalid number of expression ?
Post by: reima on 26 Apr 2005, 11:21:21
Hi, I have a small problem..

I was reading Johan Gustafson's scripting tutorial and I managed to make the 'hello.sqs' -file.
BUT
When I clicked 'preview' it said 'error: invalid number of expression' ? or sumthing..
(and I did everything as the tutorial said?) What's my problem   ???
Title: Re:Invalid number of expression ?
Post by: macguba on 26 Apr 2005, 11:28:58
You probably have a tiny error somewhere:   a single letter wrong, or : instead of a ;.    Check through it again.

Whenever you get an error message, always quote it exactly in the forum.    It really helps us understand what's going on.   The error message usually includes a hash sign #, which indicates where in the line of code the error has occurred.   (It isn't always right, but it helps.)

Oh, and

Welcome to the forum!
Title: Re:Invalid number of expression ?
Post by: reima on 26 Apr 2005, 11:37:34
Thanks :)

this is what it says:

Titletext [|#| "hello!", "plain down"]' : error invalid number in expression

and this is my hello.sqs

TitleText ["Hello!","plain down"];exit <- something wrong?

this is my first day when im editing missions so don't be mad at me

 ;)

Title: Re:Invalid number of expression ?
Post by: macguba on 26 Apr 2005, 11:47:12
We're not mad, questions like this is what the forum is for.    You're doing exactly the right thing - having a go at a tutorial and asking for help here when you get stuck.

However, I'm not sure what the problem is.   It should work.  Try putting the exit on the next line like this:-

titleText ["Hallo!","plain"]
exit

Check that there are no extra spaces, for example it should be [" not [ "
Title: Re:Invalid number of expression ?
Post by: reima on 26 Apr 2005, 12:02:14
Hum.. I copy pasted that script straight from that tutorial so it should be ok.
I'm thinkin' that could there be something wrong with my game?
I'm using the FDF - mod ( Finish Defensive Forces )  

oh, and one question, what is that "debug console" -thing for?
what does it do?
Title: Re:Invalid number of expression ?
Post by: Blanco on 26 Apr 2005, 12:14:26
Quote
Hum.. I copy pasted that script straight from that tutorial so it should be ok.

Don't copy/paste it, type in yourself, the faster you will learn :)

Your code is right but I think you are using the wrong parenthesis
See the difference between

WRONG!
Code: [Select]
titleText ["Hallo!","plain"]and

RIGHT
Code: [Select]
titletext ["Hallo!","plain"]
When you copy the text from the tutorial the parenthesis will look like this

""

when you type it, it looks like this

""
Title: Re:Invalid number of expression ?
Post by: reima on 26 Apr 2005, 12:19:10
wow, I typed it myself and it worked.. :-X
well I got my first lesson now, thanks a lot :)
Title: Re:Invalid number of expression ?
Post by: h- on 26 Apr 2005, 18:20:33
Check that there are no extra spaces, for example it should be [" not [ "
Oh I just need to nitpick, again...
That bears no relevance macca... works even if you have 8000 spaces between [ and "...

Well, I tried it with 20 spaces, but anyway ::)
Title: Re:Invalid number of expression ?
Post by: macguba on 26 Apr 2005, 18:35:23
I was guessing.  ;D  Didn't spot the quotes thing.    Nitpicking scripts is not my strongpoint anyway.   ::)
Title: Re:Invalid number of expression ?
Post by: Blanco on 26 Apr 2005, 22:28:42
Solve the topic, Reima  :)