"Too Many Parameters" or "Expecting Expression" bu
Blitz3D Forums/Blitz3D Beginners Area/"Too Many Parameters" or "Expecting Expression" bu
| ||
I am recently unable to compile a project due to an unusual error. The error points to a line which calls function that is void and accepts no arguments. Even if I comment out the contents of the function, the error remains, however, if I comment out the call TO the function, the compilation works. Without posting all the entire code of my project, here's the main parts t6hat cause the problem: While Not(KeyDown(1)) If (TIMER_PAUSED) PausedLoop() Else MainLoop() End If Wend Function PausedLoop() StartLoop() DisplayPausedScreen() Render() End Function Function MainLoop() StartLoop() UpdatePresenters() ; THIS IS THE LINE RETURNED AS THE COMPILATION ERROR Render() End Function The function refrerrred to above is here: Function UpdatePresenters() If (Not(ChannelPlaying(CHANNEL_PRES))) PRES_DISPLAYED=False End If If (PRES_DISPLAYED) DisplayPres() Else StopPresChannel() End If End If End Function [/code] The functions from here are: Function StopPresChannel() If (CHANNEL_PRES) If (ChannelPlaying(CHANNEL_PRES)) FreeSound PRES_SOUND% PRES_SOUND=0 StopChannel CHANNEL_PRES End If End If If (PRES_DISPLAYED) PRES_DISPLAYED=False End If End Function Function DisplayPres() DrawImage IMAGE_PRES,POSX_IMAGE_PRES,POSY_IMAGE_PRES End Function Other functions called from the above: Function Render() UpdateWorld RenderWorld Flip Function StartLoop() Cls End Function As you can see, this doesn't make any sense to me at all. I have tried removing all the unnecessary () from void function calls, but can't find anything out of place... If any more of the code is needed to diagnose further, let me know and I'l poast up what I can. This really seems odd to me, but I'm probably just nmissing something startlingly obvious ;) |
| ||
Looks like you have one too many EndIf in UpdatePresenters? Not that I can see how that would cause the error in question, but it's an error to fix (assuming you didn't just chop out a chunk of irrelevant stuff for the example and take the matching If with it). Upon fixing that error (and commenting out DisplayPausedScreen, and adding a Graphics3D line at the top), the code as given runs correctly. Out of curiosity, is there a reason why you appear to be using globals to replicate function parameters? Last edited 2011 |
| ||
Okay, the UpdatePrersenters(), you were right, I had removed some irrelevant stuff: Here's the entire version with the related Subtitle text function - it should be fairly obvious what it does :) Incidentally, you mentioned DisplayPausedScreen, for completeness, this is just: Function DisplayPausedScreen() DrawImage IMAGE_PAUSED_SPLASH,POSX_IMAGE_PAUSED_SPLASH,POSY_IMAGE_PAUSED_SPLASH End Function Yes, the globals are effectively 'Static' in some cases, the DrawImage parameters are where the positions are related to screen dimensions and are declared accordingly after the screen resolution is set. For others, such as the sounds/channels, it's possible for example, the PRES_SOUND to be a different soundclip, and PRES_IMAGE will be a relevant "portrait image" accordingly. Depending who's "talking" and when, these may be changed elsewhere, but in the main-loop it should just display whichever is relevvant, so by using Global handles the correct details can be stored here. -------------- Thanks for looking, Yasha, I guess it shows the error should be elsewhere then, so I'll have a look through ALL the functions again and see if I can find anything... |
| ||
Well I still don't knwo what happened, but I made a few changes which to my understanding shouldn't have mattered, just moving the Puased loop stuff out etc. but somehow the issue cleared up! Although the evidence suggests something wonky with the compiler, maybe IDEal highlighting the wrtong line (again) oir similar, I'm pretty ssure the root cause was some bad programming/syntax somewhere... Anyway, it's all cleared up now :) |
| ||
It's magic when that happens! |
| ||
If IDEal throws error messages at me without apparent reason, inserting an empty line before or after the line in question mostly resolves the issue. If not it's your error. ;-) |