When running any type of print() / hint() function more than once within the same tick, causes the functions to no longer print of display anything.
The server I am playing on is running the workshop version.
The server is also running atlas chat, I'm not sure if that would effect it, but as it's related to the chat box.
The print anti-spam is blocking your print
Oh, is there a convar that I can have the server owner change to stop the anti-spam?
I think removing the anti-spam for the owner of the chip would be fine. The only danger is them getting disconnected from reliable channel overflow
Oh okay, I could just simply make a custom print queue. But the main issue I was running into was if I did run print() twice within the same tick. It would cause the functions to no longer work until I reconnected to the server
In that case, it sounds like something is breaking the functions. I'll try it tonight to see if I can reproduce it.
It's not hard coded, there's two convars. https://github.com/wiremod/wire/blob/c32c86fb527a05e4d06ef892ca7cc208d09f7381/lua/entities/gmod_wire_expression2/core/debug.lua#L46-L47
You should be able to print more than once a tick by default though.
@bigdogmat Yeah my delay is set to 0 and when I run two prints within the same tick, ie. running two prints within if(first()), it causes the print function to break and no longer work
0 will break it probably. Try 0.001 instead.
@thegrb93 Passing 0.001 fixes it. Thanks for the quick responses
I thought this were supposed to work like so. Using a value of 0 will thus stop all prints(?), it is a quick way to control delay before another print can be invoked.
To recap, if you want to receive all prints, use a very small floating point number for wire_expression2_print_delay (it should always make a print pass "anti-spam"), and also set wire_expression2_print_max to a reasonable high integer number, I usually have them saved as this:
wire_expression2_print_delay "0.00001";
wire_expression2_print_max "65535";
I have used these for a long time without overflowing the reliable channel, however some people have experienced overflow disconnects using those values (so, I guess it is not for everyone). Try playing around with some smaller numbers (for max) - if you are printing a lot...
So, you're proposing to add an extra check if a delay is equal to 0 in order to disable anti-spam?
If so, it sounds like the right thing to do, but it is worth noting that it would be a breaking change.
Sorry about that.
I'm not entirely sure what the error is. Division by 0 works without any problem, modulo does not work though. So this code causes an error.
Is it possible that if canPrint will cause CurTime to be called here and later here, the values will be equal? In that case timePassed will equal 0, making this division equal -nan instead of inf, making any comparison equal false?
Idk, but there's a much better way to do this that doesn't involve error floats
Yes, don't allow these extreme values or clamp them to a specific range and add another console variable to turn off the anti-spam.
Why not just allow
wire_print_delay 0to turn off anti-spam?
Because why would that automatically mean anti-spam is turned off? You didn't turn anti-spam off, you just set the delay to zero. Maybe it's the same result, but it's not the same.
Just check for 0 and turn it off if it is
A temporary solution is to use printTable(), which appears to bypass these delays.
@name printfast
@inputs
@outputs
@persist
@trigger
#[ ]#
## E2 Library: printFast ##
## ##
## Adds an unlimited and faster print. ##
## You can also name the data you spew. ##
## ##
#[ ]#
if(first()){
function printFast(Name:string,Data:vector){
OUT = table()
OUT[Name,vector] = Data
printTable(OUT)
}
function printFast(Name:string,Data:entity){
OUT = table()
OUT[Name,entity] = Data
printTable(OUT)
}
function printFast(Name:string,Data:string){
OUT = table()
OUT[Name,string] = Data
printTable(OUT)
}
function printFast(Name:string,Data:number){
OUT = table()
OUT[Name,number] = Data
printTable(OUT)
}
function printFast(Name:string,Data:angle){
OUT = table()
OUT[Name,angle] = Data
printTable(OUT)
}
}
Can there not just be a clamp like k4su said?