HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Text Macros

09-09-2007, 09:40 AM#1
Alexander244
Is there some way to have a "variable" in a textmacro be given a unique value for each instance of that textmacro, without the user having to manually input it?

Say we have the following lame example:

Collapse JASS:
function MainFunction takes nothing returns nothing

    call ExecuteFunc("Func1")
endfunction
function Func1 takes nothing returns nothing

    call ExecuteFunc("Func2")
endfunction
function Func2 takes nothing returns nothing

    call ExecuteFunc("FuncN")
endfunction
function FuncN takes nothing returns nothing

endfunction

Which we could change to the following:

Collapse JASS:
//! textmacro NewThread takes ID
    call ExecuteFunc("Func$ID$")
endfunction
function Func$ID$ takes nothing returns nothing
//! endtextmacro

function MainFunction takes nothing returns nothing

//! runtextmacro NewThread("1")
    
//! runtextmacro NewThread("2")

//! runtextmacro NewThread("N")

endfunction

This is nice and easy, but it requires work from the user to input a unique value each time.

Is there some way to have 'ID' hidden from the user, and have it given a unique value internally? (Say each time the textmacro is run the ID value will be +1)
09-09-2007, 10:26 AM#2
botanic
i believe (dont kill me if I am wrong) that you can call a string variable inside an executefunction command and if that is possible (im 99% shure it is) then jsut create associated variable tables.
09-09-2007, 10:40 AM#3
Alexander244
The problem is not the execute func, it is being able to create unique functions without the user having to input a unique ID.
09-09-2007, 01:14 PM#4
Vexorian
making the user use textmacros doesn't sound right to me.

This whole makethread thing... Something tells me it could be replaced by .execute()

And no, there is no may to do that, I think that the addition of anonymous scopes might help, but I really don't think that in this case that would ever be accomplished...
09-09-2007, 01:38 PM#5
Alexander244
Quote:
Originally Posted by Vexorian
This whole makethread thing... Something tells me it could be replaced by .execute()
That was just a simple example, not something I was actually planning on doing.
09-09-2007, 03:02 PM#6
MaD[Lion]
if wat alex want is possible we can make wait based on timers :D
09-09-2007, 04:15 PM#7
Alexander244
Quote:
Originally Posted by MaD[Lion]
if wat alex want is possible we can make wait based on timers :D
That was the idea :)

I wouldn't have thought it would be that difficult to add, but if Vex does not want to add it thats his choice.
09-09-2007, 06:14 PM#8
MaD[Lion]
hehe, lucky i dont like timers :D So i dont need this :P

btw how do u make the tables in ur signature
09-09-2007, 06:20 PM#9
Alexander244
click on the vB code link in my signature.

Edit: Just to make it easy for you, here is the table in my sig as an example -
Code:
[table=Various Stuff]Useful Links: [c][size=1][url=http://www.wc3campaigns.net/misc.php?do=bbcode][vB  Code][/url] , [url=http://www.wc3campaigns.net/search.php][Search][/url] , [url=http://www.wc3campaigns.net/tutorials.php][Tutorials][/url][/size]
[r]Interesting Reading:  [c][size=1][url=http://www.wc3campaigns.net/showthread.php?t=93313][EarthFury - Asking for Help][/url] , [url=http://www.wc3campaigns.net/showthread.php?t=90599][Anitarf - Game Messages][/url][/size][/table]