PDA

View Full Version : New Waypoint Instance Code


thepoetwarrior
04-01-2013, 03:06 AM
I re-wrote the Waypoint Instance code and sharing for anyone else to use or modify. So feel free to use, edit, share, anything with this code. Some of it was copy/paste/edit from other peoples code.

The code is for global_player.pl and players don't need to have any npc target to use instance. Just say in chat commands.

Allows solo, raid, and guild instances. The leader of raid and guild instances may invite and remove people from the raid and guild instances. There will be a pop up window showing a list of who's been invited (pending / joined) and who's been removed.

There is code there for GM to find and goto players in any instanced or public zone at their last known XYZ which can be a pain without this tool if the player is assigned to several instances. This even works if the player is offline!

Feedback and suggestions welcome.

Its about 105k and 2800 lines of code, so using pastebin to share.

Still requires NPC to give money if you are going to charge the users.

See links for source code to use on your server, and screenshots below to get an idea of the menu, etc.

Special Thanks to Bamron, Hateborne, Natedog, Trevius, Akkadius, Secrets and a few other people

Waypoint 1.6 Code
http://pastebin.com/cjzXvDyb

Waypoint NPC
http://pastebin.com/uL8ZqeZ6

http://i49.tinypic.com/2d1h5w.png

http://i47.tinypic.com/4l3lzs.png

http://i47.tinypic.com/mkf981.png

http://i45.tinypic.com/34e68w4.png

thepoetwarrior
04-01-2013, 03:07 AM
http://i49.tinypic.com/25ibv36.png

http://i45.tinypic.com/xp6lxy.png

http://i46.tinypic.com/3492d1c.png

thepoetwarrior
04-01-2013, 03:12 AM
Note the instance code uses all qglobals, no DBI.

The GM tool for find/goto how ever does use DBI to get info from the character_ table so you would need to update your db name, user name, and password that is clearly labeled in the code.

The discussion during the creation on this code can be followed here:

http://ezserveronline.com/forums/index.php?topic=3631.0

vkrr
04-01-2013, 11:19 AM
Wow. This is amazing work, poet.

thepoetwarrior
04-01-2013, 06:13 PM
Seems crosszonesignalclientbyname() only works if you are in the same zone with the other player, would be nice if it worked across to a different zone.

Might need to use DBI to read the qglobals since sometimes the zone bugs and doesn't see them giving the Illusion of the instance disappeared. This is a known bug with qglobals for years.

Akkadius
04-01-2013, 07:10 PM
Seems crosszonesignalclientbyname() only works if you are in the same zone with the other player, would be nice if it worked across to a different zone.

Might need to use DBI to read the qglobals since sometimes the zone bugs and doesn't see them giving the Illusion of the instance disappeared. This is a known bug with qglobals for years.

This sends a signal to all zones given you have provided the accurate name for the player. It is not limited to the same zone, that was the point of it. I've used it in my own implementations and it works for sure. Might need to debug what is getting sent to your arguements.

The packet is sent to all zones regardless of what zone the player is in.

thepoetwarrior
04-01-2013, 09:12 PM
Ok, thats good to know, originally assumed and was hoping sent to all zones.

Now to find out why its not.

Is there any rule value to turn on?

thepoetwarrior
04-01-2013, 09:40 PM
Well, I confirmed the crosszonesignal does work to any player in any zone.

So if the players were not able to invite someone into their instances from another zone, then its because they are not seeing the qglobals for the instance.

Current code to be in same zone name to work due to info being passed in the signal but you can be in your guild instance, then send signal to player in the public zone to join the instance, tested and working.

95% of players have no problem but sometimes there is the random issue that they don't see the qglobal that I can't pin point the problem.

Code is available for looking at.

Akkadius
04-01-2013, 09:47 PM
Well, I confirmed the crosszonesignal does work to any player in any zone.

So if the players were not able to invite someone into their instances from another zone, then its because they are not seeing the qglobals for the instance.

Current code to be in same zone name to work due to info being passed in the signal but you can be in your guild instance, then send signal to player in the public zone to join the instance, tested and working.

95% of players have no problem but sometimes there is the random issue that they don't see the qglobal that I can't pin point the problem.

Code is available for looking at.

That goes back to the intermittent issue where a zone doesn't immediately update its qglobal memory for whatever reason.

thepoetwarrior
04-01-2013, 10:12 PM
Yes, but don't know why.

Any way to force this to update in the quest code?

thepoetwarrior
04-02-2013, 08:01 AM
Updated!

Version 1.8.4

http://pastebin.com/9B0hWVCC

Changes are listed on the top of the source code.

The biggest change is that the instances now use DBI.

Reading Qglobals now by using DBI to 100% guarantee seeing the values qglobals for credit balance, if instance is created, list of invited players etc. Still don't know why randomly 5% chance for zones to not refresh memory what the qglobals are. DBI fixes this, possibly at the cost of performance (so far haven't noticed any performance hit). The new sub for reading qglobals is small and simple, returns the value of the qglobal. Did a find/replace on all the $qglobal{$variable} with the new sub fuction name.

Writing to the Qglobals table works the same way as before with setglobal command.

Fixed minor bug that players needed to be in the same public zone to invite each other into raid or guild instances. Now the leader can invite any player that is in any zone public or instance etc.

Also can now remove a player from the invite even if the player is in a different zone. When removing a player, it will zone them to the public version of the current zone the player is in if they are in the same zone name as the instance they were removed from. Else if they are in a completely different zone, then they will get the message but won't be teleported to the public version since there is no need. You can re-invite players after they have been removed/banned from the instance.

Players without guild can no longer create a guild instance with id of -1 and it will tell them that they have no guild if trying to create.

Enjoy!

vkrr
04-02-2013, 09:36 PM
Just got the new version , went to use it and I cannot figure out how to make it work. I have a free and paid token, but whenever i say instance it just gives me the " X waypoint menu" and "--------------" - - I'm sure im missing something... Im just not sure what it is

thepoetwarrior
04-02-2013, 09:56 PM
You can change the item id of your Waypoint click, just search for "hasitem" to quickly find the lines where you can change item ID.

In case you don't want to use clickie to summon pet for adjust prices, then just ignore that and edit the prices in sub SOLO_PRICE, sub RAID_PRICE, and sub GUILD_PRICE for example at line 1690 for else $new_price = 0;

Most likely, the user name and password are either missing or wrong in this part of the code:

Starts on line 2787

### Establish a Connection with password from Config File
sub LoadMySQLConnection
{
use DBI;
use DBD::mysql;
my $DATABASE_NAME = "XXXXXXXXXXXX";
my $DATABASE_USER = "XXXXXXXXXXXX";
my $DATABASE_PASSWORD = "XXXXXXXXXXXX";
my $dsn = "DBI:mysql:database=$DATABASE_NAME;host=localhost";
my $connect = DBI->connect($dsn, $DATABASE_USER, $DATABASE_PASSWORD);
return $connect;
} # End LoadMySQLConnection()

Be sure to replace XXXXXXXXXXXX with your database name, user, and password.

Sorry for any confusion.

Working on a new version today and just about done that will allow people in your raid group to enter raid without needing to be invited manually, will post it when soon within a day here.

thepoetwarrior
04-02-2013, 10:04 PM
I'm going to add some error check for people that try this for the first time and forget change the password, will look something like this when I put out the next source:

http://i49.tinypic.com/2i21qma.png

thepoetwarrior
04-03-2013, 03:13 AM
Updated to version 1.9.9

http://pastebin.com/jbWpGkL3

Now automatically gets your password to log into your database via your config file that you already have in your server directory. Alternate login / connect function available via renaming function name.

Anti Spam (Set to 5 message limit per 10 seconds)

Allow group to join leaders solo instance.

Allow raid group to join raid instance without having to be invited.

Anyone in raid group in raid instance can view the list of players invited via /say raid list

Anyone with guild tag can join guild raid without having to be invited.

Anyone with guild tag in guild instance say view invited players via /say guild list

Only raid instance leader can invite/remove players

Anyone with guild tag can invite others into guild instance

Bug fixed where qglobal name started with instance id and qglobal name started with guild id, if either were same, could zone into wrong zone, so those qglobals were renamed to avoid that problem.

Other qglobals got renamed. Easier to see them all in the quest_globals table now by searching qglobal names that contain "RaidI", "GuildI", or "SoloI".

Prices were adjusted to free for testing purposes.

Due to the testing from the players on EZ Server, most of the bugs are worked out and fixed now, and they are really enjoying the new system.

thepoetwarrior
04-03-2013, 08:01 AM
I just realized if the script still doesn't work with the correct password, then its cause the perl to mysql thingie isn't install. Had that problem a few years ago, and is simple fix.

Try this from command line:

ppm install DBD-mysql

If it installs anything, then that is what you were missing. Else perl can't connect to mysql database, and therefore the menu won't show up cause it needs values from the database tables via DBI!

thepoetwarrior
04-03-2013, 08:03 AM
Also, when your in game, type this:

#logs quest
#reloadquest

Now it'll show you debug info with line numbers where it is broken in the quest file, etc. Helps to figure out where problems are occur real fast!

thepoetwarrior
04-03-2013, 05:43 PM
Maybe this can help other people too, so I'll post question I got in PM.

THanks for the help. I went to install
and got a "PPM gives me a 401 Authorization Required" .

is there a way around this, or an alternative place to get the package?

Apparently you need a 'business edition license" for perl, what - the - fuck

I'm not expert with this stuff, perl, mysql, etc, just trial and error for a few years. I'll try to help though.

Authorization Required sounds like you need to do it in adminstration mode. Try to go into command line with admin mode.

Go to Start->Run
Type "command" (But don't hit enter)
See the Command Shortcut appear, right click on it, and then select "Run as Administrator". This should give you the permissions.

You DONT need the business edition license. Just regular perl, and I think the current version they use right now is 5.12? They have used 5.10, 5.12, and 5.14 in the past, and you NEED to use the correct version for what the source code is using. In the case they changed version number, can ask in the forum then.

Also, I think I read some where they had to the perl files from the source code, so I'm not sure if they swapped it out with business version or if you need to download your own version.

lerxst2112
04-03-2013, 05:58 PM
The problem is that ActiveState only allows free access to the two most recent versions of Perl. Since 5.12 is no longer in that group, you need a subscription to access the download and PPM modules.

Your options:
1) Compile as 64-bit using Perl 5.14 or 5.16.
2) Figure out why those versions of Perl crash on 32-bit compiles, fix it and send a patch, then revel in the glory and happiness knowing you helped make the emu better.
3) Nag somebody else to do step 2 for you.
4) Try Strawberry Perl. People have reported it works, and it's free. http://strawberryperl.com/releases.html

wirepuller134
04-03-2013, 07:45 PM
For the 401 unauthorized, we added the other repositories from the repository list in the gui Perl package manager under preferences.

sorvani
04-04-2013, 09:17 PM
You do not need the Perl packages to run a server.

Another recent post on the same thing....
http://www.eqemulator.org/forums/showthread.php?p=219417

Edit: unless you are doing some customized stuff

thepoetwarrior
04-04-2013, 09:53 PM
How about to run quest with DBI?

vkrr
04-04-2013, 10:08 PM
this worked for me

ppm install www.bribes.org/perl/ppm/DBD-mysql.ppd

sorvani
04-05-2013, 10:39 AM
How about to run quest with DBI?

That is not a default server setup, so you will need to figure something out. vkrr's post seems like a good answer from a 3d party site if you trust it.

rencro
04-05-2013, 01:08 PM
You do not need the Perl packages to run a server.

Another recent post on the same thing....
http://www.eqemulator.org/forums/sho...d.php?p=219417

Edit: unless you are doing some customized stuff

That is not a default server setup, so you will need to figure something out.

......................................__.......... ......................................
.............................,-~*`¯lllllll`*~,................................... .......
.......................,-~*`lllllllllllllllllllllllllll¯`*-,....................................
..................,-~*llllllllllllllllllllllllllllllllllllllllllll*-,..................................
...............,-*lllllllllllllllllllllllllllllllllllllllllllllllll lllll.\.......................... .......
.............;*`lllllllllllllllllllllllllll,-~*~-,llllllllllllllllllll\............................ ....
..............\lllllllllllllllllllllllllll/.........\;;;;llllllllllll,-`~-,......................... ..
...............\lllllllllllllllllllll,-*...........`~-~-,...(.(¯`*,`,..........................
................\llllllllllll,-~*.....................)_-\..*`*;..)..........................
.................\,-*`¯,*`)............,-~*`~................/.....................
..................|/.../.../~,......-~*,-~*`;................/.\..................
................./.../.../.../..,-,..*~,.`*~*................*...\.................
................|.../.../.../.*`...\...........................)....)¯`~,...... ............
................|./.../..../.......)......,.)`*~-,............/....|..)...`~-,.............
..............././.../...,*`-,.....`-,...*`....,---......\..../...../..|.........¯```*~-,,,,
...............(..........)`*~-,....`*`.,-~*.,-*......|.../..../.../............\........
................*-,.......`*-,...`~,..``.,,,-*..........|.,*...,*...|..............\........
...................*,.........`-,...)-,..............,-*`...,-*....(`-,............\.......
......................f`-,.........`-,/...*-,___,,-~*....,-*......|...`-,..........\........

vkrr
04-06-2013, 11:03 AM
Turns out my way doesn't quite work, I keep crashing the zone every time I use 'Instance' or 'Instances' -- it displays "[Create a solo Instance]" and then BAM, desync with server.

thepoetwarrior
04-08-2013, 05:18 PM
Yeah, probably cause its not connecting with the database.

Its a perl to mysql issue using DBI.