WE does not accept this code but JassCraft does:confused: +rep

Samael88

Evil always finds a way
Reaction score
181
This is solved!

JASS:
globals
    integer MeteorCount = 0
    real array StartingX
    real array StartingY
    integer array MainBuild          
    integer array BuildSlots
    integer loopint = 0   
    race array PlayerRaces
    integer HumanMain = 'h006'
    integer OrcMain = 'o009'
    integer UndeadMain = 'u007'
    integer NightElfMain = 'h006'
endglobals

function variableset takes nothing returns nothing
    loop 
        exitwhen loopint == 12
        set StartingX[loopint] = GetStartLocationX(loopint)
        set StartingY[loopint] = GetStartLocationY(loopint)
        set PlayerRaces[loopint] = GetPlayerRace(Player(loopint))        
        set loopint = loopint + 1
    endloop
endfunction   

            
function Start takes nothing returns nothing
    set loopint = 0
    loop
        exitwhen loopint==12             
        if PlayerRaces[loopint] == RACE_HUMAN then
        call CreateUnit(Player(loopint), HumanMain, StartingX[loopint], StartingY[loopint], 270)
        endif 
        if PlayerRaces[loopint] == RACE_ORC then
        call CreateUnit(Player(loopint), OrcMain, StartingX[loopint], StartingY[loopint], 270)
        endif
        if PlayerRaces[loopint] == RACE_UNDEAD then
        call CreateUnit(Player(loopint), UndeadMain, StartingX[loopint], StartingY[loopint], 270)
        endif
        if PlayerRaces[loopint] == RACE_NIGHTELF then
        call CreateUnit(Player(loopint), NightElfMain, StartingX[loopint], StartingY[loopint], 270)
        endif
        set loopint= loopint + 1 
    endloop
endfunction


JassCraft accepts this code and tells me that it is ok. But the game won't accept it:nuts: I can't find anything wrong with it.
+rep to helper

This is how I call it for now:
Custom Script: call Start(loopint)
Custom Script: call variableset(loopint)

I have tried calling it in the map init and in 0.1 sec of gametime.
It just gives me about 34 errors, almost everyone of them is on loopint
 

saw792

Is known to say things. That is all.
Reaction score
280
JASS:
function variableset takes nothing returns nothing


It doesn't take anything, yet you are trying to pass it an argument.

Also, I don't see a MapSetup function there either.
 

Samael88

Evil always finds a way
Reaction score
181
JASS:
function variableset takes nothing returns nothing


It doesn't take anything, yet you are trying to pass it an argument.

Also, I don't see a MapSetup function there either.

I have tried passing loopint over to it, that is the one I usually need to pass over when doing this type of functions.

The start/mapsetup was a typo. I renamed it beacuse of the possibility of another function with that name.

Wich arguments should be passed over?
Why?
And how?
Is is like this:
call Start(loopint):confused:

Edit: Oh, passing loopint does not work either: function variableset takes integer loopint returns nothing

I am currently putting it in the map header to test it out, I don't want to write several pages of code without testing it on the way just to find out that it does not work in the end.

Edit2: Allmost all the errors are on loopint, not matter if I pass it with the function or not.
 

saw792

Is known to say things. That is all.
Reaction score
280
Hmm sorry I don't know what is going wrong then. What is the exact error, and exact line of the first error?
 

Samael88

Evil always finds a way
Reaction score
181
It says, "expected end of line" for every global.
It says, that it expected a variable name for every time Loopint is used.
And a few expected name and expected endloop at the end of it.
It is now down to 25 errors. And here is the current code:
JASS:
globals
    integer MeteorCount = 0
    real array StartingX
    real array StartingY
    integer array MainBuild          
    integer array BuildSlots
    integer Loopint = 0   
    race array PlayerRaces
    integer HumanMain = 'h006'
    integer OrcMain = 'o009'
    integer UndeadMain = 'u007'
    integer NightElfMain = 'h006'
endglobals

function variableset takes integer Loopint returns nothing
    loop 
        exitwhen Loopint == 12
        set StartingX[Loopint] = GetStartLocationX(Loopint)
        set StartingY[Loopint] = GetStartLocationY(Loopint)
        set PlayerRaces[Loopint] = GetPlayerRace(Player(Loopint))        
        set Loopint = Loopint + 1
    endloop
endfunction   

            
function Start takes integer Loopint returns nothing                   
    set Loopint = 0
    loop
        exitwhen Loopint == 12             
        if PlayerRaces[Loopint] == RACE_HUMAN then
            call CreateUnit(Player(Loopint), HumanMain, StartingX[Loopint], StartingY[Loopint], 270)
         
        elseif PlayerRaces[Loopint] == RACE_ORC then
            call CreateUnit(Player(Loopint), OrcMain, StartingX[Loopint], StartingY[Loopint], 270)
        
        elseif PlayerRaces[Loopint] == RACE_UNDEAD then
            call CreateUnit(Player(Loopint), UndeadMain, StartingX[Loopint], StartingY[Loopint], 270)
        
        elseif PlayerRaces[Loopint] == RACE_NIGHTELF then
            call CreateUnit(Player(Loopint), NightElfMain, StartingX[Loopint], StartingY[Loopint], 270)
        endif
        set Loopint= Loopint + 1 
    endloop
endfunction


Edit: Can it be that these are buildings?:
JASS:
    integer HumanMain = 'h006'
    integer OrcMain = 'o009'
    integer UndeadMain = 'u007'
    integer NightElfMain = 'h006'
 

saw792

Is known to say things. That is all.
Reaction score
280
If (as I suspect) you don't have Newgen, you can only declare globals at the very top of the map script. Move all those globals to the map header at the very top, and see what happens.
 

SFilip

Gone but not forgotten
Reaction score
634
> Move all those globals to the map header at the very top, and see what happens.
That won't work.

As already said, the code you're trying to use requires Jass NewGen. While you could modify it not to, you really should get NewGen as it's a really good thing to have.
 

Samael88

Evil always finds a way
Reaction score
181
> Move all those globals to the map header at the very top, and see what happens.
That won't work.

As already said, the code you're trying to use requires Jass NewGen. While you could modify it not to, you really should get NewGen as it's a really good thing to have.

The code you are reffering to is the global block right?
Beacuse all the other stuff works if I use udgs instead.

I actually have newgen, I just don't like to use. I guess I am just affraid.
It is like in gone in 60 seconds whit nicolas cage and eleanor:eek:
 

saw792

Is known to say things. That is all.
Reaction score
280
Well the thing is, normal world editor only allows globals to be declared at the very top of the map script, sortof like how local variables work within a function. Unfortunately (as I now realise) we cannot access the top of the map script. There is already a globals block in the map script that contains all the variables declared in the GUI variable editor. That means that you cannot declare another globals block. Newgen, however, allows you to use globals blocks wherever you want, and merges them with the globals block at the top of the map script upon saving.
 

Samael88

Evil always finds a way
Reaction score
181
Well the thing is, normal world editor only allows globals to be declared at the very top of the map script, sortof like how local variables work within a function. Unfortunately (as I now realise) we cannot access the top of the map script. There is already a globals block in the map script that contains all the variables declared in the GUI variable editor. That means that you cannot declare another globals block. Newgen, however, allows you to use globals blocks wherever you want, and merges them with the globals block at the top of the map script upon saving.

Aha, to bad I kind of already figured that out. But if I use no udgs, can I use the other way to declare globals instead?
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
Yes, you can declare globals without the udg_ prefix.
JASS:
function DMG takes nothing returns real
return 125.
endfunction


Used like this:
JASS:
local real damage = DMG()


Can also be used with other types.
Jass globals can also be constants.
JASS:
constant function DMG takes nothing returns real
return 89.
endfunction


Or even changing numbers according to levels:
JASS:
function YourSpell_DMG takes integer lvl returns real
if lvl == 1 then
     return 80.
elseif lvl == 2 then
     return 135.
elseif lvl == 3 then
     return 240.
endif
return 0
endfunction

Used like this:
JASS:
local real dmg = YourSpell_DMG(GetUnitAbilityLevel(caster, YourSpell_SPELLID))


Spell rawcodes should be constants:
JASS:
constant function Enflame_SPELLID takes nothing returns integer
    return 'A000'
endfunction


Hope I helped.
 

Samael88

Evil always finds a way
Reaction score
181
What if he is not on about constant globals?

I descided to start learning vJASS. I thought that the global block was possible to use in normal JASS:(
I will code in JassCraft and then just implement it into my map thru the newgen editor. That is much easier beacuse I really hate the newgen trigger editor:(
I can never seem to get the colors right for my eyes:eek:

wich means. Constants, no. Libraries, no. and so on.
 

LocalDude

New Member
Reaction score
4
well good luck with vJASS if it dosent work you can try this
JASS:
globals
    integer udg_MeteorCount = 0
    real array udg_StartingX
    real array udg_StartingY
    integer array udg_MainBuild          
    integer array udg_BuildSlots
    integer udg_loopint = 0   
    race array udg_PlayerRaces
    unittype udg_HumanMain = h006
    unittype udg_OrcMain = o009
    unittype udg_UndeadMain = u007
    unittype udg_NightElfMain = n006
endglobals

function variableset takes integer udg_loopint returns nothing
loop
  exitwhen udg_loopint == 12                               
        set udg_StartingX[udg_loopint] = GetStartLocationX(udg_loopint)
        set udg_StartingY[udg_loopint] = GetStartLocationY(udg_loopint)
        set udg_PlayerRaces[udg_loopint] = GetPlayerRace(Player(udg_loopint))        
        set udg_loopint = udg_loopint + 1
    endloop
endfunction   

            
function Start takes integer loopint returns nothing
    set udg_loopint = 0
    loop
        exitwhen udg_loopint==12             
        if udg_PlayerRaces[udg_loopint] == RACE_HUMAN then
        call CreateUnit(Player(udg_loopint), udg_HumanMain, udg_StartingX[udg_loopint], udg_StartingY[udg_loopint], 270)
        endif 
        if udg_PlayerRaces[udg_loopint] == RACE_ORC then
        call CreateUnit(Player(udg_loopint), udg_OrcMain, udg_StartingX[udg_loopint], udg_StartingY[udg_loopint], 270)
        endif
        if udg_PlayerRaces[udg_loopint] == RACE_UNDEAD then
        call CreateUnit(Player(udg_loopint), udg_UndeadMain, udg_StartingX[udg_loopint], udg_StartingY[udg_loopint], 270)
        endif
        if udg_PlayerRaces[udg_loopint] == RACE_NIGHTELF then
        call CreateUnit(Player(udg_loopint), udg_NightElfMain, udg_StartingX[udg_loopint], udg_StartingY[udg_loopint], 270)
        endif
        set udg_loopint= udg_loopint + 1 
    endloop
endfunction

I dont now if it was what you were loking for but it placed the starting bouldings in my map, BTW
Code:
Untitled Trigger 001
    Events
        Time - Elapsed game time is 1.00 seconds
    Conditions
    Actions
        Custom script:   call variableset(udg_loopint)
        Custom script:   call Start(udg_loopint)
 

Samael88

Evil always finds a way
Reaction score
181
well good luck with vJASS if it dosent work you can try this
JASS:
globals
    integer MeteorCount = 0
    real array StartingX
    real array StartingY
    integer array MainBuild          
    integer array BuildSlots
    integer loopint = 0   
    race array PlayerRaces
    string HumanMain = h006
    string OrcMain = o009
    string UndeadMain = u007
    string NightElfMain = h006
endglobals

  exitwhen udg_loopint == 12
        set udg_StartingX[udg_loopint] = GetStartLocationX(udg_loopint)
        set udg_StartingY[udg_loopint] = GetStartLocationY(udg_loopint)
        set udg_PlayerRaces[udg_loopint] = GetPlayerRace(Player(udg_loopint))        
        set udg_loopint = udg_loopint + 1
    endloop
endfunction   

            
function Start takes integer loopint returns nothing
    set udg_loopint = 0
    loop
        exitwhen udg_loopint==12             
        if udg_PlayerRaces[udg_loopint] == RACE_HUMAN then
        call CreateUnit(Player(udg_loopint), udg_HumanMain, udg_StartingX[udg_loopint], udg_StartingY[udg_loopint], 270)
        endif 
        if udg_PlayerRaces[udg_loopint] == RACE_ORC then
        call CreateUnit(Player(udg_loopint), udg_OrcMain, udg_StartingX[udg_loopint], udg_StartingY[udg_loopint], 270)
        endif
        if udg_PlayerRaces[udg_loopint] == RACE_UNDEAD then
        call CreateUnit(Player(udg_loopint), udg_UndeadMain, udg_StartingX[udg_loopint], udg_StartingY[udg_loopint], 270)
        endif
        if udg_PlayerRaces[udg_loopint] == RACE_NIGHTELF then
        call CreateUnit(Player(udg_loopint), udg_NightElfMain, udg_StartingX[udg_loopint], udg_StartingY[udg_loopint], 270)
        endif
        set udg_loopint= udg_loopint + 1 
    endloop
endfunction

I dont now if it was what you were loking for but it placed the starting bouldings in my map, BTW
Code:
Untitled Trigger 001
    Events
        Time - Elapsed game time is 1.00 seconds
    Conditions
    Actions
        Custom script:   call variableset(udg_loopint)
        Custom script:   call Start(udg_loopint)

Oh, thanks. That is really the most simple somution to this problem:thup: I did not expect that from you:p
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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