Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bots

Development::Bots Forum for bots.

Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2014, 06:33 PM
Fluff
Fire Beetle
 
Join Date: Oct 2014
Location: Pacific Northwest
Posts: 28
Default Compiling with Bots

Hi,

I recently returned to the community here, I have been visiting off and on for what seems like over a decade to check in on progress. I recently set up a private Linux server with the instructions on the wiki (which btw- were excellent, thank you). Initially I tried to compile with bots but I kept getting an error when trying to source the load_bots.sql.

I tried to determine the problem but there seems to be a missing character_ table which the script needs to make a view and some sprocs. After some investigation I learned this table is being broken out from a blob currently as part of improvements.
http://www.eqemulator.org/forums/sho...ght=character_

Is getting bots to work as simply as adjusting this script to use the new character_* tables or are code changes needed as well? Has anyone already done this?

Thanks


**REFERENCE load_bots.sql examples**

DROP VIEW IF EXISTS `vwBotCharacterMobs`;
CREATE VIEW `vwBotCharacterMobs` AS
select 'C' as mobtype,
c.id,
c.name,
c.class,
c.level,
c.timelaston,
c.zoneid
from character_ as c
union all
select 'B' as mobtype,
b.BotID as id,
b.Name as name,
b.Class as class,
b.BotLevel as level,
0 as timelaston,
0 as zoneid
from bots as b;


DROP FUNCTION IF EXISTS `GetMobType` $$
CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1)
BEGIN
DECLARE Result CHAR(1);

SET Result = NULL;

IF (select count(*) from character_ where name = mobname) > 0 THEN
SET Result = 'C';
ELSEIF (select count(*) from bots where Name = mobname) > 0 THEN
SET Result = 'B';
END IF;

RETURN Result;
END $$

DROP VIEW IF EXISTS `vwGroups`;
CREATE VIEW `vwGroups` AS
select g.groupid as groupid,
GetMobType(g.name) as mobtype,
g.name as name,
g.charid as mobid,
ifnull(c.level, b.BotLevel) as level
from group_id as g
left join character_ as c on g.name = c.name
left join bots as b on g.name = b.Name;

DROP VIEW IF EXISTS `vwBotGroups`;
CREATE VIEW `vwBotGroups` AS
select g.BotGroupId,
g.BotGroupName,
g.BotGroupLeaderBotId,
b.Name as BotGroupLeaderName,
b.BotOwnerCharacterId,
c.name as BotOwnerCharacterName
from botgroup as g
join bots as b on g.BotGroupLeaderBotId = b.BotID
join character_ as c on b.BotOwnerCharacterID = c.id
order by b.BotOwnerCharacterId, g.BotGroupName;
Reply With Quote
  #2  
Old 10-13-2014, 07:14 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

I would change all of your `character_` references to `character_old` in your local load_bots.sql (or a copy of it.)

That should let you install the script.

Then, starting the server should catch the invalid reference and convert to the new views and function.


EDIT: I believe there are only 3 views and the `GetMobType` function that are affected by this change.
__________________
Uleat of Bertoxxulous

Compilin' Dirty

Last edited by Uleat; 10-13-2014 at 07:15 PM.. Reason: oops!
Reply With Quote
  #3  
Old 10-13-2014, 07:55 PM
Fluff
Fire Beetle
 
Join Date: Oct 2014
Location: Pacific Northwest
Posts: 28
Default

Thanks for the suggestion. This is a newly built server sourced from the PEQ 9-25-14 DB. In this database I do not have a character_old table present.
Reply With Quote
  #4  
Old 10-13-2014, 08:41 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Hmm... Did you delete it or has world not performed the auto-conversion yet?


IF `character_data` exists, and you can't reference the "old" table, then you will need to change your load_bots views to
match the fields listed here: https://github.com/EQEmu/Server/comm...54c307f25b2534

Don't forget to add the two '_utf8' casts.


If the default 'peq' now has the post blob conversion `character_data`, then I will update the scripts file(s) as soon as I get a chance.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #5  
Old 10-13-2014, 09:25 PM
Fluff
Fire Beetle
 
Join Date: Oct 2014
Location: Pacific Northwest
Posts: 28
Default

I didn't drop the table. The PEQ DB from 9-25 and 10-11 both have a character_data table. I'll see if I can create the view based on the code you linked.

Thanks.
Reply With Quote
  #6  
Old 10-13-2014, 09:48 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Yeah, sorry about that...

Someone had mentioned the load_bots.sql needs to be updated at some point..but, I was waiting for the default peq to switch...

I was not aware (my fault) that it had been updated.


I'll update the sql tonight and copy the old one to a deprecated folder for reference.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #7  
Old 10-15-2014, 08:53 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Ok, I updated the eqemu repo's load/drop bots script files and added a load_bots_old.sql to the 'deprecated' folder of bot scripts.


- IF you are using a post-player profile blob conversion database, you will need to use load_bots.sql

- IF you are using a pre-player profile blob conversion database, you will need to use load_bots_old.sql


Use this query to determine what version you have, if you are unsure:
Code:
SHOW TABLES LIKE 'character_data';
If you get a hit, then you have the new version..no hit is the old version.


There is an auto-conversion process in the server code to convert the required schema when it's updated.


ref: https://github.com/EQEmu/Server/comm...570d3f2a28a5e8


The 'peq' distro has the old script..and should for the time being..at least until any issues have been identified and worked out here first.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #8  
Old 10-16-2014, 01:00 PM
Fluff
Fire Beetle
 
Join Date: Oct 2014
Location: Pacific Northwest
Posts: 28
Default

Thanks Uleat, I'll snap shot my server and give it a try today or tomorrow.
Reply With Quote
  #9  
Old 10-16-2014, 02:19 PM
akathanam
Fire Beetle
 
Join Date: Feb 2014
Posts: 3
Default

Slight problem with the updated load_bots.sql:

The views vwbotcharactermobs, vwgroups, vwbotgroups, vwguildmembers are created lower-case, whereas the code references them with mixed case, this does not work on linux (at least, in my case, or i am just to stupid...).
Reply With Quote
  #10  
Old 10-16-2014, 06:16 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

No..I used my windows database for verification!


I made the assumption that tables were all lowercase in MySQL because they are always created in lower case regardless of mixed or not..whereas,
functions/procedures allow mixed case.


Gimme a few minutes and I'll commit a change for that.

(The 'Linux Ninja' strikes again!)
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #11  
Old 10-16-2014, 07:18 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Nope..I totally missed what you said about views there and it wasn't a table issue...


The code and the scripts have been updated to their correct names.

There is also a script to fix any auto-converted databases located in the repo.

ref: https://github.com/EQEmu/Server/blob...e_View_Fix.sql


Totally my fault... I used what I saw in the database for 'tags' when I was writing that auto-covert snippet..and it just crept over into
the script files through cut-and-paste :/
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #12  
Old 10-17-2014, 04:54 PM
Fluff
Fire Beetle
 
Join Date: Oct 2014
Location: Pacific Northwest
Posts: 28
Default

I had to manually delete all the bot tables probably because of the mix of attempts in the past, but after doing so I was able to source the script and compile and now have working bots on Linux.

Thanks Uleat.
Reply With Quote
  #13  
Old 10-17-2014, 06:12 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

I do apologize for that..and thanks for bringing it to light!


I coded the script to add back the primary key that was dropped when bots are added in `guild_members`.

That may have been what was killing the script...

Do you remember if that was the error you were getting with drop_bots? ('duplicate primary key')
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #14  
Old 10-17-2014, 07:01 PM
Fluff
Fire Beetle
 
Join Date: Oct 2014
Location: Pacific Northwest
Posts: 28
Default

It did break there, but when I ran drop_bots.sql it also didn't drop any of the tables due to the same problem.

It is trying to drop the primary key (which didn't exist) not add a duplicate though (in load_bots.sql).
Reply With Quote
  #15  
Old 10-17-2014, 09:01 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Ok, I added a note in 'drop_bots.sql' to run an ALTER TABLE `guild_members` DROP PRIMARY KEY; query since this is the script that we absolutely want to run.

If I can figure out how to do an 'IF EXISTS' on that, I'll update the code..otherwise, it will take a little user intervention until such time.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:30 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3