Jump to content

[HowTo] Redis DB Trader Cleanup


Brunz

Recommended Posts

  On 5/21/2015 at 7:41 AM, snafu0185 said:

any ideas how to fix?

Please post content of your *.CMD which you try to run. And screen or list of content files in directory DB.

And check your redis-server.exe version, it must be newer then 2.6 but I hope it is.

Link to comment
Share on other sites

  • 2 weeks later...
  On 5/22/2015 at 7:08 AM, snafu0185 said:

this one from the first post

 

redis-cli -h 127.0.0.1 -p 2456 -a mypass -n 0 --eval clean_ai_items.lua 

You are using the same port from Brunz example?

You can't use the same port, probably your port is not same like example from first post. Default port is 6379 (see your EpochServer.ini)

Copy   clean_ai_items.lua    file to DB directory and then create in DB directory file    clean_ai_items.CMD    containing this(without IP and PORT, yes it works but only if IP and PORT is set to default for Redis 127.0.0.1:6379 in epochserver.ini):

 

@echo off

redis-cli -a YOURPASSWORD -n 0 --eval clean_ai_items.lua

exit

 

Simply run cmd file and i hope it will working

PS: As you know, yourpassword is located in your EpochServer.ini too.

Link to comment
Share on other sites

  On 6/2/2015 at 2:02 AM, Inq said:

Any idea why i'm getting (Interger) 5 , I have changed the instance to NA123 and have the correct IP, port & password. I can also connect with redis desktop

 

See my previous post. You may try if it will working. Backup your DB before.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for this, it took some digging but i got it to work

 

hopefully this helps some others

 

first off, i ended up getting the redis-cli at

https://msopentech.com/opentech-projects/redis/ downloaded the zip and copied the redis.cli.exe to my DB folder

 

then i created

the 3 lua

if using default epochserver.ini

 

InstanceID = NA123

then use the following for each file:

 

clean_ai_items.lua

  Reveal hidden contents

 

clean_vehicles.lua

  Reveal hidden contents

 

clean_sold_vehicles_only.lua

  Reveal hidden contents

 

Now I made 3 seperate batch files

cleanai.bat

  Reveal hidden contents

 

soldvehicles.bat

  Reveal hidden contents

spawnedvehicles.bat

  Reveal hidden contents

with the last batch file, it will delete the vehicle key from the db. once you rejoin the server it will regenerate the db key and populate with spawned vehicles based on what you have in your epochconfig file.

Link to comment
Share on other sites

  • 2 weeks later...
  On 6/4/2015 at 10:11 AM, Kenobi said:

You are using the same port from Brunz example?

You can't use the same port, probably your port is not same like example from first post. Default port is 6379 (see your EpochServer.ini)

Copy   clean_ai_items.lua    file to DB directory and then create in DB directory file    clean_ai_items.CMD    containing this(without IP and PORT, yes it works but only if IP and PORT is set to default for Redis 127.0.0.1:6379 in epochserver.ini):

 

@echo off

redis-cli -a YOURPASSWORD -n 0 --eval clean_ai_items.lua

exit

 

Simply run cmd file and i hope it will working

PS: As you know, yourpassword is located in your EpochServer.ini too.

yes my ip and password are as in the ini ive changed-n 0 to -n 1 for my Bornholm server I just used that example as obviously im not posting my ip and redis password

 

I had a thought and ran redis-cli --help

 

in the list of acceptable commands --eval was not listed

Link to comment
Share on other sites

correct me if wrong to add items to the traders do i use this in clean_ai_items.lua

 

redis.call('set', valuelist, '[[],[]]')

 

like this?

 

redis.call('set', valuelist, '[["ItemSodaBurst", "meatballs_epoch", "MortarBucket", "CinderBlocks"],[2,3,4,1]]')

Link to comment
Share on other sites

yes if you want to have specific items in each trader you can do it this way

local valuelist = redis.call('keys', 'AI_ITEMS:NA123:*')
if valuelist then
    for i = 1, #valuelist do

	        redis.call('set', valuelist[i], '[[],[]]')

		count = count + 1
       
    end
end
return count

change the * to the specific ai key

 

so if you use say redis desktop manager you can see what keys are there,
and you will see things like

 

AI_ITEMS:NA123:0

AI_ITEMS:NA123:1

AI_ITEMS:NA123:2

AI_ITEMS:NA123:3

etc

 

the other way is to edit your epochconfig.hpp

 

and look for

//traders

 

and you can edit your list of items here.

though doing it this way every static trader will contain these items.

 

*Note: if you have forcestatictraders=false  then I found this function does not work. as the traders move around the map, go home for the night like a job.

 

Here is my traders section of my config.

  Reveal hidden contents

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 7 months later...

One thing i would like to know if possible, is there a way to only clean those vehicles which are not claimed by a player? when i use the spawned vehicles script it deletes every vehicle off the server. What im trying to achieve is to delete spawned vehicles on reboot, but not players vehicles. Would be so much easier if this used mysql database instead of Redis.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...