Search found 1256 matches
- Thu Dec 09, 2021 8:03 pm
- Forum: API Design
- Topic: Improving LangStrings and TranslationStrings to be less restrictive
- Replies: 9
- Views: 24628
Re: Improving LangStrings and TranslationStrings to be less restrictive
Is there any better way to achieve this, i.e. construct a string on-the-fly from existing TranslationStrings? Just pass your tokens directly to the send() method: SayText2('{skill_name} - {level_str} {skill_level} - {cost_str} {skill_cost}').send( player_index, skill_name=skill....
- Thu Dec 09, 2021 5:27 pm
- Forum: API Design
- Topic: Improving LangStrings and TranslationStrings to be less restrictive
- Replies: 9
- Views: 24628
Re: Improving LangStrings and TranslationStrings to be less restrictive
I could have sworn that it didn't work when I tried this yesterday :confused: Thanks though, that solves a lot of my problems. And assuming it's recursive, then basically that's already a tree structure, which I was originally suggesting. I feel silly now :rolleyes: For recursive strings I think yo...
- Thu Dec 09, 2021 4:16 pm
- Forum: API Design
- Topic: Improving LangStrings and TranslationStrings to be less restrictive
- Replies: 9
- Views: 24628
Re: Improving LangStrings and TranslationStrings to be less restrictive
⋅ Say I have one translation for a food's name, and one translation for "My favourite food is {food_name}" . How would I join these two messages and send them to a player? If you pass a TranslationStrings instance as a token, it will automatically translate it for the current l...
- Mon Dec 06, 2021 7:32 pm
- Forum: Plugin Development Support
- Topic: [Cs:s] Entity Remove
- Replies: 1
- Views: 2085
Re: [Cs:s] Entity Remove
It's safe to ignore that warning. It has nothing to do with Entity.remove but happens if Entity fails to initialize before Pointer and that output is just an informational message. I've pushed a fix to silence it into: aac2f59.
- Wed Dec 01, 2021 7:46 am
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
I don't know the implementation of IPhysicsObjectPairHash, so I can't say for sure, but why can't it be something like a regular two-dimensional array? If we only refer to networked entities, I think that would be more efficient. The physics engine internally uses that for that very purpose ( g_Ent...
- Tue Nov 30, 2021 8:45 am
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
but I have my suspicion regarding the actual impact of bots based solely on their movement Bots are indeed extremely noisy because they scan for targets, paths, etc. I've added some exclusions to OnEntityCollision to filter out contents we don't really care about in the context of collisions (visib...
- Mon Nov 29, 2021 9:15 am
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
Latest commits works for me on CS:S and CS:GO, and also add support for CollisionHash . For example: from entities.collisions import CollisionHash from events import Event from players.entity import Player collisions = CollisionHash() @Event('player_say') def player_say(g...
- Sun Nov 28, 2021 9:47 am
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
Nice, can't wait to try out, can you make a build for Linux/CS:GO? Jezza can probably provide you with a build. If that was for CS:S, I could fire up my VM and build it because it is up-to-date, but I'm too lazy to maintain my CS:GO (or any other games for that matter) environment which is constant...
- Sun Nov 28, 2021 9:32 am
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
Here's a quick attempt at something: https://github.com/Source-Python-Dev-Team/Source.Python/blob/on_entity_collision/src/core/modules/entities/entities_collisions.h Does this disable collision? It doesn't seem to do anything. (CS:GO/Linux&Windows) I only tested on CS:S, and built on CS:GO, so ...
- Sun Nov 28, 2021 7:22 am
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
Here's a quick attempt at something: https://github.com/Source-Python-Dev-Team/Source.Python/compare/entities_collisions Example: from listeners import OnEntityCollision @OnEntityCollision def on_entity_collision(entity, other): """Called when two entities are about to collide...
- Sat Nov 27, 2021 1:06 am
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
velocity wrote:What can I do insteadL'In20Cible wrote:Though, it really doesn't seem to be the right approach overall for what your goal actually is.
Well, I guess it depend of which entity but surely you can hook more targeted than that function. Do you have a map (preferably for CS:S) that have such entity?
- Fri Nov 26, 2021 9:51 pm
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
velocity wrote:does this mean its actually the same.. as pre, performance wise?
It means you process at least ~20% less calls than you previously did, which is still a good start I'd say. Though, it really doesn't seem to be the right approach overall for what your goal actually is.
- Fri Nov 26, 2021 9:07 pm
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
By the way, while I think about it, something else you could do as well would be to replace your prototype: [DataType.POINTER, DataType.POINTER], To: [DataType.ULONG, DataType.ULONG], Which would remove the internal CPointer instantiation, as well as removing the need for you to resolve the address ...
- Fri Nov 26, 2021 8:51 pm
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
Pre hooks are called before the original function is called, and post ones are called after but before the result is returned to the caller. At that point, you can no longer override a parameter, nor prevent what the original function does, but you can override the value it returned with your own wh...
- Fri Nov 26, 2021 8:18 pm
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
Then yes, my assumptions were right and you are not using the right tools. The first questions you have to ask yourself when hooking a function is; ⋅ Do I want to override a parameter with my own? ⋅ Do I want to prevent the original function from doing something? ⋅ Do I...
- Fri Nov 26, 2021 7:55 pm
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
SetTransmit is not called every tick, but only when the entities are in PVS and not already flagged as never emitted. But yeah, it can get rather noisy. However, both are quite different and unless I'm mistaken about what your goal is here I don't think you are using the right tools.
- Fri Nov 26, 2021 7:20 pm
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
TOTAL_FUNCTION is total function calls. It doesn't seem too bad, to be honest. I mean, that number may seems huge but when you divide it by 15, and then by the frame rate, you ends up with few dozens call a frame which is not the worst I've seen. That said, you should provide more details and conte...
- Thu Nov 25, 2021 8:55 pm
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
I optimized it a bit further by using if address not in dict: #..code# instead of dict.get(address, None) , this is actually slower than 'not in' lookup, because it takes time to lookup the get attribute first. Even so, I have to do a second comparison anyways (if key is not None). At least...
- Tue Nov 23, 2021 5:10 pm
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
velocity wrote:Also, what does AutoUnload do exactly?
It calls EntityIndexes._unload_instance when your plugin is unloaded so that the callbacks are being unregistered.
- Tue Nov 23, 2021 2:07 am
- Forum: Plugin Development Support
- Topic: conversion error on index_from_pointer
- Replies: 42
- Views: 34571
Re: conversion error on index_from_pointer
You could use ServerUnknown to bypass the exception handling and do the validation yourself: from entities import ServerUnknown def idx_from_ptr(pointer): try: unk = ServerUnknown._obj(pointer) except RuntimeError: return None if unk is None or not unk.is_networked(): return ...