Page 1 of 1

[ES>SP] Port Possible?

Posted: Wed Jul 23, 2014 4:56 pm
by ReiGekkouga

Posted: Wed Jul 23, 2014 5:17 pm
by satoon101
All of that, at first glance, looks as if we already have an API designed around it. I am at work, so I cannot provide an example until I get home.

Posted: Thu Jul 24, 2014 12:35 am
by Doldol

Posted: Thu Jul 24, 2014 12:57 am
by satoon101
At first glance that looks correct. I should note to both of you that you can use [python][/python] to create proper syntax blocks:
http://www.sourcepython.com/showthread.php?527-Syntax-Highlighting-is-back!!!

For the SayText2 example, you might also consider:

Syntax: Select all

current_leader = SayText2(message='\x06$name\x04 is the actual leader with\x06 $kills\x04 kills.')
new_leader = SayText2(message='\x06$name\x04 has taken the leadership!')


# Then, when sending:
current_leader.tokens = {'name': leader.name, 'kills': players[leader]}
current_leader.send()



new_leader.tokens = {'name': attacker.name}
new_leader.send()


Also, VOL_NORM is the default value for the volume, so you don't really need to provide that argument if using the default.

Posted: Thu Jul 24, 2014 8:29 am
by Predz
Didn't realise python highlighting was enabled, but cool.

Um, is there a problem in the SayText2 function with using variables? I only found this in CSGO. But if you use a variable to define "message" in SayText2 then colours are not displayed. It just displays the text as actual text, with no replacement of the colours. It works in CSS but only gives this outcome in CSGO.

e.g

Syntax: Select all

text = '\x06Test \x04Test'
SayText2(message=text).send()

Posted: Thu Jul 24, 2014 4:03 pm
by ReiGekkouga
I tested this now on my server but I get many errors.
http://prntscr.com/45weg7

Did I made something wrong?

Posted: Fri Jul 25, 2014 2:26 am
by L'In20Cible
Remove the first line: # coding: u....

Posted: Sat Jul 26, 2014 11:16 am
by qazuar
Even if it loads, it should still crash when playing a sound.

Posted: Sat Jul 26, 2014 12:28 pm
by Hedgehog

Posted: Sat Jul 26, 2014 7:06 pm
by Doldol
Oops, yes, the recipientfilter was a last-minute change.

But I've never had to precache my sounds, I did only use stock files and was running on CSS.

Posted: Sat Jul 26, 2014 7:28 pm
by Ayuto
You don't need to precache sounds if you are using the Sound class. It will take care of it for you. ;)
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/addons/source-python/packages/source-python/engines/sound.py#L140

Posted: Sat Jul 26, 2014 7:53 pm
by Hedgehog
Ayuto wrote:You don't need to precache sounds if you are using the Sound class. It will take care of it for you. ;)
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/addons/source-python/packages/source-python/engines/sound.py#L140
No, you need. EngineSound.is_sound_precached don't work :) It always return True :D
Maybe I'm wrong but it can be an engine bug...

Posted: Sat Jul 26, 2014 8:17 pm
by qazuar
In case you missed it, he wants this ported to cs:go, and yes it will crash 100%.

Also for the precache, it doesn't seem like the sound classs takes care of it.
If i don't precache it with the .precache() method i'm getting a "is not precached" error in the console when playing.
Where as if i do use the method i am not getting the error. Therefor it clearly makes a difference.

Posted: Sat Jul 26, 2014 9:33 pm
by satoon101
If you look at Ayuto's link, you will see that the Sound class does indeed precache the sound. However, if is_precached always returns True, it will skip precaching. I will have to do some tests later to find out what is happening with that. We have noticed that PlayerInfo.is_player always seems to return True, as well.

Posted: Sun Jul 27, 2014 6:21 am
by Hedgehog
As I remember PlayerEntity.isdead had same problem some time ago... Not sure about now :)

By the way, is_precached don't work on CS:S windows server (don't know about other one).

Posted: Sun Jul 27, 2014 7:04 am
by L'In20Cible
Hedgehog wrote:As I remember PlayerEntity.isdead had same problem some time ago... Not sure about now :)
PlayerEntity.isdead will returns True when you are spectating while PlayerEntity.pl.deadflag will returns 1 when your player is actually dead. This is not an issue with the plugin itself but how VALVe named things behind.

Hedgehog wrote:By the way, is_precached don't work on CS:S windows server (don't know about other one).
Then the best way is probably to check if the sample is contained into the "soundprecache" string table.

Posted: Mon Aug 04, 2014 2:46 am
by satoon101
Just a heads up, in case anyone has not been paying attention to the repository, but is_precached has been updated to use the stringtable for soundprecache, as L'In20Cible has suggested. There has not been a new release with that available, but you can get it by cloning the repository, building the core yourself, and uploading the necessary files to your server.