[ES>SP] Port Possible?

Please post any questions about developing your plugin here. Please use the search function before posting!
ReiGekkouga
Junior Member
Posts: 2
Joined: Wed Jul 23, 2014 4:43 pm

[ES>SP] Port Possible?

Postby ReiGekkouga » Wed Jul 23, 2014 4:56 pm

User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Wed Jul 23, 2014 5:17 pm

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.
User avatar
Doldol
Senior Member
Posts: 200
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Postby Doldol » Thu Jul 24, 2014 12:35 am

User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu Jul 24, 2014 12:57 am

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.
Predz
Senior Member
Posts: 158
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Postby Predz » Thu Jul 24, 2014 8:29 am

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()
ReiGekkouga
Junior Member
Posts: 2
Joined: Wed Jul 23, 2014 4:43 pm

Postby ReiGekkouga » Thu Jul 24, 2014 4:03 pm

I tested this now on my server but I get many errors.
http://prntscr.com/45weg7

Did I made something wrong?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Fri Jul 25, 2014 2:26 am

Remove the first line: # coding: u....
qazuar
Junior Member
Posts: 16
Joined: Fri Jun 20, 2014 9:05 am

Postby qazuar » Sat Jul 26, 2014 11:16 am

Even if it loads, it should still crash when playing a sound.
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Sat Jul 26, 2014 12:28 pm

User avatar
Doldol
Senior Member
Posts: 200
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Postby Doldol » Sat Jul 26, 2014 7:06 pm

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.
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Sat Jul 26, 2014 7:28 pm

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
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Sat Jul 26, 2014 7:53 pm

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...
qazuar
Junior Member
Posts: 16
Joined: Fri Jun 20, 2014 9:05 am

Postby qazuar » Sat Jul 26, 2014 8:17 pm

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Jul 26, 2014 9:33 pm

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.
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Sun Jul 27, 2014 6:21 am

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).
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sun Jul 27, 2014 7:04 am

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Mon Aug 04, 2014 2:46 am

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 134 guests