[EOS] how to better random choice to use less resource?

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
Epton
Explorer At Heart
Explorer At Heart
Posts: 111
Joined: Sun Mar 05, 2017 9:56 am

[EOS] how to better random choice to use less resource?

Post by Epton »

I use a function for random number. but I would like to have more control over it.
Image
https://ibb.co/3BBpxwG

I wonder if there is a better less resource way of doing it.

But I was thinking of doing it as follows:
I will create a new variable and function for each options. up1, up2, up3 etc...
Then I'd count them up to 2 with teaseStorage.
Then I plan to use IF to filter through these that had reached 2 and ignore them and choose different option with a function while resetting the count.

Something like:
Image
https://ibb.co/K0TKG4y
Note that in this example I ignore up1=0.9 bpm
yes I have not implemented the count and teaseStorage in this example

Any suggestions or should I do it this way?
verynicekojak
Explorer
Explorer
Posts: 88
Joined: Fri Aug 19, 2022 10:05 pm

Re: [EOS] how to better random choice to use less resource?

Post by verynicekojak »

Which resource usage you want to limit? If you are loading sounds in all the IFs and you worry about network bandwidth, then you must load those in different pages. One page with one mp3. You jump to this page, it will load m3p, then you go back. Obviously you need to prevent infinite jumping loop. Something like that:

Script here:

Code: Select all

if( soundLoaded == false )
{
 up = UPDice();
 callingPageId = pages.getCurrentPageId();
 pages.goto( "soundPage" + up );
}
Script on soundPageN after loading sound:

Code: Select all

soundLoaded = true;
pages.goto( callingPageId );
Epton
Explorer At Heart
Explorer At Heart
Posts: 111
Joined: Sun Mar 05, 2017 9:56 am

Re: [EOS] how to better random choice to use less resource?

Post by Epton »

verynicekojak wrote: Fri Mar 03, 2023 12:06 am Which resource usage you want to limit? If you are loading sounds in all the IFs and you worry about network bandwidth, then you must load those in different pages. One page with one mp3. You jump to this page, it will load m3p, then you go back. Obviously you need to prevent infinite jumping loop. Something like that:

Script here:

Code: Select all

if( soundLoaded == false )
{
 up = UPDice();
 callingPageId = pages.getCurrentPageId();
 pages.goto( "soundPage" + up );
}
Script on soundPageN after loading sound:

Code: Select all

soundLoaded = true;
pages.goto( callingPageId );
I've noticed when there are lots of IFs and/or choice in one page it can take a couple min to load if your bandwidth is not great or quite slow of a computer. these IFs do not load sound only change the variable that was loaded.
for example the loaded bpm is 50 and choice 1 was picked it will do 50 * 0.9 = 45 and save it. after that I load sounds on a different page. but I want to prevent it from choosing 1\7\1\7\2\8\8\2\1 so I was wondering if there is a better way of doing it rather than making lots of IFs.

And thank you for the advice it will most helpful in future teases.
Thamrill
Explorer At Heart
Explorer At Heart
Posts: 266
Joined: Thu Jan 03, 2013 4:55 pm
Gender: Male
Sexual Orientation: Straight
I am a: Submissive

Re: [EOS] how to better random choice to use less resource?

Post by Thamrill »

Epton wrote: Fri Mar 03, 2023 10:59 am
verynicekojak wrote: Fri Mar 03, 2023 12:06 am Which resource usage you want to limit? If you are loading sounds in all the IFs and you worry about network bandwidth, then you must load those in different pages. One page with one mp3. You jump to this page, it will load m3p, then you go back. Obviously you need to prevent infinite jumping loop. Something like that:

Script here:

Code: Select all

if( soundLoaded == false )
{
 up = UPDice();
 callingPageId = pages.getCurrentPageId();
 pages.goto( "soundPage" + up );
}
Script on soundPageN after loading sound:

Code: Select all

soundLoaded = true;
pages.goto( callingPageId );
I've noticed when there are lots of IFs and/or choice in one page it can take a couple min to load if your bandwidth is not great or quite slow of a computer. these IFs do not load sound only change the variable that was loaded.
for example the loaded bpm is 50 and choice 1 was picked it will do 50 * 0.9 = 45 and save it. after that I load sounds on a different page. but I want to prevent it from choosing 1\7\1\7\2\8\8\2\1 so I was wondering if there is a better way of doing it rather than making lots of IFs.

And thank you for the advice it will most helpful in future teases.
Are you putting only evals in the ifs? If so, you should make everything in a single eval.

Like, you can put an if block inside the eval:

if(up1==2){
up1=UPDice1();
}else if(up1==3){
up1=UPDice2();
}
etc...

It's not really clear to me what you're trying to achieve, hence the help I can provide is limited
Image

Image

Image
verynicekojak
Explorer
Explorer
Posts: 88
Joined: Fri Aug 19, 2022 10:05 pm

Re: [EOS] how to better random choice to use less resource?

Post by verynicekojak »

Epton wrote: Fri Mar 03, 2023 10:59 am I've noticed when there are lots of IFs and/or choice in one page it can take a couple min to load if your bandwidth is not great or quite slow of a computer. these IFs do not load sound only change the variable that was loaded.
for example the loaded bpm is 50 and choice 1 was picked it will do 50 * 0.9 = 45 and save it. after that I load sounds on a different page. but I want to prevent it from choosing 1\7\1\7\2\8\8\2\1 so I was wondering if there is a better way of doing it rather than making lots of IFs.

And thank you for the advice it will most helpful in future teases.
If you don't load sounds in the IFs, then I don't think that IFs are the problem. Mathematical operations should be really fast and should not be impacted by bandwidth or even slow computer. Maybe the different page with the sounds is a problem? If you have all of them on one page, they are all loaded on page enter. Even if you have saved only one number, all sounds from the page are loaded even if you don't play them.
Post Reply

Who is online

Users browsing this forum: No registered users and 77 guests