PDA

View Full Version : Quick question


Angelox
12-22-2006, 01:40 AM
How would I access $name-made variable from quest_globals?

I can use $name to make the global, but I can't figure out how to define it for use in a script.

sesmar
12-22-2006, 03:30 AM
If you could give an example of what you are trying to accomplish it might help with figuring this out.

Angelox
12-22-2006, 04:29 AM
quest::setglobal("$name","2","3","F");
will put the players name into quest_globals

but if I look for it again to compare;
if (($text=~/hail/i)&&($name==2)){
It doesn't see it - I think I need to convert $name into text first then use the text, and don't know how.

sesmar
12-22-2006, 07:01 AM
You want to do it like this:


if (($text=~/hail/i)&&(${$name}==2)){


At least in regular perl that will work.

This is what I used to test it:

$var1 = "var2";
$var2 = "Testing";

print "$var1 \n";
print "${$var1} \n";
print "$var2 \n";

Angelox
12-22-2006, 08:43 AM
Got it Sesmar, thanks - ran perfect.
here's what I fixed;


Well, I have to Link it because the post won't take such a large pl;
http://www.nahunta.org/~angelox/files/Vahlara.pl

Vahlara now will only give you one charm, you don't get the dupe message and the "here's the charm" text goes away. Also, when you zone out, since you can't come back anymore, the exit tutorial guy deletes the global.
If you decide to try it out, the "emoter npc's" in the script are not in the current posted database. This should fix them up;
INSERT INTO npc_types VALUES (189119,"_","",60,127,1,11,23400,0,10,0,1,1,1,0,0,0,0,100,480,"",0,61,0,0,0,0,0,1,0,0,0,0,0,1.25,245,245,245,245,2 45,0,1,1,1,1052,0,0,-25,0,299,299,299,299,299,299,299);
INSERT INTO npc_types VALUES (189120,"_","",60,127,1,11,23400,0,10,0,1,1,1,0,0,0,0,100,480,"",0,61,0,0,0,0,0,1,0,0,0,0,0,1.25,245,245,245,245,2 45,0,1,1,1,1052,0,0,-25,0,299,299,299,299,299,299,299);


also the globals for amote and bmote have to be initialized else you get swamped in emoter npcs;;
INSERT INTO quest_globals VALUES (153,0,0,189,"amote","2",0) ON DUPLICATE KEY UPDATE value=2;
INSERT INTO quest_globals VALUES (154,0,0,189,"bmote","2",0) ON DUPLICATE KEY UPDATE value=2;



Anyways I'm almost ready to put out another DB update - I got a lot more work done on Gunthak too.

sesmar
12-22-2006, 10:12 AM
Glad to hear that worked for you.