HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

GetLocalPlayer() vs a global player variable

05-14-2008, 08:34 PM#1
Troll-Brain
Collapse JASS:
library General initializer init

   globals
      player LocalPlayer
   endglobals

   private function init takes nothing returns nothing
      set LocalPlayer=GetLocalPlayer()   
   endfunction

endlibrary

and then if i use LocalPlayer instead of GetLocalPlayer() is it faster or slower ?
05-14-2008, 08:50 PM#2
Vexorian
Is speed really what you should be worrying about in this case?
05-14-2008, 08:53 PM#3
Troll-Brain
Quote:
Originally Posted by Vexorian
Is speed really what you should be worrying about in this case?
no, just to know
so ?
05-14-2008, 08:55 PM#4
DioD
natives always faster...
05-14-2008, 11:10 PM#5
TEC_Ghost
The speed difference is insignificant.

I don't even know if that'd work right.

But if it did , unless you're checking the localplayer every .01 seconds and even then you'd probably never even know the difference.
05-14-2008, 11:41 PM#6
Toadcop
Quote:
natives always faster...
loled xD

ofc var is better.
05-15-2008, 06:29 AM#7
Captain Griffen
It works fine. Warlords hasn't broken yet, anyway.
05-15-2008, 04:47 PM#8
Troll-Brain
@Diod : i'm not talking about a native vs a non native function ...

Quote:
Originally Posted by Toadcop
ofc var is better.

Are you sure, because it's a native so GetLocalPlayer() could be faster than read a variable.
I mean GetLocalPlayer() could be already a reading of a variable, no ?

and yes i know the difference must be so insignificant

i didn't test myself, because i can't use the natives of japi :(
05-15-2008, 05:45 PM#9
Toadcop
Quote:
i didn't test myself, because i can't use the natives of japi :(
thats true...

yes i am sure. // 100%

any function call is slower than to "read" from a variable.
05-15-2008, 05:49 PM#10
Troll-Brain
Quote:
thats true...
what must i do for use the japi's natives, because it seems the readme is not updated
05-15-2008, 06:28 PM#11
Toadcop
Code:
#####
we.conf // it's a file in folder
#####
-- DLLs that need to be injected into the worldeditor should go here

grim.injectdll(proc,"bin\\japi.dll")
grim.injectdll(proc,"bin\\nativepack.dll")
grim.injectdll(proc,"bin\\war3lua.dll")
-- grim.injectdll(proc,"bin\\listfile.dll")
grim.injectdll(proc,"bin\\loadmpq.dll")
grim.injectdll(proc,"bin\\wehack.dll")
--grim.injectdll(proc,"tesh\\tesh.dll") // :P i don't like it

#########
 ongameload.lua   // it's also a file in folder xD (just in case you can open them using some text editor)
#########

-- Load libraries here that need to run after game.dll loads but after
-- native registration
-- e.g. war3err, japi, user created natives

if getregpair("Software\\Grimoire\\","Enable war3err") == "on" then
	loaddll("bin\\war3err.dll")
end
loaddll("bin\\listfile.dll")
loaddll("bin\\japi.dll")
loaddll("bin\\nativepack.dll") -- requires japi.dll
--loaddll("bin\\warmachine.dll")
--loaddll("bin\\warsoc.dll")
--loaddll("bin\\war3lua.dll")

in fact that's it... aka mus work. maybe you have something screwed. (cause i have a specific version of grimoire. (not the latest one))
// ever make some backups of older versions ;)
05-15-2008, 07:47 PM#12
Troll-Brain
Quote:
it's also a file in folder xD (just in case you can open them using some text editor)
aha ...

there is my files :

ongameload.lua :
Code:
-- Load libraries here that need to run after game.dll loads but after
-- native registration
-- e.g. war3err, japi, user created natives

if getregpair("Software\\Grimoire\\","Enable war3err") == "on" then
	loaddll("bin\\war3err.dll")
end
if getregpair("Software\\Grimoire\\","Enable warmachine") == "on" then
  loaddll("bin\\warmachine.dll") -- disable war3err.dll to use this
end
loaddll("bin\\japi.dll")
loaddll("bin\\nativepack.dll") -- requires japi.dll
--loaddll("bin\\warsoc.dll")
--loaddll("bin\\war3lua.dll")

we.conf.lua :
Code:
-- DLLs that need to be injected into the worldeditor should go here


loaddll("bin\\wehack.dll")

loaddll("bin\\japi.dll")

--loaddll("bin\\warsoc.dll")

loaddll("bin\\nativepack.dll")

--loaddll("bin\\war3lua.dll")

--loaddll("bin\\listfile.dll")

loaddll("bin\\loadmpq.dll")


if exists("tesh\\tesh.dll") and getregpair("Software\\Grimoire\\","Enable TESH") == "on" then

	loaddll("tesh\\tesh.dll")

end

i can save a map with natives functions but when i launch the test i got a fatal error at the half of the initialisation of the map.

acces violation ...
The memory could not be read.

and it's just the demo japi map without any edit
05-15-2008, 08:28 PM#13
Toadcop
it's grimoire issue. (thats why i use a older one)
+ maybe warmachine is enabled ?
05-15-2008, 10:50 PM#14
PurgeandFire111
You might be able to try this as an alternative:
http://wc3jass.com/files.php?mode=view&id=60

ToadCop says it is crap because he is... well, Toadcop and he only believes in NewGen extra natives. (He doesn't believe JASS itself can test code)

Though, PandaMine says it is accurate because it doesn't measure the speed, but how many times a script executes per thread...

But don't quote me on this stuff because I have no clue which to trust. xD
05-15-2008, 11:56 PM#15
Toadcop
Quote:
but how many times a script executes per thread...
lolzedfucking shit... do you know what natives may be slow but they does use less "thread limit" as not natives functions !? i have used this method long ago and in fact it does phail like shit.