Page 1 of 2

Variable help

Posted: Tue Jun 23, 2009 12:02 pm
by xHPx
Hey,

on my map I have used some TFT-only triggers, but I want the map to be RoC-playable. Usually this would be solved by just converting them to Jass, but then it says:
- Expansion-only trigger functions, types, or values are being used (Trigger Editor)
I guess this is because of the trigger variables, but when I remove them I get several errors like this:
Line xx: Expected a variable name.
Any help would be appreciated. Thanks.

Re: Variable help

Posted: Tue Jun 23, 2009 1:32 pm
by 3ICE
It would help if you told us about your actual problem. All you said was that removing a variable causes errors, we know that. Don't remove variables that you use!
I would rather not write an entire book for you on how to debug JASS, so find which trigger causes it, post it here and I will debug it for you.

EDIT:
How to find which category causes errors:
Step 0: Create a copy of your map and open it. - We will be doing irreversible damage to it so it is better to save a backup rather than rely on the limited undo function.
Step 1: Delete a category.
Step 2: See if there are any errors.
Step 3: Repeat steps 1 and 2 until there are no errors.
Step 4: Click undo and the category that gets restored was the culprit.

How to find which trigger causes errors:
Step 0: Create a copy of your map and open it. - We will be doing irreversible damage to it so it is better to save a backup rather than rely on the limited undo function.
Step 1: Delete a trigger.
Step 2: See if there are any errors.
Step 3: Repeat steps 1 and 2 until there are no errors.
Step 4: Click undo and the trigger that gets restored was the culprit.

How to find which trigger action causes errors:
Step 0: Create a copy of your trigger and select it. - We will be doing irreversible damage to it so it is better to save a backup rather than rely on the limited undo function.
Step 1: Delete a trigger action.
Step 2: See if there are any errors.
Step 3: Repeat steps 1 and 2 until there are no errors.
Step 4: Click undo and the trigger action that gets restored was the culprit.

Re: Variable help

Posted: Tue Jun 23, 2009 2:02 pm
by xHPx
Here's one of the errors:
Line 34: Expected avariable name
The code:
set udg_Destructables[1] = 'LTlt'
They pop up when I remove the variables. Do I have to declare them within Jass if I remove them from the GUI? If so, how?

Re: Variable help

Posted: Wed Jun 24, 2009 7:06 am
by 3ICE
3ICE wrote:Don't remove variables that you use!
Pay attention much?
3ICE wrote:How to find which category causes errors:
Step 0: Create a copy of your map and open it. - We will be doing irreversible damage to it so it is better to save a backup rather than rely on the limited undo function.
Step 1: Delete a category.
Step 2: See if there are any errors.
Step 3: Repeat steps 1 and 2 until there are no errors.
Step 4: Click undo and the category that gets restored was the culprit.

How to find which trigger causes errors:
Step 0: Create a copy of your map and open it. - We will be doing irreversible damage to it so it is better to save a backup rather than rely on the limited undo function.
Step 1: Delete a trigger.
Step 2: See if there are any errors.
Step 3: Repeat steps 1 and 2 until there are no errors.
Step 4: Click undo and the trigger that gets restored was the culprit.

How to find which trigger action causes errors:
Step 0: Create a copy of your trigger and select it. - We will be doing irreversible damage to it so it is better to save a backup rather than rely on the limited undo function.
Step 1: Delete a trigger action.
Step 2: See if there are any errors.
Step 3: Repeat steps 1 and 2 until there are no errors.
Step 4: Click undo and the trigger action that gets restored was the culprit.
Did you even try doing all this? You need to find which trigger requires TFT!

EDIT: Using a destructible array doesn't require TFT. Post all your variables here and I will identify which one(s) do(es).

Re: Variable help

Posted: Wed Jun 24, 2009 7:50 am
by xHPx
  • Region
    Destructible-Type Array
    Int
    Player
    Int
    String
    Unitgroud
    Point
    Terrain Type Array
These are the variables. I know that terrain type array is TFT only, but there must be at least one other since it still says that it requires TFT after I delete it.

Also, how do I declare the variables in JASS? I tried this:

Code: Select all

globals
string array terrain
endglobals
For the terrain type array, but it just gave me an expected end of line error.

Re: Variable help

Posted: Wed Jun 24, 2009 8:02 am
by 3ICE
"Unitgroud" is not a valid variable type. Install a spell checker addon!
You used the LIST bbcode incorrectly.
You are right about "Terrain Type Array". You can't use it in RoC through the GUI variable editor.

You can't declare globals in JASS without JASSHelper, because there is only one globals block per map, which isn't editable through the World Editor.

And strings have nothing to do with TerrainType, they are all integers.

Possible solution: Start using locals.

Re: Variable help

Posted: Wed Jun 24, 2009 8:05 am
by xHPx
I guess I'll have to merge all of the triggers together and use locals then. Thanks for the help :)

Re: Variable help

Posted: Wed Jun 24, 2009 8:18 am
by 3ICE
Why merge?

You are welcome.

Re: Variable help

Posted: Wed Jun 24, 2009 8:25 am
by xHPx
Because some of the variables are used by more than one trigger, and if they are local they are only avialable to that trigger. Or am I missing something?

Re: Variable help

Posted: Wed Jun 24, 2009 8:26 am
by 3ICE
xHPx wrote:Or am I missing something?
Yes you are.
Locals are not per-trigger, they are per-function. Merging does not help.

You are better off using JASSHelper. (Link is a couple posts above.)