Author Topic: HookEvent("onPlayerActive",blah) ULX conflicts?  (Read 2679 times)

0 Members and 1 Guest are viewing this topic.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
HookEvent("onPlayerActive",blah) ULX conflicts?
« on: July 20, 2006, 09:01:36 PM »
Megiddo, (or anyone)
 After 2 days (apx 5 hours) of various testing/troubleshooting/pulling hair/fussing at wife about what I thought were my table issues, etc etc etc, I found a problem I have in some code I'm writing somehow involves your script. (_Not_ saying its your fault, but, its conflicting with your code somehow, through my bad code, or your good code with oddity)
 I'm still playing with the targetting code mentioned in two other posts.
(Have come a looong way too I think)
With inexperience, I was using a 'function onPlayerActive()' command instead of a HookEvent(Playeractive)
Though that worked fine, it seems to have broken other ULX stuff.

Now that I've fixed that and other ULX stuff seems to work, mine doesn't work when I place it in the lua/init folder.
However, if I lua_openscript init/myscript.lua before I join my server, it detects me fine.
(Note: My code doesn't depend on any ulx commands)
I also tested by putting my script in the ULX Modules folder.
It works. Even though it doesn't use ulx variables/commands.

So, I searched your code for onPlayerActive, found several hookevents (in ulx_util and ulx_fun I think)
SOME of them have 'return's in them. Some don't.
I've tried adding 'return true' to the bottom of my hookevent code, however, same results, my code doesn't initialize.

Is this a Gmod/Lua bug? Any thoughts as to whats not working? Do 'return' need to be added to some of your code?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: HookEvent("onPlayerActive",blah) ULX conflicts?
« Reply #1 on: July 20, 2006, 09:19:42 PM »
It's possible that one of my hooks has a bug and is exitting abnormally, thus causing any hooks further down the line to fail. Not sure exactly which one it could be though.
Experiencing God's grace one day at a time.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: HookEvent("onPlayerActive",blah) ULX conflicts?
« Reply #2 on: July 20, 2006, 10:35:55 PM »
I think that playeractive only detects you if you join the server after it is called. I used somehting like it so a "Golden-Death is playing in this server now!" message would show in the credits section of my gamemode and it doesn't register unless I join the server.


Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: HookEvent("onPlayerActive",blah) ULX conflicts?
« Reply #3 on: July 20, 2006, 10:47:12 PM »
GoldenDeath, you are correct. However, both ULX and my code load before I join. (I test using a ded server, not a listen)
Using a listen server may not work as well, as you become active pretty much same time lua is loaded. Perhaps I'll add a 'initialize necessary stuff' command later.
However, I'd just be happy to figure out why my code has to load after ULX.

I've looked at the hook events, not indepth, but can't see why.

I'm kind of disheartened about another problem I had tonight, so haven't spent big time on this more minor annoyance
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming