<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Curious how to write this JS using Max objects</title>
		<atom:link href="http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 00:08:48 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/#post-61228</guid>
					<title><![CDATA[Curious how to write this JS using Max objects]]></title>
					<link>http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/#post-61228</link>
					<pubDate>Sat, 14 Jan 2012 23:00:48 +0000</pubDate>
					<dc:creator>withakay</dc:creator>

					<description>
						<![CDATA[
						<p>This is a pretty simple bit of Javascript but I can&#8217;t figure out a clear way to get the same results with Max objects, it was just masses of spaghetti so I gave up and just used the JS. But it has been bugging me so, out of curiosity, would anyone care to show me how you would do this in Max?</p>
<pre><code>var lastindex = 0;
var a = 0;
var b = 1;

function msg_int(index)
{
	if (index > lastindex) {
		if (index % 2 > 0) {
			a += (index-lastindex)+1;
		} else { // even
			b += (index-lastindex)+1;
		}
	} else {
		if (index % 2 > 0) {
			b -= (lastindex-index)+1;
		} else {
			a -= (lastindex-index)+1;
		}
	}
	lastindex = index;
	outlet(0,a,b);
}</code></pre>						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/#post-220663</guid>
					<title><![CDATA[Re: Curious how to write this JS using Max objects]]></title>
					<link>http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/#post-220663</link>
					<pubDate>Sun, 15 Jan 2012 01:30:49 +0000</pubDate>
					<dc:creator>Ch</dc:creator>

					<description>
						<![CDATA[
						<p>here is a way :</p>
<div><span id="toggle220663-0" class="patchtoggle" onmousedown="toggleMaxPatch('post220663-0', 'er220663-0');">&#8211; Pasted Max <span id="maxversion220663-0"></span> Patch, click to <span id="er220663-0">expand</span>. &#8211;</span> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  width="110" height="14" class="clippy" ><param name="allowScriptAccess" value="always" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param NAME="FlashVars" value="copied=copied!&#038;copyto=copy to clipboard"/><param name="bgcolor" value="#FFFFFF"/><param name="wmode" value="opaque"/><embed src="/wp-content/plugins/bbpress-copy-compressed/clippy.swf"  width="110" height="14"   name="clippy"  quality="high"  allowScriptAccess="always"  type="application/x-shockwave-flash"  pluginspage="http://www.macromedia.com/go/getflashplayer"  FlashVars="text=----------begin_max5_patcher----------%0A903.3oc2X1taaBCEF92jqBKTmzxVZDGi4qosJsqiotIBwq0q7QTfnkspduuX%0AaHIMijXb1bsZ%2BATaHvqe7K1my4wQNtypVSqcQe.8EjiyiibbDcw6vossiaQ5%0A5r7zZws4lUUTPKabmHuVCccin%2BYc8vlKZWM6GWGlz042qJapY%2BlxuD3M0qs6%0AEoMY2yJu6aKoYMRUfw7KiHQhS3P9QHdpG511eS4pBVYNsQHGXWmUqZ550au2%0AZYZg3s594krzbW9EdZzH9gIJNh27rmQW1MRjullesfJ0qKiCiMi%2Bzx6b2Jx8%0AgPr9PfDvOE3oCDvVEDBGNDfv.aCBzetYv7WV%2BUkKRyd.wPrywG9odwCQe7.h%0ASQDqEOKRe.4gfixldIRPr1DwOQXUBRNMQv8RDvDDgtdwRzae6UL3M3w23MF8%0AUDuwG%2BD5JFd7v.EAqMnfP42TDeqkT4UoyKn00HugQE74VuIqJuZYKM3iduoP%0ABFBhD%2BmO%2BuI7Kr8Y2CEChE3SdLDqy2eFgg0zbDbB.JVzdxty8Cz.8sYxuGSR%0AzgP9lfPM70tUc86Imc0bruFrZOuDI1eZvvQEwDn58mDQ8RCPamCNRtfN9z33%0AEb8IMvgmFgC5I4f%2BqOb.I56NjgDZC33XIEwJmSW2ShQPjFiZ4ftM6nW9zhN1%0AXdyMzbzwsFoAztMafLKfXKHev989WObuuFQ86iayCx589on9L.5GspMUQf9c%0A.rSjjyQ8.Wv1AvqusCRzmFgdVNMXmHF7iwC8yBFisG2wkU6n.cil15KbDav9%0AAes2%2BDr9UK1UUDzMhBgbs2zfwuCOcXo9qQ5FDYdFsapBXx%2Bu5gHdht4rxCq5%0AtPV79eN3pqVsLqa71kb4lz46D1bJOZqzFVU4d2DunPncp%2Bd174zx82GrfMeQ%0A0FSVqHP216znpZx%2BYusSHIvXR5.Bzul3E0vfX5fWW%2BZJ17R5btIdLJFTSwJP%0AIdZiFTRGPfi3lLKlvpnICioDUvDXVMQT0NA1klDyulSSpL0ACTRXfvi1vOVr%0AgJlHp.7As.rLZ03sstT3ppGzfy2J9kp4TjHJB%2ByMca10y3RBeNIQrt.aDRBr%0AKIYVuTnBRx27do%2BwRBRDYNAfrNj6ZcgZUkfBwFFefhApN.SFDI1K.mDIKisr%0AHEOuUWsMi21x.apEDa1uV.U0j4luCTIj6PytzanJwHEFZdMctrkBuj4tMMdZ%0AzePIJluX%0A-----------end_max5_patcher-----------&#038;copied=copied!&#038;;copyto=copy to clipboard"  bgcolor="#ffffff"  wmode="opaque" /> </object></div>
<div id="post220663-0" style="display:none;visibility:hidden;" >
<div class="patchtoggleInfo"><small>Copy <b>all</b> of the following text.Then, in Max, select <em>New From Clipboard</em>.</small></div>
<div class="patchtogglediv">
<pre><code id="pastedcode220663-0">----------begin_max5_patcher----------
903.3oc2X1taaBCEF92jqBKTmzxVZDGi4qosJsqiotIBwq0q7QTfnkspduuX
aHIMijXb1bsZ+ATaHvqe7K1my4wQNtypVSqcQe.8EjiyiibbDcw6vossiaQ5
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
zePIJluX
-----------end_max5_patcher-----------</code></pre></div>
</div>
<p>but it is not really readable&#8230;<br />
maybe it would be better by using some large [expr], but i think keeping it in the js is the best option for readability of the algorithm.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/#post-220664</guid>
					<title><![CDATA[Re: Curious how to write this JS using Max objects]]></title>
					<link>http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/#post-220664</link>
					<pubDate>Sun, 15 Jan 2012 20:42:49 +0000</pubDate>
					<dc:creator>Christopher Dobrian</dc:creator>

					<description>
						<![CDATA[
						<p>IMHO, what you have here &#8212; setting variables in nested if clauses &#8212; is a pretty classic situation where an imperative language seems (to most) to be simpler than the more dataflow-ish model of Max. Since you&#8217;ve already solved it in JS, there&#8217;s no need to redo it in Max, right? It&#8217;s feasible to rewrite it as an abstraction, but why bother?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/#post-220665</guid>
					<title><![CDATA[Re: Curious how to write this JS using Max objects]]></title>
					<link>http://cycling74.com/forums/topic/curious-how-to-write-this-js-using-max-objects/#post-220665</link>
					<pubDate>Sun, 15 Jan 2012 21:50:32 +0000</pubDate>
					<dc:creator>Roman Thilenius</dc:creator>

					<description>
						<![CDATA[
						<p>i dont really get that java stuff, but from what i can tell it could look something like that:</p>
<p>[expr ($f2>$f1)*( (($f2%2)>0)*(($f2-$f1)(notpossible)+1) ) + ($f2< =$f1)*( ($f2%2)>0)*(($f2-$f1)(notpossible)+1) )]</p>
<p>but since there cant be an accumulator inside expr, i think you would need at least 6 objects to do this, even<br />
if you accumulate by routing the expr´s output back to some +$f3.</p>
<p>-110</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

