Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 08-07-2008, 09:26 PM   #1 (permalink)
Newbie
 
ThatGuyBehindYou's Avatar
 
Join Date: Jul 2008
Age: 18
Posts: 72
Default Serialization

Say i use:
Code:
writer.Write( (BaseDoor) m_Target );
How do i deserialize it after?
__________________
"I remember the time i was kidnapped and they sent a piece of my finger to my father, He said he wanted more proof."
ThatGuyBehindYou is offline   Reply With Quote
Old 08-07-2008, 09:35 PM   #2 (permalink)
Forum Novice
 
Tassyon T's Avatar
 
Join Date: Sep 2007
Posts: 367
Default

Quote:
Originally Posted by ThatGuyBehindYou View Post
Say i use:
Code:
writer.Write( (BaseDoor) m_Target );
How do i deserialize it after?
Click here: Serialization
Tassyon T is offline   Reply With Quote
Old 08-07-2008, 10:41 PM   #3 (permalink)
Newbie
 
ThatGuyBehindYou's Avatar
 
Join Date: Jul 2008
Age: 18
Posts: 72
Default

Wow thanks for the useless reply, before throwing links at me read them first. My question was how can i deserialize a BaseDoor i mean something like:
Code:
m_Target = reader.ReadBaseDoor();
__________________
"I remember the time i was kidnapped and they sent a piece of my finger to my father, He said he wanted more proof."
ThatGuyBehindYou is offline   Reply With Quote
Old 08-08-2008, 10:01 AM   #4 (permalink)
Forum Expert
 
vermillion2083's Avatar
 
Join Date: Jun 2005
Location: Lansing, MI
Age: 25
Posts: 1,042
Send a message via ICQ to vermillion2083 Send a message via MSN to vermillion2083
Default

I don't think you need to declare it a BaseDoor on serialization, try just serializing/deserializing it as an item, that should do the trick (although I am not sure on this so proceed with caution). If you look at the BaseCamp.cs script it uses a Item list to serialize doors for the banker camp, so Im assuming if you serialize a functional door as an item it will load as a functional door (seeing as the camps do). Again just an assumption, I have no hard proof on this.
__________________
Father Time
Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "Holy Hell......What a ride!!!"

Server: UO: Extinction
ICQ: 146563794
FatherTime@UOExtinction.com
UO: Extinction homepage
UO: Extinction forum
vermillion2083 is offline   Reply With Quote
Old 08-08-2008, 02:41 PM   #5 (permalink)
Newbie
 
ThatGuyBehindYou's Avatar
 
Join Date: Jul 2008
Age: 18
Posts: 72
Default

Quote:
Originally Posted by vermillion2083 View Post
I don't think you need to declare it a BaseDoor on serialization, try just serializing/deserializing it as an item, that should do the trick (although I am not sure on this so proceed with caution). If you look at the BaseCamp.cs script it uses a Item list to serialize doors for the banker camp, so Im assuming if you serialize a functional door as an item it will load as a functional door (seeing as the camps do). Again just an assumption, I have no hard proof on this.
Errors:
+ Customs/SecretStatue.cs:
CS0266: Line 66: Cannot implicitly convert type 'Server.Item' to 'Server.Ite
ms.BaseDoor'. An explicit conversion exists (are you missing a cast?)
__________________
"I remember the time i was kidnapped and they sent a piece of my finger to my father, He said he wanted more proof."
ThatGuyBehindYou is offline   Reply With Quote
Old 08-08-2008, 02:47 PM   #6 (permalink)
Forum Expert
 
vermillion2083's Avatar
 
Join Date: Jun 2005
Location: Lansing, MI
Age: 25
Posts: 1,042
Send a message via ICQ to vermillion2083 Send a message via MSN to vermillion2083
Default

It would help to know more about the script, and why it's serializing a door. Are you willing to show the project, or atleast explain it? Is it an addon?
__________________
Father Time
Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "Holy Hell......What a ride!!!"

Server: UO: Extinction
ICQ: 146563794
FatherTime@UOExtinction.com
UO: Extinction homepage
UO: Extinction forum
vermillion2083 is offline   Reply With Quote
Old 08-08-2008, 03:23 PM   #7 (permalink)
Newbie
 
ThatGuyBehindYou's Avatar
 
Join Date: Jul 2008
Age: 18
Posts: 72
Default

Quote:
Originally Posted by vermillion2083 View Post
It would help to know more about the script, and why it's serializing a door. Are you willing to show the project, or atleast explain it? Is it an addon?
Its a secret statue, its an item which when double clicked opens a door, the door is set trough [props
Code:
	public class SecretStatue : Item
	{
		private BaseDoor m_Target;

		[CommandProperty( AccessLevel.GameMaster )]
		public BaseDoor Target
		{
			get
			{
				return m_Target;
			}
			set
			{
				m_Target = value;
			}
		}
m_Target is the variable which holds the BaseDoor which is going to open on double click, but after every server shutdown-start m_Target doesn't get saved.
__________________
"I remember the time i was kidnapped and they sent a piece of my finger to my father, He said he wanted more proof."
ThatGuyBehindYou is offline   Reply With Quote
Old 08-08-2008, 03:39 PM   #8 (permalink)
Forum Novice
 
Soteric's Avatar
 
Join Date: Aug 2006
Location: Russia, Rostov-on-Don
Posts: 772
Send a message via ICQ to Soteric
Default

writer.Write( m_Target );
...
m_Target = (BaseDoor)reader.ReadItem();
Soteric is online now   Reply With Quote
Old 08-08-2008, 03:56 PM   #9 (permalink)
Newbie
 
fikusunc's Avatar
 
Join Date: Feb 2004
Location: Eaton, Ohio
Age: 34
Posts: 69
Send a message via ICQ to fikusunc
Default

Quote:
Originally Posted by Soteric View Post
writer.Write( m_Target );
...
m_Target = (BaseDoor)reader.ReadItem();
What soteric said should do the trick, I was to slow in responding. Read it back in as an item then cast it to a door.
__________________
My script library so far
fikusunc is offline   Reply With Quote
Old 08-08-2008, 05:18 PM   #10 (permalink)
Newbie
 
ThatGuyBehindYou's Avatar
 
Join Date: Jul 2008
Age: 18
Posts: 72
Default

Wow i didn't know you can do that, Thanks!
__________________
"I remember the time i was kidnapped and they sent a piece of my finger to my father, He said he wanted more proof."
ThatGuyBehindYou 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 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5