Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Quests

Archive::Quests Archive area for Quests's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2004, 09:16 AM
Dave987
Discordant
 
Join Date: Jun 2003
Location: England
Posts: 267
Default Advanced Perl Functions : ?

'lo all, I'm interested in learning about the advanced perl functions ? The only ones I know of are int() and rand() , and I have no idea at all how to use them.

If anyone would kindly write a mini-HowTo underneath , or even PM me , I'd be very greatful. Thanks alot everyone!

Once I learn these, my EQEmu Perl knowledge will be complete! Mwahaha! :twisted:

Thanks all.
__________________
;o)
Reply With Quote
  #2  
Old 06-10-2004, 09:36 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

I'm not a Perl guru myself, but if you don't get a reply here, going to www.google.com and searching for perl int, or perl rand, will educate you in those functions if you invest a few minutes clicking on the returned results.
Reply With Quote
  #3  
Old 06-10-2004, 09:39 AM
Dave987
Discordant
 
Join Date: Jun 2003
Location: England
Posts: 267
Default

That true Derision but 2 points.

a) I didn't really want a flame as such..

b) It's easier if someone actually replies who does use them, that way , if you don't understand something, you can ask. Google'd sites often speak in loads of Gibberish , and you often have to go into lots of Sub-Folders in Sub-Folders in Sub-Folders through a Folder Tree only to find out your at the wrong thing and need to start over.

Basically, I was just looking for a simple answer, which wouldn't waste my time.

Thanks anyway.


Edit: After a quick google search, the rand() and int() are not even usefully explained for EQEmu. Thats why I posted : So I could get code snippets and learn from those. Perl is used in other things, not just EQEmu , and the int's and rand's are not used in code snippets for EQEmu.
__________________
;o)
Reply With Quote
  #4  
Old 06-10-2004, 09:45 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

My reply wasn't meant as a flame, just as a suggestion if you didn't get any other replies to your thread, since when I searched with those terms on google, I got links that explained to me how those functions work.

I apologize if my reply to your post came across as a flame and assure you I won't post on your threads again.
Reply With Quote
  #5  
Old 06-10-2004, 09:50 AM
Dave987
Discordant
 
Join Date: Jun 2003
Location: England
Posts: 267
Default

Quote:
Originally Posted by Derision
I won't post on your threads again.
I'm not saying don't post - Please do! I just read it as a flame because it was so short and .. well, things can be mis-read on the internet right?

You say you found code examples on how to use these ? I'd appreciate it if you would link a site please? All I could find was people being super hi-tech and using rand() for webservers and things ... however, if you have found a clear to use code snippet that could almost be left unchanged for EQEmu , I would be very thankful for the link.

Sorry once again, I spose we should start putting accents into our Posts.

Thanks
__________________
;o)
Reply With Quote
  #6  
Old 06-10-2004, 09:53 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Well, this link seems to be a helpful with regard to rand:

http://iis1.cps.unizar.es/Oreilly/pe...ok/ch02_08.htm

and this one for int:

http://iis1.cps.unizar.es/Oreilly/pe...g/ch03_076.htm
Reply With Quote
  #7  
Old 06-10-2004, 09:58 AM
Dave987
Discordant
 
Join Date: Jun 2003
Location: England
Posts: 267
Default

Thanks for your help Derision. You say your not a Perl guru yourself so:

Could anyone check this one please?

The Code snippet says
Code:
$random = int( rand( $Y-$X+1 ) ) + $X;
Does this mean:

{
quest::summonitem($random =int(rand( 1001-1009)))
}

would summon any item between 1001 and 1009 ?

See Derision ? That's why I asked for Code snippets - I'm 90% sure thats completely wrong, though I thank you for trying to help.
It's appreciated.
__________________
;o)
Reply With Quote
  #8  
Old 06-10-2004, 10:16 AM
Scorpious2k's Avatar
Scorpious2k
Demi-God
 
Join Date: Mar 2003
Location: USA
Posts: 1,067
Default

Quote:
quest::summonitem($random =int(rand( 1001-1009)))
How about

Code:
{
  $random=int(rand(9)+1001);
  quest::summonitem($random);
}
or

Code:
{
  quest::summonitem(int(rand(9)+1001));
}
__________________
Maybe I should try making one of these servers...
Reply With Quote
  #9  
Old 06-10-2004, 10:22 AM
Dave987
Discordant
 
Join Date: Jun 2003
Location: England
Posts: 267
Default

Exactly what I was looking for!

Thanks alot Scorp, this will help alot
Is there a way to make it so only certain random items are summoned?

Say I wanted to randomly summon either item 120 , 150 or 564 , would that be possible? At a guess, it would look like this..

nope .. I have no idea - is it possible?

Thanks ALOT scorp
__________________
;o)
Reply With Quote
  #10  
Old 06-10-2004, 10:24 AM
x-scythe
Discordant
 
Join Date: Jun 2003
Posts: 449
Default

so if i wanted three items that werent continuous in there ID# like 1506, 1670, and 3004 for example it would be like:

Code:
{ 
  $random=int(rand 1506+1607+3004); 
  quest::summonitem($random); 
}

edit: lol must have replied at the same time as you dave.
Reply With Quote
  #11  
Old 06-10-2004, 10:27 AM
Dave987
Discordant
 
Join Date: Jun 2003
Location: England
Posts: 267
Default

Exactly 2 minutes after me :P
This will help our server alot, Thanks again Scorp and Derision,
it's Greatly Appreciated!

/perl master on :twisted:

"No-one can stop me, No-one!!"
__________________
;o)
Reply With Quote
  #12  
Old 06-10-2004, 12:24 PM
m0oni9
Hill Giant
 
Join Date: Dec 2003
Posts: 166
Default

BTW, for looking up perl functions, I usually use http://www.perldoc.com/perl5.6/pod/perlfunc.html. If you want to get non-contiguous values, you're probably best off putting them all into an array, and then choosing an array index at random.

edit: See if this works for you..

Code:
sub getrand
{
  return $_[rand @_];
}

$x = getrand (1002, 3023, 91982);
print "item is $x\n";
Reply With Quote
  #13  
Old 06-10-2004, 02:48 PM
x-scythe
Discordant
 
Join Date: Jun 2003
Posts: 449
Default

thanks for the info. when i tried your link tho it led me to a dead end

edit: n/m there was just a period added to the end. got it working once i took the period out of the link
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 07: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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3