covra
June 11, 2024, 9:02am
1
I would like to control Resource bar with js, but I am not able to find docs about it…
I tried:
const bar = runtimeScene.getObjects("bar_recycle")[0];
bar.getValue() -> error
bar.getProgress() -> error
bar.setValue(10) -> error
barra.setProgress(14) -> error
bar.value -> nothing
bar.Value(10) -> nothing
bar.Value() -> returns bar value
…
Try bar.SetValue(10)
Capital S and Capital V
These seem to be the methods
onCreated,onHotReloading,doStepPostEvents,UpdateLayout,Value,SetValue,MaxValue,SetMaxValue,IsEmpty,IsFull,PreviousValueDuration,SetPreviousValueDuration,IsChanging,WidthForValue,FullBarWidth,IsLabelShown,SetLabelShown,UpdateLabel,doStepPreEvents
I used this to get the methods courtesy chatGPT
const myObjectPrototype = runtimeScene.getObjects("MyObject")[0].constructor.prototype;
const methods = Object.getOwnPropertyNames(myObjectPrototype).filter(prop => {
return typeof myObjectPrototype[prop] === 'function';
});
console.log("Methods of 'MyObject':\n" + methods.join("\n"));
1 Like
covra
June 12, 2024, 7:17am
3
Works! thxs! that piece of code will be my salvation xDDD
1 Like