| 02-13-2008, 12:40 AM | #1 |
This is just a question on publics. I just put private so people knew what I'm going to talk about. How come I get an syntax error saying "the variables is undeclared" when i put a public prefix? It works fine w/o it. I thought public prefix allowed it to be declared out of the function? JASS:public constant string CL_P = "CLPB" |
| 02-13-2008, 12:53 AM | #2 |
is because you need to call the public data in this way: <Name of the library/scope that contains the variable>_<your public vatriable name> So, in your example, if the scope or library which contains the variable is called "blabla" the variable must be called blabla_CL_P |
| 02-13-2008, 01:03 AM | #3 |
Let's try an example: JASS:scope foo globals public string bar = "a" endglobals public function Display takes nothing returns nothing call BJDebugMsg(bar) endfunction public function DisplayBJ takes nothing returns nothing call Display() endfunction endscope scope foocopy globals public string bar = "b" endglobals public function Display takes nothing returns nothing call BJDebugMsg(bar) endfunction public function DisplayBJ takes nothing returns nothing call Display() endfunction endscope function Test takes nothing returns nothing call foo_DisplayBJ() call foocopy_Display() call BJDebugMsg(foo_bar) endfunction a b a |
| 02-13-2008, 01:56 AM | #4 |
Common sense maybe? Like others stated above, you must use these keywords in a scope or library -Av3n |
| 02-13-2008, 12:37 PM | #5 | |
Quote:
|
| 02-13-2008, 08:23 PM | #6 | |
Quote:
@Vex It was declared in a library. I think that solves that. ![]() |
