Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / code help - Select a random number, exclude last selected.

Author
Message
greenlig
22
Years of Service
User Offline
Joined: 30th Aug 2003
Location: Melbourne
Posted: 1st Feb 2011 02:52
Hi guys,

I have a simple coding request. I have an array with three entries, each holding a colour (red, green, blue). Every 30 frames, I select a different colour at random like so:



What I need is for it to select a random colour next, but exclude the last colour selected. Basically, if it selects red, the next colour can only be either blue or green.

I am not entirely sure how to go about this. I'm sure I could come up with a convoluted method, but I don't know where to start.

I've searched around the forums, and can't find any random number generators that exclude the last selected.

I would greatly appreciate a few tips!

Regards,
Greenlig

Your signature has been erased by a mod as it is far too big.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 1st Feb 2011 02:58 Edited at: 1st Feb 2011 02:58
arrrghh american/other spellings of color/colour drive me nuts! I'll just stick with "colour" as much as it pains me xD


^^^that's what I'd do. "mod" is the modulo command. Basically... yknow the remainder? So 1/3=0 remainder 1, and 7/2=3 remainder 1? Modulo returns the remainder, and so modulo is used for "wrapvalue"-like commands, because (1 mod 3)=(4 mod 3)=(7 mod 3)=(10 mod 3) etc.

Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 1st Feb 2011 02:58
When you get the random, compare it with the last.. If it's the same, keep searching, if not.. continue on



greenlig
22
Years of Service
User Offline
Joined: 30th Aug 2003
Location: Melbourne
Posted: 1st Feb 2011 04:56
Kevin and Neuro - Thank you both for the really fast replies. I've implemented a solution based off your code. Credits will be applied.

@ Neuro - I have always had a hard time understanding modulo, and I'm not sure I do yet. I was following your explanation up until the (1 mod 3)=(4 mod 3) etc... section, which blew my mind. It takes a bit for me to grasp concepts.

Again, thank you both!

Regards,
Greenlig

Your signature has been erased by a mod as it is far too big.
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 1st Feb 2011 16:04 Edited at: 1st Feb 2011 16:06
Neuro Fuzzy - Your suggestion will make the item above the last picked one twice as likely as any of the others

Kevin Picone - This is potentially very slow

The correct solution is to pick from a range one less than the total, and if the picked value is at or above the previous value, add one, i.e.



Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 1st Feb 2011 17:02
erm.. so you're worried about the potential impact of a second rnd() every 30 odd frames ?

As for a correct, there's any number of solutions but why bother ?

ie.

Current_Colour=mod(current_colour+rndrange(1,2),3)

Which gives a uniform distribution also.



PB code.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st Feb 2011 18:38
Quote: "As for a correct, there's any number of solutions but why bother ? "


Because it's sensible to get into the habit of avoiding redundant calculations. It's then second nature when it's necessary.

Dark Coder Is your method strictly "correct"? Or only as a limit after several (infinitely many?) steps? My guess is that the highest value, three in the example, has a less than 1/3 chance of being selected, in fact 0 chance initially.

I doubt it matters much after about a dozen selections though.

Would the following simple fix work? Choose the initial value from the whole range then use your method thereafter.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 1st Feb 2011 19:42
Quote: "My guess is that the highest value, three in the example, has a less than 1/3 chance of being selected, in fact 0 chance initially."

the color 1 has a 0 chance initially, but the color #2 will be chosen if the rnd() statement returns 1, and the color #0 will be chosen if the rnd() statement returns 0.



But.... I'm bad with probability... and I did a programming "experiment" to see if what you said was correct, darkcoder:

I'm getting the same probabilities for each of the numbers. Even though this is a crude measure.
If you take all the possible outputs given inputs (there are 9 possible inputs for 3 colors: lastcol=0 & rnd()=0, lastcol=0 & rnd()=1, lastcol=0 & rnd()=2, lastcol=1 & rnd()=0, etc.), and assume that each of those input combinations are equally likely, then each of the possible outputs (0,1,2) are equally likely. I think my solution has an even probability distribution >b][/b]D

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st Feb 2011 20:36 Edited at: 1st Feb 2011 20:40
Quote: " assume that each of those input combinations are equally likely"


They obviously aren't initially - and you've missed my point.

After a few selections the true probabilities (assuming a truly random starting point of course) settle down to the correct value of 1/3 which is why your code seems to work (1 million is not "a few"!). But for any given number of selections after the start, say 2 or 3, the values will definitely not be 1/3. Just work it out for the first two or three selections and see for yourself.

In other words Dark Coder's method works for all practical purposes if you ignore the first few selections - but it isn't "correct" in the strict sense of the word.

Edit I should add that given a choice between KP and DC's suggestions on this I'd definitely go for DC's method.

Edit2 I don't know what the original poster's actual application was, but I doubt it involved waiting 1000000 iterations for things to settle down to a third. Sometimes it's the short-term behaviour that's important, not what happens "eventually".
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 1st Feb 2011 22:12 Edited at: 1st Feb 2011 22:17
^^ I wasn't clear, but my code snippet was! That was *my* method not dark coder's that i'm arguing gives an even distribution.



Even though... In this whole thread this is the statement I agree with the most:
Quote: "As for a correct, there's any number of solutions but why bother ? "


[edit]
so what I'm saying is that my method, kevin picone's method, and dark coder's method return the exact same outputs qualitatively. dark coder's... if you provide an escape for the first iteration, then it's exactly the same. Otherwise, it's only exactly the same at the second or higher iteration.
The point I was making with he values settling down, is just that my solution gives and even distribution!

Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 2nd Feb 2011 04:48
Quote: " Because it's sensible to get into the habit of avoiding redundant calculations. It's then second nature when it's necessary."


Oh dear, this old chestnut. Encouraging people to waste energy on optimizations that are ultimately not time critical is awful advice.

dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 2nd Feb 2011 08:17
Quote: "I'm getting the same probabilities for each of the numbers. Even though this is a crude measure.
If you take all the possible outputs given inputs (there are 9 possible inputs for 3 colors: lastcol=0 & rnd()=0, lastcol=0 & rnd()=1, lastcol=0 & rnd()=2, lastcol=1 & rnd()=0, etc.), and assume that each of those input combinations are equally likely, then each of the possible outputs (0,1,2) are equally likely. I think my solution has an even probability distribution >"


If you set 'lastcolour' at the start of every loop to 0 then you'll see it's biased toward colour 1, when it should be even between the two remaining colours. I suppose if you pick the other colours that often then this won't be noticeable.


Quote: "dark coder's... if you provide an escape for the first iteration"


Yeah, if 'last_colour' is set to a higher value than the range like in your example then the first loop will pick between them all.


Quote: "Oh dear, this old chestnut. Encouraging people to waste energy on optimizations that are ultimately not time critical is awful advice."


There's a big difference between premature optimization and writing pointlessly inefficient code. Your solution is the equivalent of Bogosort, and I don't think calling any algorithm with an unbounded worst case performance incorrect is unfair.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Feb 2011 12:48
Quote: " Encouraging people to waste energy on optimizations that are ultimately not time critical is awful advice"


The boot is on the other foot mate.

Why waste time writing inefficient code when there's a simpler better method as clearly shown by Dark Coder's example?

I guess we'll just have to agree to differ.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Feb 2011 14:32
I can't believe that you lot are arguing about the impact of a potential for a second RND call every 30 frames (basically, a second call every 90 frames on average)

Personally, I wouldn't even have thought about efficiency at that point, and would have simply wrapped it in a loop.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Feb 2011 17:49
Quote: "I wouldn't even have thought about efficiency at that point"


If it's a habit then you don't need to.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Feb 2011 19:04
Be serious - who cares about an extra 30 or 40 machine instructions out of the literal billions that run more often over code that repeats more often? There are better things to spend the time on optimising.

If I stopped to think 'how can I make this faster?' on every little part of a program I write, instead of profiling and targeting the parts of the program that are actually taking a substantial amount of time, I'd be out of a job (my day job).

Worrying about optimising something like this, as you code it, is the absolute definition of premature optimisation - "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil" - Donald Knuth

The points you should do optimisation are at the very beginning (choose the right algorithms - always do this, before you write a line of code), and optimise at the end (profile and tune - but only if it's needed), not in the middle.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Feb 2011 20:05
Quote: "who cares about an extra 30 or 40 machine instructions out of the literal billions that run more often over code that repeats more often"


No one and certainly not me. You've obviously missed the point.

Quote: "There are better things to spend the time on optimising."


Don't be silly. If you code efficiently out of habit (which I'm sure you do incidentally) then you don't need to spend time on optimising. Why not spend the same time coding efficiently in the first place - which again, you do all the time as far as I can tell?
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 2nd Feb 2011 22:02
Quote: "If you set 'lastcolour' at the start of every loop to 0 then you'll see it's biased toward colour 1, when it should be even between the two remaining colours. I suppose if you pick the other colours that often then this won't be noticeable."

X_X I'm stupid. Gotcha.

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Feb 2011 22:16
@GG,
Not really, no. If I did, I wouldn't code modularly (all of those extra function call overheads!). I have also coded /whisper/ bubble-sorts /end whisper/ and I've even left them in place where it was appropriate to do so.

When coding, I try to choose the appropriate high-level algorithms, and then code for correctness and clarity of the code. In the majority of cases, simply choosing the correct algorithm gives you performance that is fast enough.

This is how I code my plug-ins and how I managed to get a fast string plug-in - I didn't try to combine steps, or do any of a half-dozen things to tweak and obfuscate the code. I just chose the correct algorithms in the first place, and coded them clearly - in most cases, once I had the correct algorithm for the function, it needed no further modifications for performance.

Basically, I'm simply not going to sweat over a single extra function call every 90th frame on average, of what is a very simple and small constant-time function that has no blocking states.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd Feb 2011 13:29 Edited at: 3rd Feb 2011 14:07
Quote: "Basically, I'm simply not going to sweat over a single extra function call every 90th frame on average, of what is a very simple and small constant-time function that has no blocking states."


Nobody else is either. The discussion wasn't about that.

Anyway, for the record, out of sheer curiousity I tested KP's two methods and DC's method. KP's second "modulo" method was a clear winner. Of the other two, DC's was just slightly faster.

I've now added Kevin Picone's second example to my list of snippets for that odd occasion when the extra speed might be useful. (I think we are all agreed it wasn't here of course.)

Edit Well, this is weird.

I've just re-run my code by changing the order of the methods (as an afterthought). I had included a fourth array swapping method out of interest and it seems that it's position affects the results. If I test the above mentioned methods first, i.e. KP1, KP2 and DC, then they all take about 500ms to produce 1000000 random values, but if I do them all after the array swapping method (ASM) then they each take about 300 ms. In the results I described above I had KP's second method after the ASM method.

Anyone know why this happens?

Here's a version of the code that I used:



I assumed that taking control of sync would be sufficient to get sensible results, but apparently not. Have I made a silly error that I can't see?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 3rd Feb 2011 14:38
I think you've just missed some less-than-obvious things:

- Switch your array to use numbers to eliminate effects caused by heap allocations.
- Use SET TIMER RESOLUTION to eliminate timing differences in windows, or use HITIMER with a resolution higher than 1000hz.
- Reduce the number of iterations - the longer your runs, the more likely that windows will divert processing to another process.
- SYNC before starting a new timing to give windows its chance early to take time away from you, making it less likely during the time-sensitive period.

For the ASM processing, you can use SWAP ARRAY ITEMS to swap items in an array instead of copying too.

dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 3rd Feb 2011 14:41 Edited at: 3rd Feb 2011 14:46
Because DBPro.

I thought it might be the random seed being changed might have caused it, but resetting that still makes it faster. Perhaps the frequent access of the array in the ASM method causes the array's address to be cached by the CPU?

[edit] Even with sync between tests and 'Set Time Frequency 1' I get 440 with my method before ASM and 380 after, and I've tried it many times now

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd Feb 2011 15:35 Edited at: 3rd Feb 2011 15:36
Quote: "I think you've just missed some less-than-obvious things:"


More than likely.

Quote: "- Switch your array to use numbers to eliminate effects caused by heap allocations."


I did wonder about strings being involved. I've no idea why that would have such a dramatic effect - and an improvement to boot as well.

Quote: "- Use SET TIMER RESOLUTION to eliminate timing differences in windows, or use HITIMER with a resolution higher than 1000hz."


Is that an issue when measuring timer() differences of several hundred?

Quote: "- Reduce the number of iterations - the longer your runs, the more likely that windows will divert processing to another process."


I thought about that but when I tried the effect was the same.

Quote: "- SYNC before starting a new timing to give windows its chance early to take time away from you, making it less likely during the time-sensitive period."


I'll see if that makes a difference and report back.

Quote: "For the ASM processing, you can use SWAP ARRAY ITEMS to swap items in an array instead of copying too."


I'll try that too. Thanks.

Does all this suggest a crafty way of optimising our programs, i.e. do some obscure string array processing first, then get on with the main thing? It all seems very peculiar to me.

Quote: "Because DBPro."


Surely not.

[Edited punctuation. ]
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 3rd Feb 2011 15:54
Quote: "Does all this suggest a crafty way of optimising our programs, i.e. do some obscure string array processing first, then get on with the main thing? It all seems very peculiar to me"


Not exactly, since such procedures may make other operations perform worse, while other procedures that are beneficial to other operations may make this operation perform worse. It's just a case of letting the CPU do what it can to optimize for it.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd Feb 2011 16:13 Edited at: 3rd Feb 2011 16:16
Quote: "Quote: "- SYNC before starting a new timing to give windows its chance early to take time away from you, making it less likely during the time-sensitive period."

I'll see if that makes a difference and report back."

Nope. The effect is the same.

Quote: "Quote: "For the ASM processing, you can use SWAP ARRAY ITEMS to swap items in an array instead of copying too."

I'll try that too. Thanks."


That made a BIG difference to that particular method! Even with strings this is now the best method (marginally) - but the weird effect on the other timings is still there. What's even odder is that the ASM method is also reported as faster when it's first. The effect seems unrelated to number of iterations as I said before.

Quote: "Quote: "- Use SET TIMER RESOLUTION to eliminate timing differences in windows, or use HITIMER with a resolution higher than 1000hz."

Is that an issue when measuring timer() differences of several hundred?"


That made no significant difference to the results when I used the following code.



The effect is still there - and it's quite marked. Here are some typical results (using DBP timer()):



Quote: "Not exactly, since such procedures may make other operations perform worse, while other procedures that are beneficial to other operations may make this operation perform worse. It's just a case of letting the CPU do what it can to optimize for it."


That does make it rather difficult for us mere users to optimise our programs - except for obvious things like not calculating something twice.

[Edited to include new code.]
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 3rd Feb 2011 22:51
I can't reproduce your problem with timing. You weren't running other programs (playing music, email checking for new mail etc) alongside your tests were you?

Try this code instead. It's coded in what I consider an appropriate way for performance testing, and best of all, discovers the functions for you - just add your new test function to the end of the code and then compile:


The Test_NULL function is there purely to show the overhead of using function pointers - it's negligible on my system. All other test functions have been pared down to include only what's required.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd Feb 2011 23:52
Er?

Your code uses each method within each iteration so after the first iteration or so the ASM method has been used at least once before all the other method calls (and the same applies to all the other methods) so the order is irrelevant. In other words in your version you've removed the very feature that's suspected of causing the problem - i.e. possibly arrays (or just string arrays - I'm not sure yet) being used at a certain order position. Hence it's not surprising you don't see a difference due to order. In an application you would want the best method in the absence of the others. You've guaranteed that the suspect feature is present in all cases after the first iteration.

What values do you get when you run my code, first with ASM performed first, and second with it last?

Quote: "You weren't running other programs (playing music, email checking for new mail etc) alongside your tests were you?"


Nope (except for this IE page of course ) - but I can't speak for background tasks like TuneUp and Norton. Seems unlikely they're implicated since the results are reproducible.

I'll close down IE and see if that makes a difference and report back.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Feb 2011 00:00 Edited at: 4th Feb 2011 01:03
No. Closing down IE and doing the tests again gave exactly the same results as before. These results are reproducible on my main desktop. I'll test my laptop now (which will also have TU and Norton).

Edit Hmm? The laptop results are rather less consistent and also rather confusing for a different reason. There is NO obvious effect due to order using my code. But there is a strange reduction in performance for KP1 when I use 100000 iterations rather than 10000:



However, the laptop results were very variable compared to those for the desktop - different runs of the same code often gave rather different results. That doesn't surprise me - my laptop struggles with overheating (it's an old Compaq ) and things frequently grind to a halt. The results noted above were fairly consistently seen though.

Your code gives consistent results on both machines which is encouraging (and your version of the ASM seems to be the fastest overall) - but doesn't quite account for the previously noted effect for the desktop.

It is rather discouraging and confusing to find that apparent optimisations can come to nothing depending on what other code happens to have been executed in the same run.

The only clear things to emerge from all this are that

1. if we want an efficient version of a subroutine then we should ask IanM to code it for us.

2. Kevin Picone's scepticism was better founded than he probably intended.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Feb 2011 00:46
Change the RunSequence variable to run stuff in different sequences. Then you can add a WAIT KEY into the loop to stop after the each iteration if you want.

No matter which sequence I get it to use, I don't see what you see.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Feb 2011 01:18
Quote: "No matter which sequence I get it to use, I don't see what you see."


Which "it"? Your code or mine? Anyway, it's beginning to look like an obscure system issue. At the moment your system agrees with my laptop and Dark Coder's test machine agrees with my desktop.

Quote: "Change the RunSequence variable to run stuff in different sequences. Then you can add a WAIT KEY into the loop to stop after the each iteration if you want."


I'm not convinced. There's a lot going on in your code compared to mine. Perhaps the crucial feature is being used elsewhere in your code not merely in the ASM function?

Incidentally I was editing my previous post while you posted.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Feb 2011 01:42
Just noticed a silly coding error in my version of KP1. The following



should of course be



The initialisation should have been before the for/next loop. It doesn't seem to affect the timing issue though.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Feb 2011 10:59
IanM

I've been looking through your code and that pointer stuff looks extremely useful. At first sight it seems to suggest that you can pass a function as an argument to a DBPro function via pointers. If so then that's a powerful extension to the language. I'll do some more experimenting.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Feb 2011 13:34
Yes you can - a function pointer is simply a dword value. It's validated before use so that you can't pass rubbish in though.

I have experimental code which automatically detects initialisation and shutdown functions when they are added to the code, and calls them when needed. I have further code in which functions can be added to lists, which get called automatically before and after every sync just by calling the SYNC command. I have other code, which scans the keyboard for keypresses (itself called at SYNC time), and triggers function calls based on those events.

All that, and it's written in DBPro with standard Matrix1Utils plug-ins.

Quote: "Which "it"? Your code or mine?"

Both/either.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Feb 2011 14:34
Quote: "Yes you can - a function pointer is simply a dword value. It's validated before use so that you can't pass rubbish in though."


I've tried that but it made the DBPro editor hang. I thought I must have misunderstood how it worked since your Help file refers to the functions being local which made me wonder whether you couldn't use the call function ptr command from within another function.

In view of what you've just said, I'll have another look. If I can't spot anything I'll post a simple demo of the problem.

However, I've upgraded to the latest Matrix1 version since I tried that so it might have been fixed.

Anyway, I'll report back after some more testing.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Feb 2011 15:01 Edited at: 4th Feb 2011 16:07
Ok, here's a simple demo. This trimmed version doesn't crash the editor but gives incorrect answers similar to the problem I've reported on your Matrix1 thread.



The global s3# shows that the function xSquared has in fact been called but the value doesn't seem to be returned to the other function correctly.

The function test() should return the value (4+9)/2 but in fact returns zero. Assuming I've used it correctly, of course ...

If you need it I'll post the other version which hangs the editor.

Edit I think I've narrowed down the problem. Posted details on the Matrix1 thread.

Login to post a reply

Server time is: 2026-07-18 02:08:47
Your offset time is: 2026-07-18 02:08:47