|  |  | 
 
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  | 
	
		
   
   
      | Archive::Quests Archive area for Quests's posts that were moved here after an inactivity period of 90 days. |  
	
	
		
	
	
	| 
			
			 
			
				06-10-2004, 09:16 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jun 2003 Location: England 
						Posts: 267
					      |  |  
	| 
				 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)
 |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 09:36 AM
			
			
			
		 |  
	| 
		
			
			| Developer |  | 
					Join Date: Feb 2004 Location: UK 
						Posts: 1,540
					      |  |  
	| 
 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. |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 09:39 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jun 2003 Location: England 
						Posts: 267
					      |  |  
	| 
 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)
 |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 09:45 AM
			
			
			
		 |  
	| 
		
			
			| Developer |  | 
					Join Date: Feb 2004 Location: UK 
						Posts: 1,540
					      |  |  
	| 
 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.
 |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 09:50 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jun 2003 Location: England 
						Posts: 267
					      |  |  
	| 
 
	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)
 |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 09:53 AM
			
			
			
		 |  
	| 
		
			
			| Developer |  | 
					Join Date: Feb 2004 Location: UK 
						Posts: 1,540
					      |  |  
	| 
 |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 09:58 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jun 2003 Location: England 
						Posts: 267
					      |  |  
	| 
 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)
 |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 10:16 AM
			
			
			
		 |  
	| 
		
			|  | Demi-God |  | 
					Join Date: Mar 2003 Location: USA 
						Posts: 1,067
					      |  |  
	| 
 
	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...
 |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 10:22 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jun 2003 Location: England 
						Posts: 267
					      |  |  
	| 
 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)
 |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 10:24 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jun 2003 
						Posts: 449
					      |  |  
	| 
 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. |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 10:27 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jun 2003 Location: England 
						Posts: 267
					      |  |  
	| 
 Exactly 2 minutes after me :PThis 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)
 |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 12:24 PM
			
			
			
		 |  
	| 
		
			
			| Hill Giant |  | 
					Join Date: Dec 2003 
						Posts: 166
					      |  |  
	| 
 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"; |  
	
		
	
	
	| 
			
			 
			
				06-10-2004, 02:48 PM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jun 2003 
						Posts: 449
					      |  |  
	| 
 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
 |  
	
		
	
	
	
	
	| Thread Tools |  
	|  |  
	| Display Modes |  
	
	| 
		
		 Hybrid Mode |  
	| 
	|  Posting Rules |  
	| 
		
		You may not post new threads You may not post replies You may not post attachments You may not edit your posts 
 HTML code is Off 
 |  |  |  All times are GMT -4. The time now is 06:14 PM.
 
 |  |  
    |  |  |  |  
    |  |  |  |  
     |  |  |  |  
 |  |