Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2011, 12:11 AM
revloc02c's Avatar
revloc02c
Hill Giant
 
Join Date: Aug 2010
Location: UT
Posts: 215
Default Can you access quest::setglobal from a plugin?

So I've been working on plugins and discovered that I can't access $qglobals{variable_name_here} from inside the plugin. Am I correct? Is there a work around?

So I passed $qglobals{variable_name_here} into the plugin to a var just called $qglobals and that was working until I wanted to set/save a value. I found
Code:
quest::setglobal("variable_name_here", 1, 5, "F");
doesn't work. Am I correct? Is there a work around?

Just a couple more points, it was all working fine in a regular .pl file in the "quests" folder (so I got the $qglobal created in the db just fine, and the flag in the "npc_types" table set already too), just when I tried to get it in a plugin where I am running into trouble.
Reply With Quote
  #2  
Old 05-13-2011, 12:25 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Quote:
Originally Posted by revloc02c View Post
So I've been working on plugins and discovered that I can't access $qglobals{variable_name_here} from inside the plugin. Am I correct? Is there a work around?

So I passed $qglobals{variable_name_here} into the plugin to a var just called $qglobals and that was working until I wanted to set/save a value. I found
Code:
quest::setglobal("variable_name_here", 1, 5, "F");
doesn't work. Am I correct? Is there a work around?

Just a couple more points, it was all working fine in a regular .pl file in the "quests" folder (so I got the $qglobal created in the db just fine, and the flag in the "npc_types" table set already too), just when I tried to get it in a plugin where I am running into trouble.
Check out this link where the instances plugin uses qglobals inside a plugin:

http://code.google.com/p/eqemuplugin...k/Instances.pl

In order for this to work you need to make a change to globals.pl, you can source the plugins SVN for the file or check out the whole thing in general. That should help you achieve your goals.
Reply With Quote
  #3  
Old 06-02-2011, 12:17 AM
revloc02c's Avatar
revloc02c
Hill Giant
 
Join Date: Aug 2010
Location: UT
Posts: 215
Default I can't figure it out

That info Akkadius was very helpful, thanks.

I can't get this to work, here's my plugin:
Code:
sub NewbieBot_say {
	my $qglobals = plugin::var('qglobals');
	my $client = plugin::val('$client');
	$client->Message(315, "TEST 1");
	$client->SetGlobal("newbie_charm", 1, 5, "F");
	$client->Message(315, "TEST 2");
	if ($qglobals->{"newbie_charm"}) { 
			$client->Message(315, "It exists!"); 
		}
		else {
			$client->Message(315, "It DOES NOT exists!"); 
		}
	my $test = $qglobals->{"newbie_charm"};
	$client->Message(315, "$test");
	$client->Message(315, "TEST 3");
}

return 1;
And here's the output:
Code:
TEST 1
TEST 2
And that's it. Somehow I am not getting it to interpret $qglobals->{"newbie_charm"}; correctly. I checked the database and it is getting in there correctly from line 5. But as soon as I try to access it, nuthin. Can anyone see the problem?
Reply With Quote
  #4  
Old 06-02-2011, 12:34 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Quote:
Originally Posted by revloc02c View Post
That info Akkadius was very helpful, thanks.

I can't get this to work, here's my plugin:
Code:
sub NewbieBot_say {
	my $qglobals = plugin::var('qglobals');
	my $client = plugin::val('$client');
	$client->Message(315, "TEST 1");
	$client->SetGlobal("newbie_charm", 1, 5, "F");
	$client->Message(315, "TEST 2");
	if ($qglobals->{"newbie_charm"}) { 
			$client->Message(315, "It exists!"); 
		}
		else {
			$client->Message(315, "It DOES NOT exists!"); 
		}
	my $test = $qglobals->{"newbie_charm"};
	$client->Message(315, "$test");
	$client->Message(315, "TEST 3");
}

return 1;
And here's the output:
Code:
TEST 1
TEST 2
And that's it. Somehow I am not getting it to interpret $qglobals->{"newbie_charm"}; correctly. I checked the database and it is getting in there correctly from line 5. But as soon as I try to access it, nuthin. Can anyone see the problem?
From the sounds of it, your Perl script has compilation errors, as in it isn't getting past line 7 to parse the $qglobals object.

Did you source the plugins SVN first? Because it has a line commit global.pl that allows the parsing of $qglobals from within plugins.
Reply With Quote
  #5  
Old 06-08-2011, 09:36 PM
revloc02c's Avatar
revloc02c
Hill Giant
 
Join Date: Aug 2010
Location: UT
Posts: 215
Default

Thanks for looking at that. It must be my global.pl file, which I know you've mentioned twice, but I am not following you.
Quote:
source the plugins SVN
What does that mean?

(Sorry, I am not trying to be daft, just kinda new and still learning the lingo.)

I did "SVN Update" with Tortoise on the plugins folder, but that did not help, so you must mean something else.
Reply With Quote
  #6  
Old 06-08-2011, 09:47 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Quote:
Originally Posted by revloc02c View Post
Thanks for looking at that. It must be my global.pl file, which I know you've mentioned twice, but I am not following you.

What does that mean?

(Sorry, I am not trying to be daft, just kinda new and still learning the lingo.)

I did "SVN Update" with Tortoise on the plugins folder, but that did not help, so you must mean something else.
Checkout plugins from here:

http://www.eqemulator.org/forums/showthread.php?t=32608
Reply With Quote
Reply

Thread Tools
Display Modes

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 02:47 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3