[Researching] Event doesn't seem to be working right

Kademlia

New Member
7D2D RAT Supporter
I am pretty sure this is a BCM mod or odd server issue issue, but I wanted to confirm. This is a better starting items event and sends the player a little message. Sometimes players do not get the items. I am not sure about the message. This has happened maybe 3 times in the past 4 months I have been using this amazing server manager program.

I dug through the server logs and found that RATS is executing the telnet commands perfectly. However, like usual it does not show the response "given blah to player" that it normally does from BCM mod. I check with the player and sure enough they did not get their items. I am not sure about the message, but it shows the telnet command executing.

I am running the server on a Linux dedicated machine and using the remote connection option in RATS from another dedicated machine. I know the OS difference doesn't matter since I am using the remote option and RATS just simply uses telnet to connect. Below is a screenshot of the event in RATS. I have been meaning to post this but have not and my archive of logs is huge. I will update with the log message on next new player join.


NewPlayerEvent.png
 

Trekkan

JFF Administrator
Staff member
I can't remember offhand if bc-give works with a steamID (working, can't check right now), but if it does, I'd change all references of {player_id} to {player_steamid}.

If not, I'd then change {player_id} to {{player_name}}
Note the double {}, this means to wrap the name in double quotes for those players with spaces in their names.

The reason I'd move off of player_id is that that is an internal ID by the game server and I think they might get reused, which means at some point that ID won't be valid for the player you are expecting it to be, etc.
 

Kademlia

New Member
7D2D RAT Supporter
Yes you are right. That player ID is temp for that save data and changes each map reset for each player when I clear the save data folder. So I am assuming when it does not run it has not established an ID yet for that user.

Also yea I did not know about the {{player_name}} puts "double quotes" around it as to get the full name. I kept running into that problem with my username since it has spaces so I switched to ID. I replaced and tried again.

The intro message for me with just the {player_name} just calls me "The."

*********************** Figured I would try it and I get the below errors that the player does not exist for "The". This is why I went with IDs since they do not contain spaces and could not find a way around this.

1294
***************************************************************
Then I made a test command that just sends a chat:

say "[00FF00]Hey everyone, {{player_name}} just joined us for the first time! Let's be sure to work together to extreminate these zombies!"

since my name is "The Milk Man" I get the below when I execute the command.

2021-02-09T06:12:45 654.520 INF Executing command 'say "[00FF00]Hey everyone, "The Milk Man" just joined us for the first time! Let's be sure to work together to extreminate these zombies!"' by Telnet from 10.0.0.20:59945
2021-02-09T06:12:45 654.520 INF Chat (from '-non-player-', entity id '-1', to 'Global'): 'Server': Hey everyone,


RATS reads and executes it properly. however the game does not see the name with spaces.


EDIT: It works on some commands and doesn't work on others. I will keep playing around with this and see. It could be my syntax where I missed a space or something. That {{}} info definitely helped :D
 
Last edited:

Kademlia

New Member
7D2D RAT Supporter
I have confirmed that the command works with {{player_name}} if I do a test event that is executed with chat but if I do a join event with the same script then it cannot find my name and detects it as "The" which the player cannot be found.

ID works fine for the most part. Just sometimes it states that the ID cannot be found. Maybe there is a way to delay this command on join? Perhaps it is executing too fast when they join. I do have a server confirm message but the command does not run until the message is accepted and they join.

Update: After further testing it will give me items with {{player_name}} but the joining chat messages says "The" player cannot be found. With the script below I kept single {} around player name inside of chat message since it is already in quotes. When I join I do not get the chat messages and checking the logs they show player could not be found. However I get the items. Like I said before I might just have to do a combo of ID and name.

say "[00FF00]Hey everyone, {player_name} just joined us for the first time! Let's be sure to work together to extreminate these zombies!"
sayplayer {{player_name}} "Here are your starting items."
bc-give /silent {{player_name}} meleeToolPickT2SteelPickaxe /c=1 /q=3
bc-give /silent {{player_name}} meleeToolShovelT2SteelShovel /c=1 /q=3
bc-give /silent {{player_name}} meleeToolRepairT0TazasStoneAxe /c=1
bc-give /silent {{player_name}} casinoCoin /c=5000
bc-give /silent {{player_name}} medicalFirstAidBandage /c=20
bc-give /silent {{player_name}} gunHandgunT1Pistol /c=1 /q=3
bc-give /silent {{player_name}} ammo9mmBulletBall /c=300
bc-give /silent {{player_name}} modGunSoundSuppressorSilencer /c=1
bc-give /silent {{player_name}} drinkJarPureMineralWater /c=20
bc-give /silent {{player_name}} foodCanSham /c=20


There is a big BUT to this. I only have this issue with the new player join or player join commands. If I use this same script in a chat executed command it works just fine. Something with the join event.

Perhaps I can add a timer to delay the command for 10 seconds or something.
 
Last edited:

Trekkan

JFF Administrator
Staff member
That's a lot of testing, thank you for putting in that effort! There's a way around it I think.

Basically, on the New Player joined event, set them an admin level of say 1900, then on the player spawn joined event, set the conditional to something like ALEVEL=1900
Then, in the script, set their admin level to say 1800 (They they aren't set to new player level for the next time they join your server)
Then spawn the items you want to give them.

By the time the player spawn joined event happens, I'm pretty sure we have all of the information we can get on the player. The player connected events, the player is still logging in and there isn't enough information about the player yet available.

Hope that makes sense. If it doesn't, please let me know and I'll try to clarify. =)
 

Kademlia

New Member
7D2D RAT Supporter
I understand what you are talking about. However this messes with my admin permissions I already have set for some people. I tried on my test server though and it did not like that at all.

This command was the only way i could find to change admin permissions.
admin add {player_id} 1900

Then under Player spawn join event i have conditional
ALEVEL:=1900

then runs the command to give items. It never ran this one. I checked the permissions file and i had 1900 admin level. RATS saw me still as 0 though. I think the max you can use is 1000 according to the permissions xml.

Once again this messes with the permissions. I have a few mini admins on the server that can ban and what not. I would manually have to set these back afterwards. I dug deeper into the variables and I didn't even notice that you can use steam ID. bc-give supports uses Steam ID and it seems to work after multiple tests. If this works in the long run then I may go with that. The custom welcome message with their name is not that important as the starting items and admin permissions levels on the server. I can just make it a generic message that does not state their name or something. I also have an admin axe that I give to those with the proper admin level on join.

I will try with the steam ID and go from there unless you have some more insight. Thanks again for the program and help :D. Perhaps one day there would be an option to set, read, change, and use in conditionals, custom variables in RATS scripts. This would be really powerful.

Update: SteamID seems to be working. Tested over 10 times on my test server. Will report if this resolves the issue of giving starting items. As I said before the custom message that says they join is not that important. I just made it say "hey someone joined" haha.
 
Last edited:

Trekkan

JFF Administrator
Staff member
Very good to hear its working now! There are some bugs here for sure and I'll see what I can do to fix 'em. =) As for custom variables, those are coming for sure. =)
 

Kademlia

New Member
7D2D RAT Supporter
Is there a way to put a delay on an event? I see the set timer options but do not know how to use them. Perhaps I can put a 10 second delay at the beginning of the event. Then after delay is done it executes the rest of the event to give items. This way it makes sure players have time to spawn into the world. This could be from a slow client computer not fully loading yet but the server sees the player as joined. I am speculating on the slow client part. I do not have a slow computer to test on ;).
 

Trekkan

JFF Administrator
Staff member
If you you use the PlayerSpawn Join event, that waits until they've actually spawned into the world and should work.
 

Kademlia

New Member
7D2D RAT Supporter
I am using the NewPlayer connected event. I just want them to get the new items on their first join. Not everytime they spawn. Perhaps I can do a check that see's if they joined before and just give items if it's their first time?

The NewPlayer connected event sometimes executes before the player is actually spawned. I cannot get it to happen to me. Just some other clients. Most likely they have a slower computer or something and takes longer for them to load in.

It almost seems to be a server/BCM mod issue. I will do additional testing and let you know what I find. I will end up trying Windows based server and use remote/local as well as Linux with a different machine. Test with mods and without mods (except for required BCM and Alloc). Test differences.

UPDATE: I put the RATS software on a better machine (was a VM on an older server) and the teleports and other commands seem to run faster. Monitoring the starting items event to see if SteamID plus RATS move did it.
 
Last edited:

Kademlia

New Member
7D2D RAT Supporter
Attached is an example of the player not getting items even though he is spawned. It failed on most of the items and then gave the last 2 or 3 items. I see there is a way to set timers. Wonder if I would be able to set a timer to start when someone spawns in. Then after 10 seconds it gives them the items. I have tried playername, Steam ID, and player ID all with the same results. I just do not know the syntax for using the timers.

For the sake of testing I have tried different machines for the server using Windows and Linux. Happens regardless of the server OS version or hardware. It may be something with 7 days. I know the game is in Alpha. Just wanted to throw this out there. I have also used different machines for the RATS software just to make sure it's not an issue with the machine itself.

I am using the remote feature. I do not like the local feature at all and I never use it. I like for my server to have all resources available for the game. Me remoting into the server to manage RATS uses system resources that I do not want to use while the game is active.
 

Attachments

Trekkan

JFF Administrator
Staff member
Previously, I could count on that event to only fire when the player was spawned in the game. This might not be the case now, I'll have to do some more testing. It appears that that is what is failing those as that's why the last items get spawned correctly. Right now, from a code perspective, RAT is doing exactly what it should. It just appears that I might not be able to count on that event like I once did.

As for timers, its possible you can do what you want with them as well. I just did a small document on it last week, you can find it here: [DOC] - How to: Use timers in RAT
 
Top