Full Version : changing Say strings
xmlspawner >>Scripting Support >>changing Say strings
<< Prev | Next >>
darkwinters- 02-02-2006
ok now it works !! thanks very much arte.i will ask a last question about another issue.its a very basic issue so i dont want to open a new topic for it
i am trying to make my own banker sentences
i know how to change them

CODE
e.Mobile.AddToBackpack( new Gold( amount ) ); this.Say( 1010005 ); // Thou hast withdrawn gold from thy account.

to

CODE
this.Say("My custom sentence here");

this is ok but there is some complex with these ones

CODE
this.Say( 1042759, box.TotalGold.ToString() ); // Thy current bank balance is ~1_AMOUNT~ gold. this.Say( 1042673, AffixType.Append, amount.ToString(), "" ); // Into your bank box I have placed a check in the amount of:

for example i want to make these "There is "amount" gold in your bank
and
into your bonx i place "amount" gold
ArteGordon- 02-02-2006
you mean like

CODE
this.Say(String.Format("There is {0} gold in your bank", box.TotalGold));

darkwinters- 02-02-2006
yes but will this work if yes what will be the other?

CODE
this.Say( 1042673, AffixType.Append, amount.ToString(), "" ); // Into your bank box I have placed a check in the amount of:

ArteGordon- 02-02-2006
you can always make custom strings using the String.Format approach

CODE
this.Say(String.Format("into your box i place {0}", amount));

those other forms of Say have restrictions because they are using client localized strings (the cliloc numbers). Those are more efficient because the server doesnt actually have to send the strings themselves, but if you dont want to be restricted to the format of the clilocs, just use the String.Format and format your own.
darkwinters- 02-02-2006
but what are these?
box.TotalGold)
AffixType.Append
can i use amount like you show for them?
ArteGordon- 02-02-2006
box.TotalGold is just some integer property on the bankbox object.
AffixType.Append is a specific argument to that form of the Say method. If you arent using that form (also referred to as an overload), then you dont need it.
The pure string form of Say doesnt require any additional arguments. Just give it your custom formatted string.
darkwinters- 02-02-2006
ohh yess i got it ,it is very easy now the last thing is to add them hue
ArteGordon- 02-02-2006
one of the overloads of Say takes a hue argument like this

CODE
this.Say(33, String.Format("into your box i place {0}", amount));

where the number 33 is the hue
darkwinters- 02-02-2006
artegordon thank you very much!!
i think you must publish an online c#book for the internet
because your sentences are very clear and easy to understand!
thanks again.see you later..
darkwinters- 02-03-2006
arte can i edit these

CODE
creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502804, from.NetState ); // That animal looks tame already.

like this

CODE
creature.SendMessage( "this tamed before." );

ArteGordon- 02-03-2006
that will send the message to the creature. If you want to send it to the player use
from.SendMessage( "this tamed before." );
darkwinters- 02-03-2006
ok thanks one last question.i am goint to edit whole distro language with my custom sentences?does this make the server run slow or make lag bla bla ?
ArteGordon- 02-03-2006
yes, it will slow your server down a bit since all of those strings will have to be sent to the client. I cant say how much though.
darkwinters- 02-03-2006
very slow or very bit?
i mean do the players and i feel the slowing?
and what are you meaning about slows?making lag or startint server.exe takes longer time?
ArteGordon- 02-03-2006
it will produce exactly the same kind of lag as having many items, statics, corpses, etc. around.
The players will notice. If someone were to spam lots of those strings, everyone nearby would slow down.