Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 05-27-2019, 02:23 PM
EQDencelle
Fire Beetle
 
Join Date: Feb 2018
Posts: 5
Default

i see where you doubled the cash... when the player hands in the plat and such in the first place, but if they break even, i don't see a divide of the bet or anything to turn it back to the original amount... maybe i'm missing something?

Code:
$cash = $cash * 2; #double the bet
as for rounding, you are rounding, its just not apparent i guess...
take this code, if your orginal amounts were as follows: 7 copper, 0 silver
you would get back 7 copper, 1 silver (literally just tested this in a lua sandbox just to make sure i wasn't going crazy)
Code:
my $cash = $qglobals{"bet"};
$copper	= ($cash % 10);
$silver	= (int ($cash / 10) % 10);
$gold = (int ($cash / 100) % 10);
$platinum = int ($cash / 1000);
Reply With Quote
  #2  
Old 05-27-2019, 02:28 PM
Sturm
Hill Giant
 
Join Date: Dec 2015
Posts: 116
Default

I get what you're saying about the rounding, but you can only turn in platinum to the NPC he will hand you back anything else, so that doesn't become an issue.

Code:
if ($playerdice == $dealerroll) {
				# push - cards are the same. Return bet.
				plugin::Whisper("You rolled a $playerdice. It's a draw. Returning your wager. Thanks for playing.");
				my $cash = $qglobals{"bet"};
				$copper	= ($cash % 10);
				$silver	= (int ($cash / 20) % 10);
				$gold = (int ($cash / 200) % 10);
				$platinum = int ($cash / 2000);
				quest::givecash($copper, $silver, $gold, $platinum); #Give money back
				CleanUP();
			}
It's dividing the bet in half here on the push. Probably not the best way to do it, but it worked. I am definitely not an expert coder, I just dabble and play around with stuff.
This was just something simple I created and thought I'd share it for those wanting a simple gambling mechanic for their server.
Was kinda hoping this sparked an idea in someone and they'd post some other fun little game for everyone to play with.

__________________
Developer of the Imperium Server.
https://imperium-eq.com/
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:32 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