Toribash
Thanks, I got it now. Is there a list of the available hooks to use, somewhere?


Edit: nvm, I found it. script/examples/hook.lua

Edit edit: Nvm, that doesn't even have the console hook. If I was looking for that there, I would've assumed it didn't exist.

edit edit edit: I can't figure out how to do this, can someone give me a pointer(s) please?


I'm trying to get the win ratio for each player. I'm using the console hook to get the chat. I was searching in the string to get the ratio. I can't figure out how to make it do the /stats for tori, wait until it has the ratio from the chat hook, and then update the tori ratio, and then do all that for uke. An end_game hook would reset all these values. Please help.
Last edited by isaac; Jul 27, 2013 at 09:14 AM.
/data/script/startup.lua has all the hooks in the game.

You'll have to manually sift through chat in order to get the win ratio, as far as I know. I don't think there's an actual function to retrieve it, but I may be wrong.
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today
I'm able to get it from the chat if I type /stats. I don't know how to be able to have it type /stats player and know which player it is itself though. I know how to get the player's names. I just can't figure out how to make it do /stats, know which player it did /stats on, wait until the chat hook has the win ratio, and then do that for the other player. I'm not experienced enough to be able to figure it out :/
Try the run_cmd() function
lua code:
run_cmd("stats isaac")
multiple texture uploader! updated: multiple texture remover!
updated pretty colorlist!

<BobJoelZ> ok ive just rebooted my pc and ive tried to activate my reflex on yahoo internet explorer :/ no luck

<Aracoon> I do not enjoy having anal sex with multiple men
I don't think stats works with the run_cmd function. It doesn't give an error, but it doesn't do anything either. It works with using help, so I think it's stats fault.

If there were another way to get wins and total games, I could just make the ratio myself.
Last edited by isaac; Jul 27, 2013 at 05:20 PM.
Well, you could get their Qi from get_bout_info(queue_position).games_played.
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today
Is there a way to get wins too? If not then I guess I'll have to figure out a way to get it from the chat.

And thanks btw, box and yoyo, I keep forgetting to thank you guys.


edit: I can't get new_game hooks to work.

code


Endgame works, but not either of the new games. It should run everytime a new round is started, right? Ok, it seems newgame only runs when I go to a singleplayer game. mpgame only goes when I join a server. Isn't there a hook for a new match?

Edit: I found the match_begin hook, nvm about that!


EDIT EDIT: Ok I have it at least doing what I want. It's probably not the best way to do it though, so I'll post my sloppy and poorly commented code here. Please give me suggestions on how I should've done it, or what can be done better. Thank you. http://pastebin.com/zQxBfE9v
Last edited by isaac; Jul 28, 2013 at 05:45 AM.
Yes, new_game is the singleplayer hook fired when a match starts, and match_begin is the multiplayer version.

Does the code work? As far as I know, there is no cleaner or more efficient way of obtaining the win ratio.
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today
Ah ok. The code works, so I guess that's all I need. Thanks


edit: New question! Is it possible to get the current joint that's under the mouse cursor? I'm looking at either bout_mouse_over or joint_select hooks, but I don't know how they work entirely. Any documentation on that?

edit edit: I got it now, nvm.
Last edited by isaac; Jul 28, 2013 at 05:04 PM.
get_selected_joint ()
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today