Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

Nysha's New Creators for July - posted on 1st Aug 2018 at 9:00 AM
Replies: 35 (Who?), Viewed: 16091 times.
Page 1 of 2
1978 gallons of pancake batter
Original Poster
#1 Old 18th Feb 2011 at 8:03 PM
Default Tutorial: Sims 3 Localized Coding
The Tutorial

The tutorial is located in the wiki: Tutorial:Sims_3_Localized_Codingwiki

Questions

If you have questions concerning the tutorial, this thread is the place to ask them.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
2 users say thanks for this. (Who?)
Advertisement
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#2 Old 18th Feb 2011 at 8:58 PM
Another good one, Buzzler. Keep up the good work.

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Space Pony
#3 Old 25th Mar 2011 at 12:00 AM
I'm new at modding and I'm getting errors about cannot change access modifiers when I copy the code given in the tutorial and try to build it to get the dll. I set up the Assembly file as shown in the Tutorial:Sims 3 Pure Scripting Modding .

This is my code in my SayHello class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sims3.Gameplay.Interactions;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.Autonomy;
using Sims3.SimIFace;
using Sims3.UI;


namespace Enirei
{
class SayHello : ImmediateInteraction<Sim, Sim>
{
public static readonly InteractionDefinition Singleton = new Definition();

public override bool Run()
{
string message = Localization.LocalizeString("Enirei/LocalizedMod/SayHello:Message", new object[] { base.Target });
base.Actor.ShowTNSIfSelectable(message, StyledNotification.NotificationStyle.kSimTalking);
return true;
}

[DoesntRequireTuning]
private sealed class Definition : ImmediateInteractionDefinition<Sim, Sim, SayHello>
{
public override string GetInteractionName(Sim a, Sim target, InteractionObjectPair interaction)
{
return Localization.LocalizeString("Enirei/LocalizedMod/SayHello:InteractionName", new object[0]);
}
public override string[] GetPath(bool isFemale)
{
return new string[] { Localization.LocalizeString(isFemale, "Enirei/LocalizedMod/SayHello:Path", new object[0]) };
}
public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return !isAutonomous;
}
}

}
}

I changed TwoBTech to Enirei since that was the namespace I was using.

Any help or suggestions that could be given would be greatly appreciated. Thanks.
Any help that could be gi
1978 gallons of pancake batter
Original Poster
#4 Old 25th Mar 2011 at 12:04 AM
Enirei, change the access modfiers of the overridden methods from public to protected and it should compile.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Space Pony
#5 Old 25th Mar 2011 at 4:11 AM
Thanks
Space Pony
#6 Old 25th Mar 2011 at 7:02 PM
Another thing is happening that I'm not sure about. I make the stbl file and add it to the package as in the tutorial. I put the package in to test it but I don't seem to have the say hello interaction. I look at the preview for the stbl file and it shows this:
Unknown1: 0x0000
Unknown2: 0x0000
Unknown3: 0x00000000
Key: 0xEFCFE0322BC7EB08 = Value: 'Say Hello'
Key: 0x233597618807DF5A = Value: '{MA.Whiny}{FA.Grumpy} Interactions'
Key: 0x7E6CB1745A6AB764 = Value: 'Hello, {0.SimName}!'

Again, any help/suggestions would be greatly appreciated.
1978 gallons of pancake batter
Original Poster
#7 Old 25th Mar 2011 at 7:22 PM
The FNV64 hash of "Enirei/LocalizedMod/SayHello:Message" is 0x3345B37043CBFBB2. I don't see that listed. When you change the string keys, e.g. from "TwoBTech/LocalizedMod/SayHello:Message" to "Enirei/LocalizedMod/SayHello:Message", you need to change that in the text file as well, not only in the code.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Space Pony
#8 Old 25th Mar 2011 at 8:14 PM
Oops. I had typed and retyped that part, when I re-pasted it, I forgot to change it again. Saved the package and noticed something when I looked at the STBL file. It says:
Error reading resource 220557DA:00000000:06F1866BA6BEEEC3
Front-end Distribution: 10-1104-1243
Library Distribution: 10-1104-1243

Source: mscorlib
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Exception has been thrown by the target of an invocation.
----
Stack trace:
at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at s3pi.WrapperDealer.WrapperDealer.WrapperForType(String type, Int32 APIversion, Stream s)
at s3pi.WrapperDealer.WrapperDealer.GetResource(Int32 APIversion, IPackage pkg, IResourceIndexEntry rie, Boolean AlwaysDefault)
at S3PIDemoFE.MainForm.browserWidget1_SelectedResourceChanged(Object sender, ResourceChangedEventArgs e)
----

Source: mscorlib
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Unable to read beyond the end of the stream.
----
Stack trace:
at System.IO.__Error.EndOfFile()
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadUInt64()
at StblResource.StblResource.Parse(Stream s)
at StblResource.StblResource..ctor(Int32 APIversion, Stream s)
----
Any help/suggestions?
Thanks for being patient with me.
1978 gallons of pancake batter
Original Poster
#9 Old 25th Mar 2011 at 8:30 PM
Now that is interesting. I've seen that a couple times and reported it to Peter Jones, but since I was unable to re-enact it and nobody seemed to have these issues, I thought the cause was my computer. Seems like it's a general issue after all. You might want to report that over at Simlogical. Since the issue can't be provoked, Peter probably won't be able to do much about it unless he stumbles over it by chance. Still, is the right thing to tell him.

The solution is pretty simple, though. Just delete the resource and add a fresh one in its place.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Space Pony
#10 Old 25th Mar 2011 at 9:25 PM
The thing is that I've gotten this result after deleting and adding a fresh one multiple times... T.T I seem to have bad luck with modding.

Question: how come in your Clean House for everyone mod you don't have an stbl file, instead an itun and and xml?
1978 gallons of pancake batter
Original Poster
#11 Old 25th Mar 2011 at 9:36 PM
Quote:
Originally Posted by Enirei
The thing is that I've gotten this result after deleting and adding a fresh one multiple times... T.T I seem to have bad luck with modding.
Whoa, seriously? Off you go to Simlogical to report that error and upload the exact files (package and stbl) to re-enact that error! You can also upload them here (package and source txt file) and I'll have a look if there's a workaround.

Quote:
Question: how come in your Clean House for everyone mod you don't have an stbl file, instead an itun and and xml?
I don't need string tables in that mod, because I'm using strings the game already has. The ITUN is the interactions's tuning; the XML is for instantiating the mod and a couple tunable values to configurate the mod without having to change the code.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Space Pony
#12 Old 25th Mar 2011 at 10:56 PM
Okay. I just created an account with Simlogical. Should I post it under sp3e downloads and support?

Here's a zip with my package, my text file, and my stbl file. Thanks.
Download - please read all instructions before downloading any files!
File Type: zip Enirei_SayHello.zip (3.5 KB, 13 downloads) - View custom content
1978 gallons of pancake batter
Original Poster
#13 Old 26th Mar 2011 at 7:48 AM
Quote:
Originally Posted by Enirei
Okay. I just created an account with Simlogical. Should I post it under sp3e downloads and support?
Seems like the right place, yes. Make sure to post the error message from above as well.

Quote:
Here's a zip with my package, my text file, and my stbl file. Thanks.
Hmm, I can't re-enact that error as always. I delete the STBL resource, then create the new one (actually I imported the STBL) and it's there without error. What are you doing exactly?

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Space Pony
#14 Old 26th Mar 2011 at 5:14 PM Last edited by Enirei : 26th Mar 2011 at 6:10 PM.
I create a new resource, set it as an STBL, the group 0x0 and the instance 0x06F1866BA6BEEEC3. Then I do "replace" with the STBL that I created.

Okay. I just tried it as importing the STBL and not doing the replace and it seemed to work just fine for building the package. Also, if I decide I want to do the replace function on the STBL I did the import on, it works fine... So it seems to not like me if I do a replace on an empty STBL resource. Weird.

I can't seem to find the interaction anywhere now when I load the game. Further testing in this area is needed.
1978 gallons of pancake batter
Original Poster
#15 Old 26th Mar 2011 at 5:29 PM
Quote:
Originally Posted by Enirei
Perhaps there's a bug with the replace function?
That may very well be the case.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Space Pony
#16 Old 26th Mar 2011 at 6:24 PM
I posted it to Simlogical. My testing seems to show it does not like doing a Replace on an empty STBL file created by Add Resource. When I did the import and then wanted to replace that file later on, it worked fine. Though as of right now I can't find the new interaction within the pie menu. T.T Mod creating does not agree with me it seems.

Thanks for your patience.
1978 gallons of pancake batter
Original Poster
#17 Old 26th Mar 2011 at 7:44 PM
Quote:
Originally Posted by Enirei
Though as of right now I can't find the new interaction within the pie menu.
I just looked at your code in Reflector. You only have the interaction, but it just sits there and doesn't get used. The point of the localized coding tutorial is not to get you started in script modding, but to get you started in writing localized code *after* you started script modding. Please refer to Tutorial:Sims_3_Object_Moddingwiki to see how an interaction gets added to an object.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Space Pony
#18 Old 26th Mar 2011 at 8:36 PM
gack! I thought I was forgetting something. Thanks.
Lab Assistant
#19 Old 9th Apr 2011 at 10:38 PM
The tutorials for pure scripting are great.

What I can't find a clue on how to do is dictating what submenu in the pie menu that an interaction should go.

For instance, the Say Hello example defaults to the main menu when clicking a target sim. How would you specify that you want your interaction button to appear under Friendly, Mean, Funny, or Romantic?

I can't see anything in any xml or the core that gives a clue how to do this.

It's probably something simple...
1978 gallons of pancake batter
Original Poster
#20 Old 9th Apr 2011 at 11:19 PM
Quote:
Originally Posted by jtravers88
How would you specify that you want your interaction button to appear under Friendly, Mean, Funny, or Romantic?
You can do that with the GetPath() method. If you want an interaction to show up under "Friendly" for example, you make GetPath() return new string[]{"Friendly"}; Localized of course, since this is the localized coding Q&A thread you're in.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Lab Assistant
#21 Old 9th Apr 2011 at 11:38 PM Last edited by jtravers88 : 9th Apr 2011 at 11:54 PM.
Quote:
Originally Posted by Buzzler
You can do that with the GetPath() method. If you want an interaction to show up under "Friendly" for example, you make GetPath() return new string[]{"Friendly"}; Localized of course, since this is the localized coding Q&A thread you're in.


I knew GetPath probably had something to do with it. But I couldn't find an example of "Friendly" or "Romantic" anywhere in this fnc declaration of any definition.

Thanks I'll try that out.
1978 gallons of pancake batter
Original Poster
#22 Old 9th Apr 2011 at 11:52 PM
Quote:
Originally Posted by jtravers88
I knew GetPath probably had something to do with it. But I couldn't find an example of "Friendly" or "Romantic" anywhere in this part of any definition.
You will hardly find any hardcoded strings in the game code anyway. The Friendly/Mean/etc. paths belong to the social interactions. These are parsed and built from an XML resource and use a single blueprint interaction. You will not find a Chat interaction in the code for example.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Lab Assistant
#23 Old 10th Apr 2011 at 2:08 AM
Quote:
Originally Posted by Buzzler
You will hardly find any hardcoded strings in the game code anyway. The Friendly/Mean/etc. paths belong to the social interactions. These are parsed and built from an XML resource and use a single blueprint interaction. You will not find a Chat interaction in the code for example.


Friendly and Friendly... don't work.

It adds a new selection to the top level of the pie menu, even if identical to the Friendly that already exists.

Twallan puts two interactions under the Friendly... in his woohooer mod. Gauge Attraction and Check Attraction. So far I haven't tracked down what causes it.
1978 gallons of pancake batter
Original Poster
#24 Old 10th Apr 2011 at 2:33 PM
Yeah, I ran into that a couple times myself.

Try
Code:
new string[]{ CommodityData.Get(str).GetChangeToneText() }

str can be "Friendly", "Insulting", "Funny" or "Amorous" for your purpose.

("Friendly" + Localization.Ellipsis) might work as well, but it would be better to use localized code from the start.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Test Subject
#25 Old 7th Sep 2011 at 10:34 AM
How can I make a mod like "Driving cars cost money" ,"cell phones cost money"? It is possible? Thank you!
Page 1 of 2
Back to top