HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Making local variables in GUI

06-22-2006, 03:42 AM#1
darkwulfv
Can you make local variables in GUI (I'm using WEU btw, if that changes anything)? If so, how?
06-22-2006, 04:22 AM#2
PipeDream
http://www.wc3campaigns.net/showthread.php?t=34204
And check out the other tutorials
http://www.wc3campaigns.net/forumdisplay.php?f=583

But if you need local variables it's a good time to bite the bullet and write JASS directly.
06-22-2006, 04:45 AM#3
Rising_Dusk
Heh, bite the bullet.
If I had the ability to do so, I would take back ever learning GUI and just have forced myself straight into jass.

I will always 100% recommend JASS over GUI.
But some people just feel more comfortable using the latter.
06-22-2006, 04:51 AM#4
darkwulfv
This is my method of GUI/JASS. I make the trigger in GUI, convert it to JASS (to comprehend what the relation is) and improve it (if I can). Anyways, Thx PD for the link, it helps alot. I knew it had something to do with custom script.
I'm using GUI for this particular spell becuase it's got 6 If/then/else multiple actions, and thats a pain in the ass to look through in JASS unless changed to better JASS form, which I can't do right now.
06-22-2006, 04:54 AM#5
Rising_Dusk
Heh yeah, GUI conditionals converted to jass are a pain to sort through.
However, if you ever get some code you want looked at for ways to optimize, by all means post it up and we'll try to work it out the best we can.
06-22-2006, 05:08 AM#6
darkwulfv
Well what I've been doing is making seperate maps for certain parts of my game, like a trigger map, and a main map. What I planned on doing was making all of my triggers (except spell triggers) in that map, make them JASS, copy/paste them into JassCraft, and Copy/paste them into triggers on the master map. Thx for the offer of help :D That's why I love this site. God, I'd never be here if I hadn't looked at that one online strategy guide for world editing, that mentioned an MPQ editor and a good place to find it was here. But I'm rambling, lol. Thx again : )
06-22-2006, 11:11 AM#7
Na.Zar.Rul
Yes its easy...

Create a variable in the variable editior.

Variable Name: Game_Character
Variable Type: Unit
Jass Name: udg_Game_Character


In that trigger you need a local variable, add this at the top:
Custom Script: local unit udg_Game_Character

Now "Game_Character" will be local in this trigger.
06-22-2006, 01:05 PM#8
Anvilsmith
Once you've converted something into custom text, you can't convert it back to GUI-style triggers. Not that it would matter, really, unless you wanted to edit them.

Still, you can probably export your triggers directly - try opening the trigger editor, then going to file->Export triggers and saving the lot someplace. As far as I've seen, however, you lose all your current triggers when you import, which is certainly an inconvenience (that Blizzard could've easily fixed).

Overall, even if it's easy to transfer your triggers without converting them to custom text, I really recommend that you switch to JASS regardless. Once you get past the learning curve, you'll find it's cleaner, more efficient, and it lets you do things that go well beyond the capabilities of the GUI. I wouldn't mind helping you out with the basics, and if you already know a bit of programming, you'll probably have no trouble at all.

EDIT: BTW, complicated scripts look a lot better in JassCraft than in the GUI. JassCraft has highlighting, lets you use tab instead of the awkward spacebar, and makes it easier to read your own scripts in general. And I bet those 6 if/then/elses in your spell could be partially replaced with loops. What's the whole trigger for the spell, if I may ask?
06-22-2006, 01:12 PM#9
Tim.
Quote:
Originally Posted by Rising_Dusk
If I had the ability to do so, I would take back ever learning GUI and just have forced myself straight into jass.
I completely agree.
06-22-2006, 04:17 PM#10
darkwulfv
@Anvilsmith my problem is solved from another post. I was using the variable to set it to a wisp, in case the spell was cast by another person so I needed it to be a local so that it wouldn't bug up. No more If/then/else needed, I was over-complicating things. Didn't know there was a "Set level of xxxx for xxxx to (Level of(ability being cast) for xxxx". I was using a "if the level of xxxx = x, then make xxxx cast xxxx, else set xxxx to level x" (sry for all the x's...) and kept going. Didn't work, don't know why, but now it does after being switched.