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!
just a girl
Original Poster
#1 Old 24th Mar 2017 at 4:51 PM Last edited by Lamare : 8th Jun 2017 at 4:59 PM.
Default How to properly "Set to next" [2]
Hi,

Could someone, please, point out what is wrong with this BHAV?

What it should do is find any trashcan, create weeds (param=0) or roaches (param=1) and attempt to place them near the trashcan. If it fails to find location, it should purge the roaches/weeds, return a message and try to find another trashcan to go around. If no trashcans were found - quit. Well, it doesn't.

I suspect, the problem has something to do with changing Stack object ID in the middle of the loop (by putting created roaches/weeds there), but I change it back again. To get it back on track of looking for next trashcan, I change Stack object back to previous trashcan's ID (saved in Local 0). When it didn't work, I tried altering the value of Stack object ID so it doesn't choose the same trashcan next time around (thought it was the problem). Don't know, what to try next.

0: [prim 0x0002] Expression (Stack Object's 0x000B (object id) := Literal 0x0000) [1][error]
1: [prim 0x0002] Expression (Local 0x0000 := Literal 0x0000) [2][error]
2: [prim 0x0002] Expression (Temp 0x0000 := Const 0x0106:0x46 ("Trash System" Value: 0x0046)) [3][error]
3: [prim 0x001F] Set to Next (Stack Object, obj with category == temp 0, disabled objects included: False) [4][false]
4: [prim 0x0002] Expression (Local 0x0000 := Stack Object's 0x000B (object id)) [5][error]
5: [prim 0x0002] Expression (Param 0x0000 (0-weeds, 1-roaches) == Literal 0x0000) [7][6]
6: [prim 0x0002] Expression (Param 0x0000 (0-weeds, 1-roaches) == Literal 0x0001) [8][false]
7: [prim 0x002A] Create New Object Instance (GUID 0x8C54C988, place: out of world (put new object id in Stack Object), Create object normally, fail if tile is non-empty: False, pass Temp 0 to main: False, move in a new Sim: False, copying design mode materials from object in Temp 5: False) [9][error]
8: [prim 0x002A] Create New Object Instance (GUID 0x4C2946DE, place: out of world (put new object id in Stack Object), Create object normally, fail if tile is non-empty: False, pass Temp 0 to main: False, move in a new Sim: False, copying design mode materials from object in Temp 5: False) [9][error]
9: [prim 0x0010] Find Location For (Stack Object ID 0x0000, relative to Local 0x0000, facing, normal, prefer empty: True, user editable: False, on level ground: False, with empty border: False, begin in front of refobj: False, with line of sight to center: False) [true][10]
10: [prim 0x0012] Remove Object Instance (Stack Object, return immediately: False, cleanup all: True) [11][11]
11: [prim 0x0024] Dialog (Text Notification, Strings: Private, Message: "Failed to find location. No good object from category. Continue loop.", TNS Style: System, Priority: 0x01, timeout: 0x00, TNS ID: Temp 0x0000, icon: automatic, wait for user: True, block simulation: True. (Text notification on side of screen - returns unique ID in specified temp. For birthdays, days-Till-Birthday is expected in temp1)) [12][12]
12: [global 0x0118] Idle (1 arg: ticks=0x0001) [13][13]
13: [prim 0x0002] Expression (Local 0x0000 += Literal 0x0001) [14][error]
14: [prim 0x0002] Expression (Stack Object's 0x000B (object id) := Local 0x0000) [2][error]


Also tried:
0-12 - as previous
13: [prim 0x0002] Expression (Stack Object's 0x000B (object id) := Local 0x0000) [14][error]
14: [prim 0x001F] Set to Next (Stack Object, obj with category == temp 0, disabled objects included: False) [3][error]


Pictures in spoiler for convenience.



I'm not sure it's the loop, because in game I get no message I've set up, and there's no way for it to get bypassed if bhav procedes to the loop. On the other hand, if I take "Idle" out of the equation - the game hangs completely. So it must be the loop...?

In testing I purpously put a couple of trashcans on the roof with no emply tiles near them and another couple on the ground with a lot of space around. What I get is slowed down game and no roaches or weeds. If I don't put trashcans on the roof, game is perfectly capable to spawn weeds/roaches. So it seems like after finding first trashcan on the roof and failig to put roaches/weeds near it the game neither can find another trashcan nor quit looking, thus - stuck.

To put it shortly, how do I make the bhav continue looking for ANOTHER trashcan?

Thanks in advance to anyone who has any idea!

By the way, I know I can look for outdoor trashcan or maibox by guid, but I really wanna make it more random than that. If I'll figure out how to make this loop work, I would use it for all sorts of things, not only weeds and roaches
Advertisement
just a girl
Original Poster
#2 Old 25th Mar 2017 at 6:59 AM
Got it working.
Long story short - do not mix up "Stack Object ID 0x0000" with "Stack Object's 0x000B (object id)". They might appear to look the same in vizual editor where all the blocks and lines are, so it's easy to overlook the difference (I have a feeling that sometimes they are interchangeable, but this was not the case).
just a girl
Original Poster
#3 Old 7th Jun 2017 at 6:38 PM Last edited by Lamare : 12th Jun 2017 at 11:22 AM. Reason: solution
Default "Set to next" doesn't recognise objects for sale
"Set to next" hates me

New challenge is to make it find objects that are marked for sale.

I need to modify some objects on a lot, so I find them with "Set to next" and do my stuff, e.g. I find all arcade games and turn off their lights. All works fine, unless an object is marked for sale with that yellow thing. Set to next primitive *ignores* them altogether - it does not return true (I've set up a debug message to make sure).

I've tried to change node version, include disabled objects, assigning value to "Stack Object ID 0" insdead of ticking "Stack Object" checkbox in wizard. No luck.



Is it impossible or am I missing something? How do I find an object and stick it in Stack Object, if not with "Set to next"?

***

ETA.
Once again figured it out talking to myself here

If anyone has the same issue with Set to next ignoring objects marked for sale, look at operand 8. If it's set to 04 or 05 it does find those objects as well as normal ones. The problem is instruction wizard wouldn't do it for you. (!!!)

Examples of working code:

[prim 0x001F] Set to Next (Stack Object, obj with category == temp 0)
00 00 00 00 0C 00 00 00 05 00 00 00 00 00 00 00

[prim 0x001F] Set to Next (Stack Object ID 0x0000, object of type: GUID 0x0EAB55E0 ("Arcade - Game1"))
E0 55 AB 0E 84 0A 00 00 05 00 00 00 00 00 00 00

Difference between 4 and 5 for op8 is *appears to be* whether disabled objects are included or not, but I don't know for sure. For purpouse of my mod I put 5 to include them just in case. What I do know for sure is 0 or 1 don't work (concerning objects for sale).
Difference between ticking Stack Object check box in wizard and picking Stack Object ID 0x0000 - is not noticed. Either way works (so far).
Also, node version doesn't need to be higher than 0. 0 works fine (so far).

***

ETA 2.
If it fails to go through objects placed on displays, try node version 1.
Back to top