Textmacro issues

NoobImbaPro

You can change this now in User CP.
Reaction score
60
is there any way to pass a variable of a textmacro function into another textmacro??

JASS:

//! textmacro id takes name1
$name$ type variable1
//! endtextmacro

//! textmacro id2 takes name2
$name2$ type variable2 extends $name1$
//! endtextmacro
<div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"><div class="bbCodeBlock-title">JASS:</div><div class="bbCodeBlock-content"><pre class="bbCodeCode"><code class="jass">

<span>so</span> <span>is</span> <span>there</span> <span>any</span> <span>way</span> <span>to</span> <span>put</span> <span>the</span> <span>name1</span> <span>into</span> <span>a</span> <span>global</span> <span>variable</span> <span>like</span> <span class="preprocessor">//! n = &amp;#039;$name1$&amp;#039;</span>
<span class="keyword">and</span> <span class="keyword">then</span> <span>use</span> <span>it</span> <span>in</span> <span>the</span> <span>second</span> <span>textmacro</span>?</code></pre></div></div>
 

Dirac

22710180
Reaction score
147
I havent tested this yet but it compiles
JASS:
//! textmacro TEST takes NAME
globals
    integer $NAME$ = 0
endglobals
    //! textmacroextend TEST2 takes $OTHER_NAME$
        function check takes integer i returns nothing
            set $NAME$=$NAME$+i
        endfunction
    //! endextendedtextmacro
    //! runtextmacroextend TEST2 (&quot;INTVAR&quot;)
//! endtextmacro
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
JASS:
//i want to make something like anonymous struct in jass so i need text macro extend outside of function  <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />
//something like this
//! textmacro this takes name
//! runtextmacro that(&quot;$name$&quot;)
//! endtextmacro
 

Dirac

22710180
Reaction score
147
It's like you didn't bother to read what i posted.
Let me put it clearer
JASS:
scope TESTER

//! textmacro SETUP takes NAME,TYPE

    globals
        private $TYPE$ $NAME$Global1
        private $TYPE$ $NAME$Global2
    endglobals
    
//! textmacroextend EXTENSION
    function $NAME$Swap takes nothing returns nothing
        local $TYPE$ a = $NAME$Global1
        set $NAME$Global1 = $NAME$Global2
        set $NAME$Global2 = a
    endfunction
//! endextendedtextmacro

    //! runtextmacroextend EXTENSION()

//! endtextmacro

//! runtextmacro SETUP(&quot;Int&quot;,&quot;integer&quot;)
//! runtextmacro SETUP(&quot;Real&quot;,&quot;real&quot;)
//! runtextmacro SETUP(&quot;Unit&quot;,&quot;unit&quot;)

endscope
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
its like you don't understand....

see that and tell me how can you do that.

JASS:

//! runtextmacro struct (&quot;Data&quot;)
real a
real b
method g takes nothing returns nothing
endmethod
//! runtextmacro endstruct()


Where the first macro has the variable "Data" and the second has also some things called "Data" without putting anything inside the endstruct. And this can be done multiple times when calling endstruct to take different parameters depending on textmacto struct called before.

I think I have to analyze with deep detail what I mean, because there will be no easy answers for what I request once a while :D
 

Bribe

vJass errors are legion
Reaction score
67
Dirac,

textmacroextend and endextendedtextmacro

Come on... if you are going to make something up at least make it consistent?
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
JASS:
//! textmacro SETUP takes NAME,TYPE

    globals
        private $TYPE$ $NAME$Global1
        private $TYPE$ $NAME$Global2
    endglobals
    
//! textmacroextend EXTENSION
    function $NAME$Swap takes nothing returns nothing
        local $TYPE$ a = $NAME$Global1
        set $NAME$Global1 = $NAME$Global2
        set $NAME$Global2 = a
    endfunction
//! endextendedtextmacro

    //! runtextmacroextend EXTENSION()

//! endtextmacro


is the same thing with that....
JASS:
//! textmacro SETUP takes NAME,TYPE

    globals
        private $TYPE$ $NAME$Global1
        private $TYPE$ $NAME$Global2
    endglobals
    
    function $NAME$Swap takes nothing returns nothing
        local $TYPE$ a = $NAME$Global1
        set $NAME$Global1 = $NAME$Global2
        set $NAME$Global2 = a
    endfunction

//! endtextmacro


All I want is to play with the compiler but I can't :(
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
:nuts: Huh... Since when textmacros can be nested? And since when the jasshelper "understands" bogus keywords? (textmacroextend, endextendedtextmacro)

Some pseudo (C preprocessor like) inheritance could be done with textmacros:

JASS:
//! textmacro point2d_data
    real x
    real y
//! endtextmacro

struct point2d
    //! runtextmacro point2d_data()
endstruct

struct point3d // &quot;extends/specializes&quot; point2d
    //! runtextmacro point2d_data()
    real z
endstruct


NoobImbaPro:
1. All I want is to play with the compiler but I can't

1. If you want to rapid "test/play" with the jasshelper compiler, then just use: path/to/[cli]jasshelper --scriptonly path/to/common.j path/to/Blizzard.j input.j output.j from the command line, I think that's the easiest way to see the output of the tool.
 

Bribe

vJass errors are legion
Reaction score
67
@Bribe
I'm not making anything up

Dirac, JassHelper docs say nothing about any "textmacroextend". In fact they say you can't make nested textmacros, so what's going on here? If you didn't make it up then how would you have come by this "secret knowledge"?

Are you using cJass? I know cJass supports nested macros.
 

Bribe

vJass errors are legion
Reaction score
67
Well it probably compiles because it is treated like a comment then.

However I recommend checking out the war3map.j output to see if that is the same.
 

dudeim

New Member
Reaction score
22
Bribe please open the editor and test it yourself.
I don't know what is going on.
The user dudeim came up with this secret knowledge on this thread:
http://www.thehelper.net/forums/showthread.php/166234-Jass-globals-in-textmacro-s-(lua)
I said I didn't know the correct names of it so I typed something that looked like it (as far as my memory at that moment served), but as far as I know it doesn't exists and isn't supported:p
What I was meaning to type in that thread was this:
JASS:
//! externalblock extension=lua ObjectMerger $FILENAME$
//! endexternalblock
//instead of
//! textmacroextend
//! endextendedtextmacro
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
can I do something like this at least??

JASS:

//! i name

//! textmacro set takes value
    //! i name = &quot;$value$&quot; .. &quot; int1 = 5&quot;
//! endtextmacro

//! textmacro get
    //! writejass(name)
//! endtextmacro


so if I do this:
JASS:
//! runtextmacro set(&quot;integer&quot;)

function myfunc takes nothing returns integer
    //! runtextmacro get()
    return int1 == 6
endfunction


it will become this:
JASS:

function myfunc takes nothing returns integer
    integer int1 = 5

    return int1 == 6
endfunction
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
can cjass compile with w.e and can you do it with newgen or do you need a whole nother application
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
GFreak45:
1. can cjass compile with w.e and can you do it with newgen or do you need a whole nother application

1. http://cjass.xgm.ru/manual-en#htoc1

The cjass preprocessor is an awesome and powerful tool, yet most (at least the ones I know) [c|v]Jass[2] resource hosting sites don't allow cjass resources. Why? Good question, probably because vJass is the "standard" (at least it was in 2009, or so I've read), but if you're going to release a playable map then you most likely would want to use it. It's the only tool (I know) that allows you to compile for both 1.24+ and 1.23- version of Warcraft 3, this is of course only "the tip of the iceberg".
 

Bribe

vJass errors are legion
Reaction score
67
cJass is not 100% compatible with vJass scripts. It explodes when trying to compile my Table library, for example.

If everyone re-wrote their stuff to use cJass, it could be a standard then, but that's not realistic, because cJass requires JassHelper and even downloading Jass NewGen Pack does not contain the full JassHelper...

So you need to:

1. Have a windows computer
2. Disable your antivirus
3. Download JNGP
4. Download JassHelper 0.A.2.B
5. Download AdicParser
6. Update AdicParser

All this just to parse a programming langauge that parses into JASS. It's no wonder that GUI is still so popular. If vJass was built-in to the World Editor, or if cJass was, then glorious days.
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
Bribe:
1. So you need to:
1. Have a windows computer
2. Disable your antivirus
3. Download JNGP
4. Download JassHelper 0.A.2.B
5. Download AdicParser
6. Update AdicParser

2. It explodes when trying to compile my Table library, for example.

3. All this just to parse a programming langauge that parses into JASS. It's no wonder that GUI is still so popular.

1. This takes what? 5 min?

2. Well you could try to download the latest adichelper and then if it "explodes" again report it to the developer?

3. GUI is popular? How the !@#$ do you write arithmetic expressions with that thing? You don't? And plain jass is pain in the a$$...
Try writing a useful script with that thing.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
thats the language galaxy for sc2 is written in
and cjass is built into it with coloring, not with all the nice autofills and all that, but a basic version of it
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top