| View previous topic :: View next topic |
| Author |
Message |
Protected Valued Contributor


Joined: 02 Jan 2001 Posts: 228 Location: Portugal
|
Posted: Fri Mar 29, 2002 8:27 pm Post subject: Help! Illegal variable name. |
|
|
I've been working in my program Protected Tiles Pro, and a few days ago I found that, although the program runs perfectly using the "Run" button in the VDS window, the compiled EXE always returns Error 5 in this line:
| Code: | | %%LINETOGOTO = @trim(@regread(CURUSER,Software\ProtectedPrograms\PTP\@iniread(Credits,Title)\Labels,%%LABEL)) |
%%LABEL and @iniread(Credits,Title) aren't null. If the error isn't in this line its somewhere arround it, anyway here you have the whole block:
| Code: | :FindLabel
%%LINETOGOTO = @trim(@regread(CURUSER,Software\ProtectedPrograms\PTP\@iniread(Credits,Title)\Labels,%%LABEL))
if @null(%%LINETOGOTO)
warn Error 000-002 Could not find label %%LABEL" - line "%%SCRIPT
goto Close
end
if @not(@numeric(%%LINETOGOTO))
warn Error 000-002 Could not find label %%LABEL" - line "%%SCRIPT
goto Close
end
LIST SEEK,SCRIPT,%%LINETOGOTO
%%SCRIPT = @INDEX(SCRIPT)
%%LABEL =
goto ComLoop |
Also, when error trapping is enabled, it also makes an error under the own error trapping label, it seems that there is something about the above line that makes it impossible for VDS to keep defining new variables. I tried decrease or increase the number of variables being used but without success. Can anyone help me with this? [/code] |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Mar 29, 2002 9:16 pm Post subject: |
|
|
I'd try setting the %%LINETOGOTO value manually to see if
it's the var name or the @regread() procedure. If it will work
with the var value set, you might try the following and see
what you get:
__________________________________________________________________________________________________________________________
| Code: |
INFO TEST @trim(@regread(CURUSER,Software\ProtectedPrograms\PTP\@iniread(Credits,Title)\Labels,%%LABEL))
|
_________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Protected Valued Contributor


Joined: 02 Jan 2001 Posts: 228 Location: Portugal
|
Posted: Fri Mar 29, 2002 9:20 pm Post subject: |
|
|
| I had already tried that Mac. I tried everything. THAT works. It returns 3 . In that case, TEST 3 . |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Mar 29, 2002 9:51 pm Post subject: |
|
|
So loading the value manually (%%LINETOGOTO = 3) works OK?
Have you tried omitting the @trim() function? You could trim
the var after it gets the @regread() with @trim(%%LINETOGOTO)... _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Protected Valued Contributor


Joined: 02 Jan 2001 Posts: 228 Location: Portugal
|
Posted: Sat Mar 30, 2002 1:23 am Post subject: |
|
|
| The trim function in this case is completely useless and it wasn't there until prakash told me to try it |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Mar 30, 2002 5:46 am Post subject: |
|
|
You might try using an IF statement to make sure %%LABEL is valid
and @regread() is numeric before %%LINETOGOTO is assigned...
_______________________________________________________________________________________________________________________________________________________________________________________
| Code: |
if @both(%%LABEL, @numeric(@regread(CURUSER,Software\ProtectedPrograms\PTP\@iniread(Credits,Title)\Labels,%%LABEL)))
%%LINETOGOTO = @trim(@regread(CURUSER,Software\ProtectedPrograms\PTP\@iniread(Credits,Title)\Labels,%%LABEL))
else
INFO Invalid value...
end
|
_________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Protected Valued Contributor


Joined: 02 Jan 2001 Posts: 228 Location: Portugal
|
Posted: Sat Mar 30, 2002 5:49 pm Post subject: |
|
|
| Mac, the value returned by @regread IS numeric, it is ALWAYS assigned by the program (before this part) and it must always be numeric. %%LABEL varies, as these commands are run everytime there is a GOTO command in the game script, but in this case, the program freezes in the first time, when %%LABEL is equal to ?Begin which is a label that ALWAYS exists in the game script. The solution for this is not that simple, I tried every possible simple thing.... If you want the whole source code tell me and I'll send it to you (or anyone else who wants to try) |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Mar 30, 2002 6:10 pm Post subject: |
|
|
Protected, did you try the snippet of code above?
You said the program runs fine from the IDE, I was just
trying to come up with a reason why it won't run compiled.
One other thing that comes to mind. Since compiled progs
run so much faster, you might try inserting WAIT here and
there to give functions (such as @regread) time to keep up
with the rest of the code.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Protected Valued Contributor


Joined: 02 Jan 2001 Posts: 228 Location: Portugal
|
Posted: Sat Mar 30, 2002 6:37 pm Post subject: |
|
|
Mac I don't know how could this happen, but the problem is solved!!!
I decided to continue programming and forget this for a while. Since this new version of PTP is full screen, I removed the menus and changed the code so it works with hotkeys (vdshot.dll). And when i compiled the program and tried it..... it was running!!!!! Very strange isn't it? Perhaps the error was inside the code that handled the program's menu system (it was a code with + then 300 lines), in fact the program used to process it before the line where the error happened..... |
|
| Back to top |
|
 |
|