Go Back   RunUO - Ultima Online Emulation > RunUO > Custom Script Releases

Custom Script Releases This forum is where you can release your custom scripts for other users to use.

Please note: By releasing your scripts here you are submitting them to the public and as such agree to publish them under the GPL licensing terms. The RunUO Team has made its software GPL for you to use and enjoy you should do the same for anything based off of RunUO.

Reply
 
Thread Tools Display Modes
Old 08-14-2006, 01:41 PM   #1 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default [RunUO 2.0 RC1] CEOTurboSlots V1.0e

This is my updated slots to work with RunUO 2.0. Please note the following defines in the source of turboslot.cs:

// Undefine for a "live" shard. See profiling notes below.
#define PROFILE
// Undefine if you are not using RunUo 2.0 (Use this for both RC1 and RC2)
#define RUNUO2RC1
/* Using Arte Gordon's XMLSPAWNER? If so leave "#define XMLSPAWNER" below as is.
* If you do not have XMLSPAWNER installed comment out the line. All this does is
* give you a larger property gump to view the slot's properties.
*/
#define XMLSPAWNER
//
// This section allows you turn of themes and/or options that may not work on your shard
//#define MINIHOUSES (Minihouse theme is not done, I didn't want to delay the update tho)
#define MINIHOUSES_CEORANDOM (will explain later, doesn't matter)

/*
Package Name: CEOTurboSlots
Author: CEO
Version: 1.0b
Public Release: 12/22/05
Purpose: Real Casino style slots. 14 different themes and progressive jackpots.

Description: This package allows you to add casino style slots to your shard. You can choose
* from 14 different themes that all give different symbols, pay outs, and unique options. You can
* also link slots together for progressive jackpots. Some slots can be configured to give item
* rewards. Special "Casino Club" cards are given out to big jackpot winners allowing you to configure
* some slots just for those players. A top ten board is included that will show recent jackpot
* winners as well as give overall shardwide stats for GMs and above.
*
* Themes:

* Classic, ClassicII, ClassicIII: Modeled after real Las Vegas slots!
* FarmerFaceoff: "Nickle" slots with a farm theme.
* GruesomeGambling: Creepy. Bleeds player now and then and throws out bones. Top prize
* Hooded Shroud of Shadows. More deadly in Fel.
* Holiday1: Christmas themed slot.
* LadyLuck: Gives out luck items, sashe, cloak, or robe.
* MinerMadness: The original minermadness with exploit removed, streamlined bonus round gump,
* and is NOT a gold farm slot!
* OffToTheRaces: Inexpensive slot with a racing theme.
* Pirates: Arr mateys. 10gp slot with a priate ship model as top prize.
* PowerScrolls: Very colorful slot, that changes symbols (and top prize) every 4 hours.
* StatScrolls: The harrower! Watchout this one bites, more deadly in Fel.
* TailorTreats: Barbed kits as top prize.
* TrophyHunter: Uses the animal trophy mounts as symbols.
*
* Slots that give rewards have values assigned to the rewards. I spent many hours profiling and simulating
* these slots, the text file, allodds.txt, shows the statistical odds and simulated odds over many spins.
* Over alot of spins, they *will* remove gold from the economy. Some may seem to payout more
* often, but overall players will have fun while losing their shirts.

* In general the different odds are as such:
*
* Loose: 96%-98%
* Normal: 93%-96%
* Tight: 89%-92%
* Extremely Tight: 85%-88%
* Casino Cheats: 79%-84% (Not really cheating. The preferred setting for progressive groups.)
* Random: The machine will randomly bounce around from Loose-CasioCheats every 15 minutes.
* This setting can make a slot appear "hot", but then go "cold" after awhile.
*
* The odds tables are pretty accurate for each machine. They use odds distribution tables like real
* casinos with each reel having it's own symbol distribution/odds table.
*
* Note: A player's luck can also affect odds, though it'll be random and reevaluted every 10-15 minutes
* simular to the Random setting. The player will never know whether their luck helped or not. If the "roll" favors
* the player, the machine's odds will be bumped up by one favorable level, maxing out of course at Loose.
*
* The Percentage is basically the payback. For instance, a slot with a 95% payback odds means that
* for every 100gp played 95gp will be returned to the player.
* So over time and alot of spins/plays the casino's take will be 5%.
*
* Progressive Jackpots:
*
* With progressive jackpots you can link groups of machines together. As people play these slots
* a percentage of the gold played is added to what's called a progressive jackpot. This jackpot
* continues to grow until someone hits the "big one" on a linked machine. Progressive jackpots can
* get to be over several million gp and cause a playing "frenzy" as they grow. Because the odds of
* a machine can be dramtically affected, you should only link machines together that cost the same amount
* to play. IE. do not link a 5gp machine to a 100gp progresssive pool as the 5gp machine WILL become
* a gold farm. It's also recommended that progressive machine's odds are setup to be either Extremely
* Tight or Casino Cheats as over time the statistical payout will increase, and may even go over 100%.
* With Normal and Loose odds the machines have the potentional to be gold farms. Even in Extremely/CasinoCheats
* modes odds may go over 100%, odds like that are normal though, and only the machine that "hits" will
* be temporarily in the red and appear to be a gold farm.
*
* To setup a progressive pool, first set one slot machine's properties to ProgIsMaster = true. Then
* point other machine's property of ProgSlotMaster toward the "Master" slot machine. The more
* you link together the faster the jackpot will rise (as people play those machines).
*
* Other Options:
*
* Active(false): Determins whether a slot is available for play. A new slot will default to the
* Classic theme and Active=false allowing you to configure it before putting it
* online.
*
* AnnounceJackpots(True): Does a shardwide annoucement when someone hits a big jackpot.
* CardClubOnly(False): Only players holding a Casino Membership card may play this slot.
* CreditATMIncrements(10000):Amount to add to credit from bank gold in ATM transfer.
* CreditATMLimits:Varies with theme. The maximum amount that can be withdrawn from bank to machines credit.
* CreditCashOutAt:The maximum amount allowed on a machine before a bank check is put in player's backpack.
*
* ErrorCode: For determining the cause of a slot machine failure.
*
* JackpotRewards: Values are None (no item rewards), RewardOnly(jackpot gives items only), or
* RewardAndCash(jackpot gives rewards AND cash). This value only applies to those
* themes that give item rewards.
*
* MembershipCard(True):Issues a Casino membership card to jackpot winners over 500k.
* See CardClubOnly above. Also makes for a useful "bragging" trophy.
*
* PlayerSounds:Usually defaults to true. These slots are noisy! Designed to attract attention like
* real slots.
*
* ProgPercent(5%): The amount of gp played to be put into a progressive jackpot. See above for configuring
* progressive jackpot pools.
*
* Random Max/Min: The amount of time a Random machine stays on one odds table. Used also for when a
* player's luck has affected the odds table.
*
* ResetTotals: Used to reset the slots totals. Usually not recommended as you'll lose your stats.
*
* ShowPayback(false):Not recommended, but will show the slot's current payback amount to players. Note: GMs
* or higher will always be able to see this figure on the slot.
*
* SlotTheme: The current slot's theme. See Above.
*
* TotalCollected: Total amount collected by this slot.
* TotalNetProfit: The Casino's "Take".
* TotalSpins: The number of times the slot has been played.
* TotalWon: The amount of gp payed out to players.
*
* w_Percentage: Statistical odds of the machine.
* WinningPercentage: Real "current" odds of the machine.
*
* zJackpotStats0-S2: The # of times a particular jackpot has been hit. Jackpot 0 is the
* top line, S1 and S2 are scatter counters.
* zReelOne,ReelTwo,ReelThree: The current symbol line.
*
*
* Profiling/Creating your own machine.
*
* While there are already 14 themes to choose from, you might find yourself bored one day
* and decide to create your own unique machine. This can be as simple as changing the symbols
* and odds table to as complex as creating new rewards. To start you will need to remove the comments on
* the line "#define PROFILE". This option will present you with additional properties and let you
* put the machine into "test" mode. This IS NOT recommended for live shards as it has the potentional
* to be abused and turn your slots into a gold farmers dream or admin's nightmare!
*
* Building a new theme can also be quite complicated the first time, but after a few times you
* can usually create an all new theme in under an hour. I won't go over all the details on doing
* this, you're on your own except for any posts/info I may give in the script's thread. You should
* have a good grasp of how the slots work and especially what payback odds mean as well as generating
* profiling data to verify you're not creating a gold farm.
*
* -------------------------------------------------------------------
* Top Ten Board.
*
* I've also included a nice litte message board that players can click on to see a list of
* players that have recently won jackpots and encourage play. Put them at your banks and/or casino.
* GMs and above will also have an extra icon that takes you to a shard-wide information gump that
* will display all slots and totals/etc of your casino. Very helpful for an overall view of the
* slots and how much gold they have removed from your economy. It also allows you to get properties of
* a slot machine and zip quickly to a slot machine. You can also set a slot's Active (offline/online)
* property from this gump.
*
* Usage: ]add TurboSlotStats
* -------------------------------------------------------------------
* Casino Tokens.
*
* This item allows a player to play the slots for free up until uses remaining hits 0, which it
* then self deletes. A nice way to get people playing your slots is to drop one of these in their
* backpacks while online, or include it your new player startup pack. Defaults to 10 uses, but can
* be setup to do more then that.
*
* Usage: ]add CasinoToken {uses} {hue}
* -------------------------------------------------------------------
*
Acknowledgements: Thanks to RoninGT for the original miner madness slot.

Installation: Unzip CEOTurboSlots.zip into your custom script folder and restart.

Usage: ]add TurboSlot
*/
// Only use PROFILE options on a test shard!
Attached Files
File Type: zip CEOTurboSlots.zip (42.5 KB, 1576 views)
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx

Last edited by CEO; 08-14-2006 at 07:42 PM.
CEO is offline   Reply With Quote
Old 08-14-2006, 01:42 PM   #2 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default

* -------------------------------------------------------------------
* Top Ten Board.
*
* I've also included a nice litte message board that players can click on to see a list of
* players that have recently won jackpots and encourage play. Put them at your banks and/or casino.
* GMs and above will also have an extra icon that takes you to a shard-wide information gump that
* will display all slots and totals/etc of your casino. Very helpful for an overall view of the
* slots and how much gold they have removed from your economy. It also allows you to get properties of
* a slot machine and zip quickly to a slot machine. You can also set a slot's Active (offline/online)
* property from this gump.
*
* ]add TurboSlotStats
* -------------------------------------------------------------------
* Casino Tokens.
*
* This item allows a player to play the slots for free up until uses remaining hits 0, which it
* then self deletes. A nice way to get people playing your slots is to drop one of these in their
* backpacks while online, or include it your new player startup pack. Defaults to 10 uses, but can
* be setup to do more then that.
*
* ]add CasinoToken {uses} {hue}
* -------------------------------------------------------------------
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx

Last edited by CEO; 08-14-2006 at 01:46 PM.
CEO is offline   Reply With Quote
Old 08-14-2006, 01:43 PM   #3 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default

*reserved*
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx

Last edited by CEO; 08-14-2006 at 01:47 PM.
CEO is offline   Reply With Quote
Old 08-14-2006, 01:47 PM   #4 (permalink)
Forum Novice
 
Join Date: Feb 2006
Posts: 277
Send a message via ICQ to Tee312 Send a message via MSN to Tee312 Send a message via Yahoo to Tee312
Default

woot woot!!!! awesome ceo!!
Tee312 is offline   Reply With Quote
Old 08-14-2006, 02:14 PM   #5 (permalink)
Newbie
 
Dudus88's Avatar
 
Join Date: Dec 2005
Location: Poland
Age: 21
Posts: 55
Send a message via MSN to Dudus88
Default

Great! I Love that Script thx Ceo!
Dudus88 is offline   Reply With Quote
Old 08-14-2006, 02:54 PM   #6 (permalink)
Forum Novice
 
Join Date: Jun 2006
Location: Lakw Worth, Fla
Age: 48
Posts: 199
Send a message via ICQ to Hanse the Insane
Default

This is just too much, I love it!
__________________
45 and retired, Life is good, mostly :D
Hanse the Insane is offline   Reply With Quote
Old 08-14-2006, 03:42 PM   #7 (permalink)
Tru
Forum Expert
 
Tru's Avatar
 
Join Date: Jan 2003
Location: California
Age: 41
Posts: 3,259
Default

Awesome I love these..thanks for the update!
Tru is offline   Reply With Quote
Old 08-14-2006, 04:08 PM   #8 (permalink)
Forum Novice
 
otimpyre's Avatar
 
Join Date: Apr 2003
Location: Georgia
Age: 33
Posts: 392
Default Was wondering

When you would release this thanks! Love your scripts.
otimpyre is offline   Reply With Quote
Old 08-14-2006, 05:11 PM   #9 (permalink)
Newbie
 
Dudus88's Avatar
 
Join Date: Dec 2005
Location: Poland
Age: 21
Posts: 55
Send a message via MSN to Dudus88
Default

all nice but i got crash look :

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.TurboSlot.OnMovement(Mobile m, Point3D oldLocation)
at Server.Mobile.Move(Direction d)
at Server.Mobiles.PlayerMobile.Move(Direction d)
at Server.Network.PacketHandlers.MovementReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)


can somone help?
Dudus88 is offline   Reply With Quote
Old 08-14-2006, 05:18 PM   #10 (permalink)
Forum Expert
 
Johabius's Avatar
 
Join Date: Dec 2004
Location: Kansas, USA
Age: 39
Posts: 4,954
Send a message via ICQ to Johabius Send a message via Yahoo to Johabius
Default

Can you run the server in debug mode and replicate the crash? Might be a little more helpful.
__________________
In some cases stupid makes you win-Radwen
Johabius is offline   Reply With Quote
Old 08-14-2006, 05:21 PM   #11 (permalink)
Newbie
 
Dudus88's Avatar
 
Join Date: Dec 2005
Location: Poland
Age: 21
Posts: 55
Send a message via MSN to Dudus88
Default

How i can do debug mode? ;/
Dudus88 is offline   Reply With Quote
Old 08-14-2006, 05:27 PM   #12 (permalink)
Forum Master
 
Join Date: Aug 2003
Posts: 5,688
Default

I think that you just need to change the OnMovement method in turboslot.cs from this

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					m_InUseBy.CloseGump(typeof(TurboSlotGump));
					m_InUseBy.CloseGump(typeof(NewMinerBonusGump));
					m_InUseBy.CloseGump(typeof(TurboSlotPayTableGump));
					m_InUseBy.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						m_InUseBy.PlaySound(52);
						m_InUseBy.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(m_InUseBy); // Give them their winnings
					}
					InUseBy = null;
				}
			}
		}
to this

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					Mobile from = m_InUseBy;
					from.CloseGump(typeof(TurboSlotGump));
					from.CloseGump(typeof(NewMinerBonusGump));
					from.CloseGump(typeof(TurboSlotPayTableGump));
					from.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						from.PlaySound(52);
						from.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(from); // Give them their winnings
					}
					InUseBy = null;
				}
			}
		}
The problem is that when the gumps get closed, they can reset m_InUseBy to null.
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. "

For questions, information, and support for XmlSpawner and its addons, visit the
XmlSpawner Support Forum
ArteGordon is offline   Reply With Quote
Old 08-14-2006, 05:27 PM   #13 (permalink)
Forum Expert
 
Johabius's Avatar
 
Join Date: Dec 2004
Location: Kansas, USA
Age: 39
Posts: 4,954
Send a message via ICQ to Johabius Send a message via Yahoo to Johabius
Default

Quote:
Originally Posted by Dudus88
How i can do debug mode? ;/
Check out this post in the FAQ section of the forums
How to run your server in DEBUG
I usually just run my server in debug mode all the time for a while after I've added a new script or package.
__________________
In some cases stupid makes you win-Radwen
Johabius is offline   Reply With Quote
Old 08-14-2006, 05:58 PM   #14 (permalink)
Newbie
 
Dudus88's Avatar
 
Join Date: Dec 2005
Location: Poland
Age: 21
Posts: 55
Send a message via MSN to Dudus88
Default

ohhh thx now working nice
Dudus88 is offline   Reply With Quote
Old 08-14-2006, 06:00 PM   #15 (permalink)
Forum Novice
 
Prohor Meletevich's Avatar
 
Join Date: Jan 2006
Location: Tel Aviv, Israel
Age: 28
Posts: 144
Send a message via ICQ to Prohor Meletevich Send a message via Skype™ to Prohor Meletevich
Default

Quote:
Originally Posted by Dudus88
all nice but i got crash look :

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.TurboSlot.OnMovement(Mobile m, Point3D oldLocation)
at Server.Mobile.Move(Direction d)
at Server.Mobiles.PlayerMobile.Move(Direction d)
at Server.Network.PacketHandlers.MovementReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)


can somone help?
The same problem was on my shard. When the player go out from the slot and have some money in, slot tryes to give back money for the player. If player staying farther then 2 tiles from the slot, crash appears.

Also you can solve the problem by this way:

Code:
  public override void OnMovement(Mobile m, Point3D oldLocation)
  {
   if (m_InUseBy != null)
   {
    if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
    {
     if (m_Won != 0)
      {
        m_InUseBy.PlaySound(52);
        m_InUseBy.SendMessage("Hey, you left some cash in the machine! Cashing out.");
        DoCashOut(m_InUseBy); // Give them their winnings
      }
       m_InUseBy.CloseGump(typeof(TurboSlotGump));
       m_InUseBy.CloseGump(typeof(NewMinerBonusGump));
       m_InUseBy.CloseGump(typeof(TurboSlotPayTableGump));
       m_InUseBy.SendMessage("You have walked away from the slot machine, others may now use it.");
       InUseBy = null;
    }
   }
}


Last edited by Prohor Meletevich; 08-14-2006 at 06:15 PM.
Prohor Meletevich is offline   Reply With Quote
Old 08-14-2006, 06:17 PM   #16 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default

Odd, this worked fine before. I'll look into it asap, and have a fix shortly if it's reproducable.
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx

Last edited by CEO; 08-14-2006 at 06:42 PM.
CEO is offline   Reply With Quote
Old 08-14-2006, 06:21 PM   #17 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default

Quote:
Originally Posted by ArteGordon
The problem is that when the gumps get closed, they can reset m_InUseBy to null.
Good catch. I've never seen this happen on our shard, must be something in 2.0?

Why does it get set to null though and from doesn't? Something in the way the gumps close I guess. I should close the gumps after the cash payout I'm guessing...


Edit: Aw yes, I see. the CloseGump function I don't believe in 1.0 sent a 'close' to OnResponse in the gump before, now it does, which I have code in there to also close and payout.... So it's executing the gumps onclose as well. Here's what I've got, to keep it 1.0/2.0 compat:

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					m_InUseBy.CloseGump(typeof(TurboSlotGump));
#if !RUNUO2RC1
					m_InUseBy.CloseGump(typeof(NewMinerBonusGump));
					m_InUseBy.CloseGump(typeof(TurboSlotPayTableGump));
					m_InUseBy.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						m_InUseBy.PlaySound(52);
						m_InUseBy.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(m_InUseBy); // Give them their winnings
					} 
#endif
					InUseBy = null;
				}
			}
		}
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx

Last edited by CEO; 08-14-2006 at 06:53 PM.
CEO is offline   Reply With Quote
Old 08-14-2006, 07:02 PM   #18 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default

Updated to 1.0c to fix the way gumps close with 2.0, didn't even think to test that. Sorry about that. This might affect other close operations that I'll need to check.

Edit. Bumped again to 1.0d. Fixed one other closegump possible crash, but only when profiling a new slot, which should only be done on a non-live shard anyways.
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx

Last edited by CEO; 08-14-2006 at 07:22 PM.
CEO is offline   Reply With Quote
Old 08-14-2006, 07:44 PM   #19 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default

Also, please make sure you've commented out the "#define PROFILE" line, I've changed it and reuploaded 1.0e, as I've distributed the default with that undefined in the past, but didn't turn it off again while testing. You do not want PROFILE defined on a live shard, GMs have a potentional to 'profile' a theme and produce huge checks when cashing out, not to mention it'll stall the server for about 30 seconds+ while profiling! Of course, all the GMs we hire are honest, but just in case....
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx
CEO is offline   Reply With Quote
Old 08-14-2006, 08:55 PM   #20 (permalink)
Forum Master
 
Join Date: Aug 2003
Posts: 5,688
Default

Quote:
Originally Posted by CEO
Good catch. I've never seen this happen on our shard, must be something in 2.0?

Why does it get set to null though and from doesn't? Something in the way the gumps close I guess. I should close the gumps after the cash payout I'm guessing...


Edit: Aw yes, I see. the CloseGump function I don't believe in 1.0 sent a 'close' to OnResponse in the gump before, now it does, which I have code in there to also close and payout.... So it's executing the gumps onclose as well. Here's what I've got, to keep it 1.0/2.0 compat:

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					m_InUseBy.CloseGump(typeof(TurboSlotGump));
#if !RUNUO2RC1
					m_InUseBy.CloseGump(typeof(NewMinerBonusGump));
					m_InUseBy.CloseGump(typeof(TurboSlotPayTableGump));
					m_InUseBy.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						m_InUseBy.PlaySound(52);
						m_InUseBy.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(m_InUseBy); // Give them their winnings
					} 
#endif
					InUseBy = null;
				}
			}
		}
if you do it using the temporary 'from' variable, then it will be bulletproof since 'from' is assigned to the the value of m_InUseBy that passes the check, so it is guaranteed not to be null, and it is local so you know that it cannot be externally modified.
Then any other code, such as the gump code, that could subsequently change m_InUseBy, wont make any difference because you dont refer to InUseBy after that point.
If you leave the references to m_InUseBy, then there will always be the possibility of crashing since InUseBy is publicly accessible and so cannot be guaranteed to have the non-null value that initially passed the check since anyone can change it.

Code:
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			if (m_InUseBy != null)
			{
				if (!m_InUseBy.InRange(GetWorldLocation(), 3) || m_InUseBy.Map == Map.Internal)
				{
					Mobile from = m_InUseBy;
					from.CloseGump(typeof(TurboSlotGump));
					from.CloseGump(typeof(NewMinerBonusGump));
					from.CloseGump(typeof(TurboSlotPayTableGump));
					from.SendMessage("You have walked away from the slot machine, others may now use it.");
					if (m_Won != 0)
					{
						from.PlaySound(52);
						from.SendMessage("Hey, you left some cash in the machine! Cashing out.");
						DoCashOut(from); // Give them their winnings
					}
					InUseBy = null;
				}
			}
		}
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. "

For questions, information, and support for XmlSpawner and its addons, visit the
XmlSpawner Support Forum
ArteGordon is offline   Reply With Quote
Old 08-14-2006, 10:34 PM   #21 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default

Yeah, I thought about that later, but after updating so many times I'll leave it until the next update that'll add a couple more themes. One fix I made did do exactly that too, using a private var. And it doesn't cause much overhead trying to close a gump that isn't there.
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx
CEO is offline   Reply With Quote
Old 10-01-2006, 07:26 PM   #22 (permalink)
Forum Novice
 
Gaea's Avatar
 
Join Date: Apr 2004
Location: Texas
Age: 34
Posts: 191
Send a message via ICQ to Gaea
Default quick Q...

How can I make them flipable? right now they only face one direction...but id like to put them facing all dris (to go along walls) I love this sys btw, great work!
__________________
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Gaea is offline   Reply With Quote
Old 10-03-2006, 01:45 AM   #23 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default

Quote:
Originally Posted by Gaea
How can I make them flipable? right now they only face one direction...but id like to put them facing all dris (to go along walls) I love this sys btw, great work!
Should be easy. Change:

Code:
namespace Server.Items
{
	public class TurboSlot : Item
to

Code:
namespace Server.Items
{
	[DynamicFliping]
	[Flipable(3803, 3804)]
	public class TurboSlot : Item
You'll have to manually set it to movable and back to unmovable when done placing.
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx
CEO is offline   Reply With Quote
Old 10-03-2006, 02:41 AM   #24 (permalink)
Forum Novice
 
Gaea's Avatar
 
Join Date: Apr 2004
Location: Texas
Age: 34
Posts: 191
Send a message via ICQ to Gaea
Default Thanks!

Thank you very much!
__________________
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Gaea is offline   Reply With Quote
Old 10-04-2006, 01:07 AM   #25 (permalink)
CEO
Forum Novice
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 49
Posts: 808
Default

Quote:
Originally Posted by Gaea
Thank you very much!
You're welcome. Remember to mark that you've installed the Slots in this thread.
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx
CEO is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5