Steam code question

DingDong

Master
Need help to understand the uosteam "pushlist"

how does it work?

Have startup code here, all I want it to do is to check what instrument I have in my pack and use it. I know there are other ways around this but atm i want to know how "pushlist" works.

if not listexists 'instruments'
createlist 'instruments'
pushlist 'instruments' 0xe9d //Tamburine
pushlist 'instruments' 0xeb2 //Harp
pushlist 'instruments' 0xe9c //Drum
endif
for 0 to 'instruments'
if @findtype 'instruments[]' 'any' 'backpack'
useobject 'found'
pause 3500
endif
endfor

With luck it finds the tamburine and plays it, but no other instrumens if i drop the tamb on the floor, what am I doing wrong?

Thanks
 

halygon

Grandmaster
Like experience said, put the pushlists outside of the endif and preface it with a clearlist.

Next after the findtype, set an alias equal to found and then use that alias instead of found like:
Setalias "foundinstrument" "found"

Then put the

useobject "foundinstrument"

outside of the for statement.

The last instrument found on the pushlist will be on that alias.

Let us know if that works.
 

DingDong

Master
Thanks alot Experience and halygon...Worked like a charm to take the "pushlist" outside the "if and endif" and also the "setalias" worked superb. Finally I got a hang of the list code, then I wonder, if I clearlist 'instruments' will it just delete the instruments in the current list and next time start the macro it will add in the new instruments in my pack?
 

halygon

Grandmaster
Thanks alot Experience and halygon...Worked like a charm to take the "pushlist" outside the "if and endif" and also the "setalias" worked superb. Finally I got a hang of the list code, then I wonder, if I clearlist 'instruments' will it just delete the instruments in the current list and next time start the macro it will add in the new instruments in my pack?
I always put a clearlist because it allows you to add items to the pushlist on the fly as it re-creates the list every time you play the macro.
 
Top