HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

UnitId2String or GetObjectName for ExecuteFunc based system?

04-29-2007, 07:17 PM#1
Sagan
I'm using the name of a unit in an ExecuteFunc call, to determine which function should be executed. I'm using UnitId2String for this, because I thought it wouldn't have any issues with translations. The alternative would be to use "GetObjectName" - I have no way of testing whether one of the two functions returns the translated name of a unit or not. If that was the case, it would crash the game, because ExecuteFunc can't find the function.

I think I'm safe by using UnitId2String, but I would like to know for sure. Has anyone tested this?

To give you an idea of what I'm talking about, here are two example functions:

Collapse JASS:
function humanbarracksText takes nothing returns nothing
  set udg_ObserstatsResearches[0] = 'Rhde'
  set udg_ObserstatsResearches[1] = 'Rhri'
  set udg_ObserstatsResearches[2] = 'Rhan'
  set udg_ObserstatsResearches[3] = 0
  call DisplayUnitStats()
endfunction

function workshopText takes nothing returns nothing
  set udg_ObserstatsResearches[0] = 'Rhgb'
  set udg_ObserstatsResearches[1] = 'Rhfl'
  set udg_ObserstatsResearches[2] = 'Rhrt'
  set udg_ObserstatsResearches[3] = 'Rhfc'
  set udg_ObserstatsResearches[4] = 'Rhfs'
  set udg_ObserstatsResearches[5] = 0
  call DisplayUnitStats()
endfunction

And I would call them using
Collapse JASS:
call ExecuteFunc(UnitId2String(udg_TempUnitType)+"Text")


So yeah, if anyone could test whether a translated version of Warcraft III does not return "humanbarracks", that would be great!
04-29-2007, 07:54 PM#2
grim001
How about downloading vJASS and using function interfaces?
04-30-2007, 10:43 AM#3
Sagan
Quote:
Originally Posted by grim001
How about downloading vJASS and using function interfaces?

How would I do that and why would I do that?

I downloaded vJass, but I don't understand enough to know how I use a function interface, or what I would use it for...
04-30-2007, 02:42 PM#4
Vexorian
This is a very lame idea.

Both GetObjectName and UnitIdToString are not type specific, I think that a better way is to make a function that takes integer and returns the string representation of the integer.

And have the rawcode in the function name.

But this ExecuteFunc exploit is not a very great idea if you ask.