HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

New line in jass?

09-12-2004, 09:52 PM#1
-={tWiStÄr}=-
how do you make a new line
like this in jass? ive tried |n but it didnt work. could it be i have to have it like "..." + |n + "..." + |n + ...? cause right now i have it in the quotes like "...|n"
or is it something totaly different?
also how i do i make it show the a units type? like footman. right now it just says Hf00 or whatever.
09-12-2004, 10:31 PM#2
fugly
Code:
function string takes nothing returns string
 return "hi
noob"
endfunction

jass allows carraiges.
and
UnitId2StringBJ() takes integer unit type returns string name

ex.) UnitId2StringBJ('hfoo') = "Footman"
09-12-2004, 10:57 PM#3
-={tWiStÄr}=-
does it have to be in that form? does it have to be a returned value?
edit: ok i got that part to work, but how do you set the name of a custom unit? when i use UnitId2StringBJ('h00u') it returns custom_h00u
09-13-2004, 01:32 AM#4
fugly
you sure that you gave the unit a name? cause that seems very weird
09-13-2004, 01:42 AM#5
-={tWiStÄr}=-
what do you mean gave it a name? under the Text - Name field it says |c00007800Foot Soldier|r
09-13-2004, 01:47 AM#6
fugly
i don't think that color codes are alound in the name field :(
09-13-2004, 02:00 AM#7
-={tWiStÄr}=-
they are. i have them in like every name and it works fine
09-13-2004, 03:31 AM#8
fugly
so is it just this 1 unittype that doesn't return a unit type?
09-13-2004, 01:00 PM#9
-={tWiStÄr}=-
no. so far ive tried 2 but i have a feeling its going to be all of them.
09-14-2004, 01:40 PM#10
PitzerMike
This function will always return custom_xxx for custom units and objects, it's not supposed to return the actual name.
Instead it returns the 6th column from UnitUI.slk for existing units and custom_xxx for custom ones.
If you want the get the name use GetObjectName from common.j

Also you can do carriage returns within string using /n

fex: "first line/nsecond line"
09-14-2004, 11:45 PM#11
-={tWiStÄr}=-
hmm |n didnt work earlier but whatever. so your saying that GetObjectName will work the way i want?
09-15-2004, 12:30 AM#12
Cubasis
|n != /n

...
09-15-2004, 12:57 AM#13
-={tWiStÄr}=-
oh sorry didnt read carefully
edit: oh yeah rep for people who helped
09-16-2004, 03:50 PM#14
-={tWiStÄr}=-
I got it too work. I had to use the GetUnitName which was a bit hard because i had to have it from a variable. so i made my own function.
Code:
function Unittypec2String takes integer t returns string
	local string s = ""
	call CreateNUnitsAtLoc(1, t, Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRectCenter(gg_rct_Heromove), bj_UNIT_FACING )
	set s = GetUnitName(GetLastCreatedUnit())
	call RemoveUnit(GetLastCreatedUnit())
	return s
endfunction
gg_rct_Heromove can be center of map, i just chose that region because it is out of the way. oh and the c in the function title stands for custom because with non-custom units you can usually just use UnitId2String.
09-16-2004, 10:37 PM#15
fugly
Quote:
Originally Posted by -={tWiStÄr}=-
I got it too work. I had to use the GetUnitName which was a bit hard because i had to have it from a variable. so i made my own function.
Code:
function Unittypec2String takes integer t returns string
	local string s = ""
	call CreateNUnitsAtLoc(1, t, Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRectCenter(gg_rct_Heromove), bj_UNIT_FACING )
	set s = GetUnitName(GetLastCreatedUnit())
	call RemoveUnit(GetLastCreatedUnit())
	return s
endfunction
gg_rct_Heromove can be center of map, i just chose that region because it is out of the way. oh and the c in the function title stands for custom because with non-custom units you can usually just use UnitId2String.

very handy function but it leaks and is will lag 0.000000000000000002 secs more than needed try this...

Code:
function Unittypec2String takes integer t returns string
	local string s 
        local location where = GetRectCenter(gg_rct_Heromove)
        local unit dummy = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), t, GetLocationX(where), GetLocationY(where), 0 )
	set s = GetUnitName(dummy)
	call RemoveUnit(dummy)
        call RemoveLocation(where)
        set where = null
        set dummy = null
	return s
endfunction

you should put this in the jass section