Getting a Sim's current salary
#1 02-02-2017 
  • Registered
  • 3
  • 9
Waves. Hi all, been directed here by gummilutt - apparently you don't bite Smile

I'm trying to get the current salary for a Sim. I feel I am so close. I have their career object, I have their job level, I have found the following operand for the expression prim

Code:
Job Data [temp 0,1] salary

but I cannot figure or find out what temp0 and temp1 should be set to. I've guessed at career object id and job level (both ways round), but that only gave me an error (which I have foolishly deleted, hang on a sec while I rerun the game to get it back ... tum tee tum ...)

Code:
Error: Job data not found.
Iterations: 0
  Frame 3:
    Stack Object id: 69
    Stack Object name: JobData - Adult - Law Enforcement
    Node: 10
    Tree: id 4358 name 'Sub - Get Salary of P0 in T0 - TODO' version -32759
    from SIMPE_TICKETPAD_CRES
    Prim state: 0
    Params: 227    Locals: 227 184 3 0 0

Any pointers gratefully received

William

0
#2 02-02-2017 
I'm guessing that temp0 and temp1 should be set to the Job's GUID, first four digits in temp0, last four in temp1. This, however, leaves us with the question where to define the Job Level that you wish to see the salary of.

But it might even be that the Job Data code does not even work. There are a number of primitives and expressions that don't do anything, and this might be one of them. So maybe you should use a completely different method of accessing the required information.

0
#3 02-02-2017 
  • Registered
  • 3
  • 9
Thought about that ... except there are 10 salaries for any particular (adult) career, so which one of the 10 would that get?

EDIT: Or could it be returning an array of salaries (not ventured into array land yet!)

EDIT2: Tried both T0=GUID1, T1=GUID2 and T0=GUID2, T1=GUID1 and the same "Job data not found" error in both cases
Seriously considering adding a BHAV to the JobDataGlobals and calling it by name!
(This post was last modified: 02-02-2017 11:47 PM by whoward69.)

0
#4 03-02-2017 
  • Registered
  • 3
  • 9
(02-02-2017 11:32 PM)whoward69 Wrote:  Seriously considering adding a BHAV to the JobDataGlobals and calling it by name!
Could I have my data please Sad

New JobDataGlobal BHAV, passed job level in Param0, stuffs the salary data into Temp0

RTBN for that BHAV, sets up the param and displays the value of Temp0 after the call

Output from testing

[Image: DebugNewJobDataGlobal.jpg]

Bottom notification from the new JobDataGlobal clearly shows the correct salary (Law Enf Level 3 is $552)
Middle notification shows that the value of Temp0 received after the RTBN for that BHAV is zero.

Who stole my data? Huh

Other CT BHAVs in JobDataGlobals seem to return values in T0, so I'm missing something about temps (again!)

Is this some subtle difference between "run in SO stack", "run in My stack" and "push onto My stack"? I suspect so.

But it's way past my bedtime here, so it's tomorrow's problem!

W

0
#5 03-02-2017 
(02-02-2017 11:32 PM)whoward69 Wrote:  Thought about that ... except there are 10 salaries for any particular (adult) career, so which one of the 10 would that get?

EDIT: Or could it be returning an array of salaries (not ventured into array land yet!)

EDIT2: Tried both T0=GUID1, T1=GUID2 and T0=GUID2, T1=GUID1 and the same "Job data not found" error in both cases
Seriously considering adding a BHAV to the JobDataGlobals and calling it by name!

As I mentioned "leaves us with the question where to define the Job Level that you wish to see the salary of", which to the cautious reader *should* mean that I don't know how to select that level. I also included a mention that it might not even work at all.

As to your last post... I don't know where your data went on the "DEBUG - Display" line. You would need to show us the code for that specific BHAV for anyone to be able to figure that out. I'm gonna have a look at JobDataGlobals now. I'm virtually sure that they already have some very simple method available for you to access the salary.

0
#6 03-02-2017 
  • Registered
  • 3
  • 9
The RTBN at line 0x07 in the BHAV given in the second spoiler above should have been "run in My Stack" and not "run in Stack Object's stack"

[Image: RTBNMyStack2.jpg]

1
#7 03-02-2017 
I think you got it down. I would never have figured that part out, I suppose.

1
#8 08-02-2017 
Good going! That sort of stuff that is hard to catch is my pitfall.

0
#9 11-02-2017 
  • Registered
  • 3
  • 9
For info, see also this mod on MTS that also has to add semi-globals to the JobDataGlobals to get pertinent career data

1


Sorry, that is a members only option