• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Lua object generation text macro

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

Edit: nevermind, I just wrote a function for this. Silly question to ask!

I found this tutorial but could not answer my question: http://www.hiveworkshop.com/forums/jass-ai-scripts-tutorials-280/lua-object-generation-191740/#V

Suppose I've got an ability with 10 levels, each with increasing damage. But there is no formula for getting Damage given a level (suppose it's arbitrary), so I use a constant for each level, e.g.

ABIL_LVL_1 = "50.0" (damage)
ABIL_LVL_2 = "73.0" (damage)
etc.

Now I want to run a text macro to fill these fields in for my ability--how do I write this?,

i.e. I just want a two liner like this:
*****

string/function target = "makechange(current, "xxxx", ABIL_LVL_$N$)"
myTextMacro(target, 5)

*****

outputs:

makechange(current, "xxxx", ABIL_LVL_1)
makechange(current, "xxxx", ABIL_LVL_2)
makechange(current, "xxxx", ABIL_LVL_3)
makechange(current, "xxxx", ABIL_LVL_4)
makechange(current, "xxxx", ABIL_LVL_5)
 
Last edited:
Status
Not open for further replies.
Top