RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Some quick help with arrays and lists

Soteric

Knight
Code:
for( int i = 0; i < reader.ReadInt(); i++ )
This code shouldn't work. "i < reader.ReadInt()" invokes on each step of the loop, so you've serialized m_inMates.Count only once but deserialize it several times. You should deserialize it to some variable first and then use that variable
 

Lichtblitz

Sorceror
Soteric;803845 said:
Code:
for( int i = 0; i < reader.ReadInt(); i++ )
This code shouldn't work. "i < reader.ReadInt()" invokes on each step of the loop, so you've serialized m_inMates.Count only once but deserialize it several times. You should deserialize it to some variable first and then use that variable

Sorry, my fault. Too late for me ;-)
 

typhoonbot

Sorceror
Code:
public override void Deserialize( GenericReader reader ) 
		{ 
			base.Deserialize( reader ); 
 			int version = reader.ReadInt();
			
 			int read = reader.ReadInt();
			for( int i = 0; i < read; i++ )
			{
				Mobile readMobile = reader.ReadMobile();
				m_inMates.Add( readMobile, new MobileFields( reader.ReadDateTime(), reader.ReadTimeSpan(), reader.ReadPoint3D(), reader.ReadMap(), reader.ReadString() ));
				jTimer = new JailingTimer( readMobile, (m_inMates[readMobile]).Sentance );
				jTimer.Start();
			}
 		}

that is what I did, still having the same problem :(
 

Gargouille

Sorceror
I don't test it, but isn't it a timer problem ?

Try this :
Code:
public override void Deserialize( GenericReader reader ) 
		{ 
			base.Deserialize( reader ); 
 			int version = reader.ReadInt();
			
 			int read = reader.ReadInt();
			for( int i = 0; i < read; i++ )
			{
				Mobile readMobile = reader.ReadMobile();
				m_inMates.Add( readMobile, new MobileFields( reader.ReadDateTime(), reader.ReadTimeSpan(), reader.ReadPoint3D(), reader.ReadMap(), reader.ReadString() ));
				[COLOR="Red"]Timer t [/COLOR]= new JailingTimer( readMobile, (m_inMates[readMobile]).Sentance );
				[COLOR="Red"]t.[/COLOR]Start();
			}
 		}
 

typhoonbot

Sorceror
Nope, still is not fixing the problem, I can upload all the scripts, so that you can maybe compile them on your test shard and see the problem for yourself? :)
 

typhoonbot

Sorceror
Here we go, commands are [jail and [release.

A jailed mobile can use [jailtime and [reason. if they are not jailed (ie: not part of the dictionary) they will get a message saying "you are not in jail".

Thanks for all this help :eek:

EDIT: PS: I have created a custom region in Yew Jail cells, as those are the cells I use, you can easily set it to use the traditional runUO jail cells (just uncomment the coding in the list of cells and comment out the Yew Cells :)


Regards
 

Attachments

  • Jail System.cs
    8 KB · Views: 4
  • JailGUI.cs
    6.1 KB · Views: 5

typhoonbot

Sorceror
GRRRRRR :mad:

I forgot to create the damn item again, sorry for that - thank you very much for all your help and input to this thread, and to everyone else who helped out.

Working now :)

All that remains now, is to figure out how to take them out of jail / put them into jail if they were jailed / released while offline (as you cannot set a mobile's Location property when they are offline) - it doesn't take them there :(
 
Top