Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Inventor
#26 Old 27th Jan 2012 at 4:58 PM Last edited by douglasveiga : 27th Jan 2012 at 5:12 PM.
Quote: Originally posted by Jbob
We have 3 mods that deal with the butler, I have not contacted
these creators yet but I am willing to. I am still in idea phase and learning
and experimenting, it's how I work. Looking at these other mods, each has its
own uses and at least two of them people wished were part of a single mod.
what I am wondering, is if permission is granted to use their creations, is it
possible to merge them together? Rainbow Brite has a mod with 18 flavors,
is it possible to through scripting merge her 18 into one so that you get to
pick which parts you want for example if you want the Butler recurrent no
cooking or the more expensive recurring no cooking butler and pick which flavor
you want for cooking tweaks from Gobot101's mod? I think both of those
mods reference the butler XML resource so can we not combine the two XML codes into one?


it's hard to give you an answer, i even don't know how these mods works.

if they are XML that modify the Butler XML, probably it's not possible to "merge".

if they are script mod, so the easiest way is to start from scratch, because trying to merge two different scripts it's hard and almost insane.
Advertisement
Lab Assistant
Original Poster
#27 Old 29th Jan 2012 at 2:26 AM
No I agree that it can be easier to start from scratch, however I want to ask about the example of Rainbow Brites mod. It has 18 flavors instead of having 18 separate files, could you through a combination of tuning and a script write everything to one package that will in game let you pick which of the 18 flavors you want?

Second question: It was brought up previously how we would like a Butler who can serve drinks. As far as I can tell, out side of the active Sim this class is set to the Professional Bar class. I have seen no resource strings devoted to mixologists. So can we take the resource strings from the Professional Bar class and merge it within the Butler class? So far I have not run across anything that says you can't, but I also have not seen anything that says you can. And to do something like that would you use both the ITUN resources and the code found in the Bar Professional Class?
Inventor
#28 Old 29th Jan 2012 at 3:36 AM
Code:
No I agree that it can be easier to start from scratch,


i mean, two different scripts codes (C#) are hard to merge.

Quote: Originally posted by Jbob
a combination of tuning and a script write everything to one package
that will in game let you pick which of the 18 flavors you want?


yes, it's possible

Code:
So can we take the resource strings from the Professional Bar class and 
merge it within the Butler class?


can't understand, what do you mean by "resource strings", XML? or scripts?

Code:
would you use both the ITUN resources and the code found in the Bar 
Professional Class?


i prefer just code.
Lab Assistant
Original Poster
#29 Old 1st Feb 2012 at 5:38 PM Last edited by Jbob : 1st Feb 2012 at 7:05 PM.
If your looking at S3PE you have the tabs, Name, tag,type. Name is the name of the resource string, type is the type of resource string etc etc. I loosely was making a false distinction between XML and scripts. Realistically Scripts are the strings of commands that make up XML coding. I apologize about the mislabeling and confusion.

you have the Butler 0x73683c721c7a4bf4 resource string in GameplayData, and this is an XML resource string.

I export that using S3PE this automaticly sets it as a text file. Which I can then open in VS.

Butler:
<?xml version="1.0" encoding="utf-8"?>
<base>
<Current_Tuning>
<kServiceTuning>
<kMaxNumNPCsInPool value="1">
<!--Max num NPCs at once in service-->
</kMaxNumNPCsInPool>
<kCost value="1200">
<!--Cost of service-->
</kCost>
<kIsEmergencyService value="False">
<!--If true this service charges kCost only if falsely called, otherwise free.-->
</kIsEmergencyService>
<kIsRecurrent value="False">
<!--Whether the service is recurrent (true) or one-off (false). Recurrent services are the only type which can be cancelled through the phone dialog.-->
</kIsRecurrent>
<kAlwaysTryToSendSameSim value="True">
<!--Whether or not the service always tries to send the same NPC to a specific household-->
</kAlwaysTryToSendSameSim>
</kServiceTuning>
<kMinHungerBeforeStartCooking value="-20">
<!--If any of the CTYAE Sims get below this hunger value, Butler starts cooking-->
</kMinHungerBeforeStartCooking>
<kTimeWaitBeforePutawayLeftovers value="90">
<!--How old leftovers can be out in minutes before the butler will put it away-->
</kTimeWaitBeforePutawayLeftovers>
<kTimeBetweenSuccessfulCookingSessions value="140">
<!--How often the butler will cook in minutes. This prevents the butler from Autonomously cooking continuously. Only used when successfully cooked-->
</kTimeBetweenSuccessfulCookingSessions>
<kTimeBeforeRestartCooking value="80">
<!--When you interrupt a butler while he's cooking, he'll try to continue cooking. But, if he hasn't cooked anything after this time, he'll restart the meal from scratch.-->
</kTimeBeforeRestartCooking>
<kUseObjectInSameRoomAsSleeperMultiplier value="0.0001">
<!--Multiplier for interactions in a room where a sim is sleeping-->
</kUseObjectInSameRoomAsSleeperMultiplier>
<kRelationshipLevelForQuit value="-45">
<!--If Butler's relationship with any YAE falls below this level, he will quit-->
</kRelationshipLevelForQuit>
<kTimeCanStartCookBeforeSimWakes value="1.8">
<!--Butler can start cooking this many hours before the target sim wakes up. This allows the butler to have food ready when the sleeping sim wakes up-->
</kTimeCanStartCookBeforeSimWakes>
<kChanceGetGoodAdviceMoodlet value="75">
<!--Chance you get the good advice moodlet when asking for advice from the butler-->
</kChanceGetGoodAdviceMoodlet>
<kDelayBeforeArriving value="0.75">
<!--Length of time (in hours) that the butler waits before routing to lot-->
</kDelayBeforeArriving>
</Current_Tuning>
</base>

Now we are going to focus on making the butler do things with the bar.

Looking at Gameplaydata I see
Bar+makeDrink 0x03d31cbe26f1d949- This is the script controlling make drink I would guess

BarProfessional_0xd462cfd437254e86- this is the script that sets the rules and role of a bar professional

BarProfessional+OrderConversation 0xc43c0356d6f7cb7d- I would gather this is controlling the conversation while a drink is being made

BarProfessional+practice_0x40093bb2e55fb02b-This is seting the rules for practicing making drinks

There are a few more to that list but we will focus on these for now.

So we want a Butler that makes drinks, at this point do we export the BarProfessional XML since I suspect this controls the overall paramiters of the bar profession? Or do we find it to be more simple to export Bar+MakeDrink, BarProfessiona+practice XML strings? I am thinking if we incorporate the BarProfessional into our script the outcome would be a butler that spends most of their time at the bar on our lot. Would this be a correct assumption?

The final question for now is based on the Butler script above. Any direction to get our butler to do BarProfessional things needs to be added after :
</kDelayBeforeArriving>
</Current_Tuning>
</base>
in the script above? If this is the case do we then write some script that leads into or calls forth the actions and interactions of the bar professional or do we just copy the barprofessional XML information we want to use (BarProfessiona+Practice) for example?
Lab Assistant
Original Poster
#30 Old 1st Feb 2012 at 6:34 PM Last edited by Jbob : 1st Feb 2012 at 7:06 PM.
IF we use the BarProfessional XML we could edit out all the reference to "length of Time" This I am guessing would give your butler all the benefits of a bartending professional within the confines of time and living arrangements of the butler. What about adding the "mixology skill to the butler on top of cooking and handiness?

Like this:
public override void UpdateCreatedSim(Sim sim)
{
Skill skill1 = sim.SkillManager.AddElement(SkillNames.Handiness);
Skill skill2 = sim.SkillManager.AddElement(SkillNames.Cooking);
Skill skill3 = sim.SkillManager.AddElement(SkillNames.Mixology);
int maxSkillLevel = skill1.MaxSkillLevel;
for (int index = 0; index < maxSkillLevel; ++index)
{
skill3.ForceGainPointsForLevelUp();
skill2.ForceGainPointsForLevelUp();
skill1.ForceGainPointsForLevelUp();

I seems to recall seeing where the actual skill points we shown but at the moment I cannot find it.

To address how butler handles cooking as Inge pointed out would we look at :
Cooking-MealSpecifics
Cooking Use
Cooking
Cooking process

or all of them need to be incorporated into the new mod?

I am not sure if this is handled in the Butler script already but I think if we add "cooking" to the mod this will treat the Butlers meals just like sims meals and The number of times a sim makes a recipe (while he has cooking skill) is tracked. When the recipe is completed, it gets bonus food points equal to this bonus value * the number of times he's prepared the meal. It's essentially an "experience" in the specific recipe.

So is it better to include all of these resources and edit them individually to get what we want or would it be better to just create a package on the Butler resource then copy and paste all the needed or desirable scripting from these other "resources" (Cooking-MealSpecifics,
Cooking Use, Cooking, Cooking process, Bar+makeDrink, BarProfessional, BarProfessional+OrderConversation, BarProfessional+practice)
Lab Assistant
Original Poster
#31 Old 1st Feb 2012 at 7:31 PM
So far this is how I have it set up in VS.
using Sims3.Gameplay;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.ActorSystems;
using Sims3.Gameplay.Autonomy;
using Sims3.Gameplay.CAS;
using Sims3.Gameplay.Core;
using Sims3.Gameplay.Interfaces;
using Sims3.Gameplay.Objects;
using Sims3.Gameplay.Scenarios;
using Sims3.Gameplay.Skills;
using Sims3.Gameplay.Utilities;
using Sims3.SimIFace;
using System.Collections.Generic;

namespace Sims3.Gameplay.Services
{
public class Butler : Service, IAmCleaningService
{
private static readonly string sLocalizationKey = "Sims3.Gameplay.Services".Substring(6).Replace('.', '/') + "/Butler";
private static string kButlerBook = "HowToServeAndNotBeServed";
[Tunable]
private static Service.ServiceTuning kServiceTuning = new Service.ServiceTuning();
[TunableComment("If any of the CTYAE Sims get below this hunger value, Butler starts cooking")]
[Tunable]
private static float kMinHungerBeforeStartCooking = -20f;
[Tunable]
[TunableComment("How often the butler will cook in minutes. This prevents the butler from Autonomously cooking continuously. Only used when successfully cooked")]
private static float kTimeBetweenSuccessfulCookingSessions = 40f;
[TunableComment("When you interrupt a butler while he's cooking, he'll try to continue cooking. But, if he hasn't cooked anything after this time, he'll restart the meal from scratch.")]
[Tunable]
private static float kTimeBeforeRestartCooking = 20f;
[TunableComment("How old leftovers can be out in minutes before the butler will put it away")]
[Tunable]
private static float kTimeWaitBeforePutawayLeftovers = 60f;
[TunableComment("Multiplier for interactions in a room where a sim is sleeping")]
[Tunable]
private static float kUseObjectInSameRoomAsSleeperMultiplier = 0.1f;
[TunableComment("If Butler's relationship with any YAE falls below this level, he will quit")]
[Tunable]
private static float kRelationshipLevelForQuit = -50f;
[TunableComment("Butler can start cooking this many hours before the target sim wakes up. This allows the butler to have food ready when the sleeping sim wakes up")]
[Tunable]
private static float kTimeCanStartCookBeforeSimWakes = 1.8f;
[Tunable]
[TunableComment("Chance you get the good advice moodlet when asking for advice from the butler")]
private static float kChanceGetGoodAdviceMoodlet = 25f;
[TunableComment("Length of time (in hours) that the butler waits before routing to lot")]
[Tunable]
private static float kDelayBeforeArriving = 0.5f;
private static Butler sButler = (Butler) null;

protected override Service.ServiceTuning Tuning
{
get
{
return Butler.kServiceTuning;
}
}

public static float MinHungerBeforeStartCooking
{
get
{
return Butler.kMinHungerBeforeStartCooking;
}
}

public static float TimeBetweenSuccessfulCookingSessions
{
get
{
return Butler.kTimeBetweenSuccessfulCookingSessions;
}
}

public static float TimeBeforeRestartCooking
{
get
{
return Butler.kTimeBeforeRestartCooking;
}
}

public static float TimeWaitBeforePutawayLeftovers
{
get
{
return Butler.kTimeWaitBeforePutawayLeftovers;
}
}

public static float UseObjectInSameRoomAsSleeperMultiplier
{
get
{
return Butler.kUseObjectInSameRoomAsSleeperMultiplier;
}
}

public static float RelationshipLevelForQuit
{
get
{
return Butler.kRelationshipLevelForQuit;
}
}

public static float TimeCanStartCookBeforeSimWakes
{
get
{
return Butler.kTimeCanStartCookBeforeSimWakes;
}
}

public static float ChanceGetGoodAdviceMoodlet
{
get
{
return Butler.kChanceGetGoodAdviceMoodlet;
}
}

public static float DelayBeforeArriving
{
get
{
return Butler.kDelayBeforeArriving;
}
}

public static Butler Instance
{
get
{
return Butler.sButler;
}
}

public override ServiceType ServiceType
{
get
{
return ServiceType.Butler;
}
}

public override List<CommodityKind> ServiceMotives
{
get
{
return new List<CommodityKind>((IEnumerable<CommodityKind>) new CommodityKind[5]
{
CommodityKind.LookAfterBabyOrToddler,
CommodityKind.LookAfterChild,
CommodityKind.BabysitterClean,
CommodityKind.BeMaid,
CommodityKind.BeButler
});
}
}

public override bool IsPaidWeekly
{
get
{
return true;
}
}

static Butler()
{
}

public Butler()
{
if (!GameUtils.IsInstalled(ProductVersion.EP3))
Butler.sButler = (Butler) null;
else
Butler.sButler = this;
}

private static string LocalizeString(string name, params object[] parameters)
{
return Localization.LocalizeString(Butler.sLocalizationKey + ":" + name, parameters);
}

public static void Create()
{
if (ServiceNPCSpecifications.ValidForCurrentWorld(ServiceType.Butler))
{
if (Butler.sButler == null)
{
Butler butler = new Butler();
}
else
Butler.sButler.PostLoadFixup();
}
else
Butler.DestroyButler();
}

public static void Destroy()
{
Butler.DestroyButler();
}

private static void DestroyButler()
{
Service.Destroy((Service) Butler.sButler);
Butler.sButler = (Butler) null;
}

public static void RemoveButlersFromLot(Lot lot)
{
Butler instance = Butler.Instance;
if (instance == null || !instance.IsServiceRequested(lot) && !instance.IsAnySimAssignedToLot(lot))
return;
foreach (Sim actor in instance.GetSimsAssignedToLot(lot))
{
ButlerSituation butlerSituation = ServiceSituation.FindServiceSituationInvolving(actor) as ButlerSituation;
if (butlerSituation != null)
butlerSituation.SetToLeave();
}
}

protected override bool NeedsAssignment(Lot lot)
{
if (this.IsServiceRequested(lot))
return !this.IsAnySimAssignedToLot(lot);
else
return false;
}

protected override ServiceSituation InternalCreateSituation(Lot assignedLot, Sim createdSim, int cost, ObjectGuid requestingSim)
{
if (assignedLot.MoveInScenario is Rodents)
{
ServiceSituation serviceSituation = assignedLot.MoveInScenario.SetupSituation((Service) this, createdSim);
assignedLot.MoveInScenario = (Scenario) null;
return serviceSituation;
}
else
{
createdSim.SimDescription.ShowSocialsOnSim = true;
createdSim.CanBeFired = true;
return (ServiceSituation) new ButlerSituation((Service) this, assignedLot, createdSim, cost);
}
}

public override void UpdateCreatedSim(Sim sim)
{
Skill skill1 = sim.SkillManager.AddElement(SkillNames.Handiness);
Skill skill2 = sim.SkillManager.AddElement(SkillNames.Cooking);
Skill skill3 = sim.SkillManager.AddElement(SkillNames.mixology);
int maxSkillLevel = skill1.MaxSkillLevel;
for (int index = 0; index < maxSkillLevel; ++index)
{
skill3.ForceGainPointsForLevelUp();
skill2.ForceGainPointsForLevelUp();
skill1.ForceGainPointsForLevelUp();
}
Book book = (Book) BookGeneralData.GetBookGeneralByTitle(Butler.kButlerBook);
Inventory inventory = sim.Inventory;
if (inventory == null)
return;
inventory.DestroyItems();
if (inventory.TryToAdd((IGameObject) book))
return;
book.Destroy();
}

protected override void SetServiceNPCProperties(SimDescription simDescription)
{
simDescription.CanBeKilledOnJob = true;
simDescription.Marryable = true;
simDescription.Contactable = true;
simDescription.ShowSocialsOnSim = true;
}

protected override void SetTraits(SimDescription simDescription)
{
TraitManager traitManager = simDescription.TraitManager;
traitManager.AddElement(TraitNames.Neat);
traitManager.AddElement(TraitNames.Brave);
traitManager.AddElement(TraitNames.FamilyOriented);
List<Trait> validTraits = AgingManager.GetValidTraits(simDescription, false, false, true);
for (int index = 0; index < 2; ++index)
{
if (validTraits.Count > 0)
{
Trait randomObjectFromList = RandomUtil.GetRandomObjectFromList<Trait>(validTraits);
traitManager.AddElement(randomObjectFromList.Guid);
validTraits.Remove(randomObjectFromList);
}
}
}

public override string GetServiceTopic(Sim serviceSim)
{
return "Butler Service";
}

public override bool CanRequestServiceFromPhone(Lot lot)
{
if (base.CanRequestServiceFromPhone(lot) && GameUtils.GetCurrentWorldType() != WorldType.Vacation)
return lot.CommercialLotSubType != CommercialLotSubType.kEP1_BaseCamp;
else
return false;
}

public static void AskToCook(Sim sim)
{
ButlerSituation butlerSituation = ServiceSituation.FindServiceSituationInvolving(sim) as ButlerSituation;
if (butlerSituation == null)
return;
butlerSituation.PrepareFood(false);
}
}
}
public class BartenderService : Service
{
[PersistableStatic(false)]
public static ulong sFirstBartender = 0UL;
[PersistableStatic(false)]
public static int sNumAdditionalBartendersRequested = 0;
[PersistableStatic(false)]
public static int sNumAdditionalBartenders = 0;
[Tunable]
[TunableComment("Min Bartending Skil")]
private static int kMinBartendingSkill = 5;
[TunableComment("Max Handiness Skil")]
[Tunable]
private static int kMaxBartendingSkill = 10;
[Tunable]

public static BartenderService Instance
{
get
{
return BartenderService.sBartenderService;
}
}

public override ServiceType ServiceType
{
get
{
return ServiceType.Bartender;
}
}

public override List<CommodityKind> ServiceMotives
{
get
{
return new List<CommodityKind>((IEnumerable<CommodityKind>) new CommodityKind[1]
{
CommodityKind.BeBartender
});
}
}

protected override Service.ServiceTuning Tuning
{
get
{
return BartenderService.kServiceTuning;
}
}

public static Service.ServiceTuning GetServiceTuning
{
get
{
return BartenderService.kServiceTuning;
}
}

static BartenderService()
{
}

public BartenderService()
{
if (!GameUtils.IsInstalled(ProductVersion.EP3))
BartenderService.sBartenderService = (BartenderService) null;
else
BartenderService.sBartenderService = this;
}

public static void Create()
{
if (ServiceNPCSpecifications.ValidForCurrentWorld(ServiceType.Bartender))
{
if (BartenderService.sBartenderService == null)
{
BartenderService bartenderService = new BartenderService();
}
else
BartenderService.sBartenderService.PostLoadFixup();
}
else
BartenderService.DestroyBartenderService();
}

public static void Destroy()
{
BartenderService.DestroyBartenderService();
}

private static void DestroyBartenderService()
{
Service.Destroy((Service) BartenderService.sBartenderService);
BartenderService.sBartenderService = (BartenderService) null;
}

protected override bool NeedsAssignment(Lot lot)
{
bool flag1 = this.IsServiceRequested(lot);
bool flag2 = this.IsAnySimAssignedToLot(lot);
if (flag1 && !flag2)
return true;
if (!flag1 && flag2)
return BartenderService.sNumAdditionalBartenders < BartenderService.sNumAdditionalBartendersRequested;
else
return false;
}

public override bool CanRequestServiceFromPhone(Lot lot)
{
if (!base.CanRequestServiceFromPhone(lot))
return false;
int num = 0;
foreach (Sim sim in lot.GetSims())
{
if (sim.Service is BartenderService)
++num;
}
return num < BartenderService.MaxNumBartendersPerLot;
}

protected override ServiceSituation InternalCreateSituation(Lot assignedLot, Sim createdSim, int cost, ObjectGuid requestingSim)
{
createdSim.CanBeFired = true;
return (ServiceSituation) new BartenderServiceSituation((Service) this, assignedLot, createdSim, cost);
}

public override void UpdateCreatedSim(Sim sim)
{
Skill skill = sim.SkillManager.AddElement(SkillNames.Bartending);
if (skill == null)
return;
int @int = RandomUtil.GetInt(BartenderService.kMinBartendingSkill, BartenderService.kMaxBartendingSkill);
skill.ForceSkillLevelUp(@int);
}

protected override void SetServiceNPCProperties(SimDescription simDescription)
{
simDescription.MotivesDontDecay = true;
simDescription.CanBeKilledOnJob = true;
simDescription.Marryable = true;
simDescription.CanStartFires = false;
simDescription.Contactable = true;
}

public override string GetServiceTopic(Sim serviceSim)
{
return "Bartender Service";
}
}
}

I have one error and it is on the last "}" of the script the error is "Error 1 Type or namespace definition, or end-of-file expected"
Inventor
#32 Old 1st Feb 2012 at 8:08 PM
Code:
Realistically Scripts are the strings of commands that make up XML coding.


No, the Script are the DLL files. These XML are only the Tunnings.

ex:
SCRIPT from DLLs files => Make Drinks Interaction
XML (ITUN) => Defines who can use the "Make Drinks Interaction".

If you use the XML, the only thing you can do is Enable or Disable the "access" to use the specif Interaction. These XML will define, for example, that Butler will be allowed to Cook, but will be denied to Dance on the Stereo.

Take a look at:

Sims3.Gameplay.Objects.Beds.BedMakeBed

<Change type="TraitNeat" advertised="200" locked="True" actual="200" updateType="ImmediateDelta" timeDependsOn="False" updateEvenOnFailure="True" updateAboveAndBelowZero="Either" />
<Change type="TraitPerfectionist" advertised="200" locked="True" actual="200" updateType="ImmediateDelta" timeDependsOn="False" updateEvenOnFailure="True" updateAboveAndBelowZero="Either" />
<Change type="BeMaid" advertised="200" locked="True" actual="200" updateType="ContinuousFlow" timeDependsOn="False" updateEvenOnFailure="False" updateAboveAndBelowZero="Either" />

you will see who can perform this task: Maids, TraitNeat, TraitPerfectionist

So (again), you can't add new conditions or tasks using the XML.
Inventor
#33 Old 1st Feb 2012 at 8:24 PM
Quote: Originally posted by Jbob
public override List<CommodityKind> ServiceMotives
{
get
{
return new List<CommodityKind>((IEnumerable<CommodityKind>) new CommodityKind[5]
{
CommodityKind.LookAfterBabyOrToddler,
CommodityKind.LookAfterChild,
CommodityKind.BabysitterClean,
CommodityKind.BeMaid,
CommodityKind.BeButler
});
}
}


if you want the butler perform like a bartender, add the "CommodityKind.BeBartender".

Code:
What about adding the "mixology skill to the butler on top of cooking and handiness?


good

Code:
or all of them need to be incorporated into the new mod?


no, you can handle just with the "CommodityKind.BeButler".

Code:
I have one error and it is on the last "}" of the script the error is "Error 1 Type
 or namespace definition, or end-of-file expected"


you forgot some "}" in your code.
Lab Assistant
Original Poster
#34 Old 1st Feb 2012 at 9:58 PM
How do I determine where I forgot some "} or {" in my code?

So by adding the CommodityKind.BeBartender we can bring all the qualities of the bartender to the butler?
Field Researcher
#35 Old 2nd Feb 2012 at 4:13 AM
You should look at a tutorial for basic syntax on c#. Basically, anything that opens with a "(" or " " " or "{" must end with that symbol but the opposite. That is of course I'm over siimplifing it a ton.
Lab Assistant
Original Poster
#36 Old 2nd Feb 2012 at 5:02 AM
Quote: Originally posted by Odistant
You should look at a tutorial for basic syntax on c#. Basically, anything that opens with a "(" or " " " or "{" must end with that symbol but the opposite. That is of course I'm over siimplifing it a ton.


Thanks I do know that I just cant see where I may have missed it.
Field Researcher
#37 Old 2nd Feb 2012 at 11:45 AM
Well usually VS will tell you what line its missing at. Just try ending one closing bracket at the end of your code.

Also in your if statements you should use the brackets to make it easier to read, unless your only returning something then its fine.
Lab Assistant
Original Poster
#38 Old 3rd Feb 2012 at 12:35 AM Last edited by Jbob : 3rd Feb 2012 at 1:17 AM.
The Full script so far is listed in post #31. It only looks all aligned left because of the formatting here. If I delete the Bracket that the error was shown then I go from just the one error regarding the bracket to 5 errors of "Error 3 The type or namespace name 'Service' could not be found (are you missing a using directive or an assembly reference?) Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs"

and the warnings

"Warning The type 'Sims3.Gameplay.Services.Butler' in 'Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs' conflicts with the imported type 'Sims3.Gameplay.Services.Butler' in 'e:\Documents and Settings\Sims 3 Modding\Sims3GameplaySystems.dll'. Using the type defined in 'Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs'. Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs 50 20 Jbob_Intelligent Butler"

"Warning The type 'Sims3.Gameplay.Services.Bartender' in 'Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs' conflicts with the imported type 'Sims3.Gameplay.Services.Bartender' in 'Documents and Settings\Sims 3 Modding\Sims3GameplaySystems.dll'. Using the type defined in 'Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs'. Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs 111 24 Jbob_Intelligent Butler
Inventor
#39 Old 3rd Feb 2012 at 1:59 AM
Quote: Originally posted by Jbob
The type or namespace name 'Service' could not be found (are you missing a using directive or an assembly reference?)


you need to add your custom namespace.

example: namespace JbobNameSpace



add this: "using Sims3.Gameplay.Services;" on the top of your code.


Code:
"Warning The type 'Sims3.Gameplay.Services.Butler' in 'Documents 
and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs' 
conflicts with the imported type 'Sims3.Gameplay.Services.Butler' in
 'e:\Documents and Settings\Sims 3 Modding\Sims3GameplaySystems.dll'.


that means you need to rename your class Butler to something new, to avoid conflict with sims 3 script.

example: rename Butler to MyButler (don't use Find and Replace) and replace the Butler references to MyButler.
Field Researcher
#40 Old 3rd Feb 2012 at 2:27 AM
Also if you hover over that missing assembly error it will give you a suggestion on what you could be missing for your using statements.
Lab Assistant
Original Poster
#41 Old 3rd Feb 2012 at 5:44 AM Last edited by Jbob : 3rd Feb 2012 at 6:02 AM.
Do I need to rename every instance of Butler and Bartender to "Myunique name butler bartender"? Or do I just need to rename "public class Butler : Service, IAmCleaningService & public class BartenderService : Service" to a unique name?

namespace Sims3.Gameplay.Services to: namespace JbobIntelligentButler
{
public class Butler : Service, IAmCleaningService to public class JbobIntelligentButler : Service, IAmCleaningService

Error 15 Invalid rank specifier: expected ',' or ']' Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs 160 9 Jbob_Intelligent Butler with this error it is an exact copy of the code found using dotpeek(reflector) This is on a script where I have not cut out the reference to shift time and wait time etc etc. So I do not understand where the error can be. Unless the error is there and it still runs the script ok. But I get a failed build notice at the bottom of VS.

one of the Invalid rank specifiers is here: (under the r in return)
public override List<CommodityKind> ServiceMotives
{
get
{
return new List<CommodityKind>((IEnumerable<CommodityKind>) new CommodityKind[5]
{ <--
CommodityKind.LookAfterBabyOrToddler,
CommodityKind.LookAfterChild,
CommodityKind.BabysitterClean,
CommodityKind.BeMaid,
CommodityKind.BeButler,
CommodityKind.BeBartender
});
}
}

public override bool IsPaidWeekly

The other is here:

return ServiceType.Bartender;
}
}

public override List<CommodityKind> ServiceMotives
{
get
{
return new List<CommodityKind>((IEnumerable<CommodityKind>)new CommodityKind[1]
{ <---
CommodityKind.BeBartender,
CommodityKind.BeButler
});
}
}

public static int MaxNumBartendersPerLot
{
get
{
return BartenderService.kMaxNumBartendersPerLot;
}
}

Remember everything is aligning left here on the webpage and not in the actual code.
Lab Assistant
Original Poster
#42 Old 3rd Feb 2012 at 6:04 AM
Quote: Originally posted by Odistant
Also if you hover over that missing assembly error it will give you a suggestion on what you could be missing for your using statements.


hovering over the error in the error box only lists the same error and hovering over the area of the error in the code does nothing. Maybe I a missing something MY VS2008 seems different than that shown on the tutorial. I have to save my project first before I can even change the framework to 2.0 rather than having a box to do so in the upper right as shown on tutorial.
Inventor
#43 Old 3rd Feb 2012 at 10:28 AM
Quote: Originally posted by Jbob
Do I need to rename every instance of Butler and Bartender to "Myunique name butler bartender"?


all of then.


Quote: Originally posted by Jbob
namespace Sims3.Gameplay.Services to: namespace JbobIntelligentButler


will not interfere, but it's recommended.



Code:
        return new List<CommodityKind>((IEnumerable<CommodityKind>) new CommodityKind[5]


you need to update the Array size. change the CommodityKind[5] to CommodityKind[6].
Lab Assistant
Original Poster
#44 Old 3rd Feb 2012 at 7:53 PM
Do I need to do the same thing for all instances of Bartender as well?

Code:
 return new List<CommodityKind>((IEnumerable<CommodityKind>) new CommodityKind[5]
This needs to be for the Butler Commodity kind, but what about for the instances under "bartender"

Under butler for commodityKind I have beBartender and then on the commodityKind ofr bartender I have "beButler"
Lab Assistant
Original Poster
#45 Old 3rd Feb 2012 at 8:01 PM Last edited by Jbob : 3rd Feb 2012 at 8:41 PM. Reason: Most of the errors resolved no I am down to 2 errors
I know it is Key and recommended to change the namespace to avoid conflicts but in changing the instances of butler and bartender I also have to keep a reference to what the service is ie. Butler and Bartender don't I?

namespace Sims3.Gameplay.Services
{
public class Butler : Service, IAmCleaningService
{

and

}
public class BartenderService : Service
{

I should change these to:

namespace Sims3.Gameplay.Services to: namespace JbobIntelligentButler
{
public class JbobIntelligentButler : Service, IAmCleaningService to public class JbobIntelligentButler : Service, IAmCleaningService
{

and

}
public class JbobIntelligentButlerBartenderService : Service

My 50 warnings went away after only changing the first four instances of JbobIntelligetnButler and JbobIntelligentButlerBartendingService.

Now I am left with the error:
Error 1 The type or namespace name 'JbobIntelligentButler' could not be found (are you missing a using directive or an assembly reference?) Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs 58 24 Jbob_Intelligent Butler (2 errors here)

Error 3 The type or namespace name 'JbobIntelligentButlerBartenderService' could not be found (are you missing a using directive or an assembly reference?) Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs 367 24 Jbob_Intelligent Butler (2 errors here)

Code where this error occurs:
[Tunable]
private static float kDelayBeforeArriving = 0.5f;
private static JbobIntelligentButler sButler = (JbobIntelligentButler)null; (change sButler to "JbobIntelligentButler"?

protected override Service.ServiceTuning Tuning
{

This is the code where this error occurs:
private static JbobIntelligentButlerBartenderService sBartenderService; (do I need to make this (sJbobintelligentButlerBartenderService)

public static JbobIntelligentButlerBartenderService Instance
{

In this case My errors and warnings greatly decreased after only a few changes would it be a best practice to make changes to all instances of "butler" & "Bartender" to my unique names or just make the changes until the errors and warnings go away?

Error 1 'JbobIntelligentButler' is a 'namespace' but is used like a 'type' Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs 58 24 Jbob_Intelligent Butler


Two most recent errors:
Error 1 Method must have a return type Documents and Settings\Jbob_Intelligent Butler\Jbob_Intelligent Butler\Class1.cs 180 16 Jbob_Intelligent Butler


}

static Butler()<----
{
}

public Butler()<----
{
if (!GameUtils.IsInstalled(ProductVersion.EP3))
Butler.sButler = (Butler)null;
else
Butler.sButler = this;
}
Lab Assistant
Original Poster
#46 Old 3rd Feb 2012 at 8:47 PM
IF we want the butler to handle cooking better for say parties and what not wouldn't we want something that addresses group meals or something more like what happens in the restaurants when we go in them? I cannot recall if this is Sims2 or Sims3 game style but do we not get an opportunity to go into an establishment and order a meal?
Inventor
#47 Old 3rd Feb 2012 at 8:55 PM
tip:

Get the Pizza Delivery Service and try to understand how it works, and make some small changes to understand how things are done. It will be very useful for you, before continuing your project.
Lab Assistant
Original Poster
#48 Old 3rd Feb 2012 at 9:43 PM
The key to this service would be found here:??

protected override bool NeedsAssignment(Lot lot)
{
if (this.IsServiceRequested(lot))
return !this.IsAnySimAssignedToLot(lot);
else
return false;
}

protected override ServiceSituation InternalCreateSituation(Lot assignedLot, Sim createdSim, int cost, ObjectGuid requestingSim)
{
return (ServiceSituation) new PizzaDeliverySituation((Service) this, assignedLot, createdSim, cost);
}

Isn't this basically setting up the situation that the service is requested on the lot and assigning the object, the requesting sim and the cost? However wouldn't it be better to look at pizzaDeliverySituation?

That is a question I was holdiong off to ask in the case of the butler and bartender should I also include the "butlersituation and bartendersituation" assemblies into the creation of the intelligent butler package?
Inventor
#49 Old 3rd Feb 2012 at 10:15 PM
Code:
The key to this service would be found here:??


yes. when return true, the system will send you an NPC.

Code:
Isn't this basically setting up the situation that the service is requested 
on the lot and assigning the object, the requesting sim and the cost? However 
wouldn't it be better to look at pizzaDeliverySituation?


yes! exactly! now, you are progressing really fast!

Code:
That is a question I was holdiong off to ask in the case of the butler and
 bartender should I also include the "butlersituation and bartendersituation"
 assemblies into the creation of the intelligent butler package?


yes, you need to add the service situation too. but leave the smart butler alone, keep the pizza delivery first.

Why don't you try to change which object the npc delivery? after delivery, try to make your npc perform some interactions, maybe route to a random object.
Lab Assistant
Original Poster
#50 Old 3rd Feb 2012 at 10:43 PM
If I make a change in PizzaDelivery Service Do I also need to make the same change in PizzaDeliverySituation?

I don't see a place to change the routing in PizzaDelivery however I can change the routing here in PizzaDeliverySituation:

protected override bool Run()
{
Door door = (Door) null;
Sim sim = this.Actor;
if (!this.Target.RouteToFrontDoorOrMailboxOrBackDoorOrPool(this.Actor, Sim.MinDistanceFromDoorWhenVisiting, Sim.MaxDistanceFromDoorWhenVisiting, ref door, true, true, (Dictionary<Sims3.SimIFace.Route.RouteOption, bool>) null, Service.kMaxDistanceToRouteFromServiceCarToLotWithoutTeleporting))
return false;
if (door != null)
door.RingBell();
Sim simForPizza = this.FindSimForPizza(sim);
if (simForPizza != null)
{

I have no idea if I can make a reference to the BackDoor or Pool
Page 2 of 3
Back to top