Cerb043_4 [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=38690 What's the most active/best way to get help with code? <p>Nothing I try seems very active. I went through...slack...twitter.....here....stack exchange. And the time delay between getting any answers, if any, is excruciatingly ineffective. Are there more active communities I could get help from that I haven't tried?</p> <p>Here and there I have little questions I need help with. Mainly syntax related, I don't need somsone to go through ALL my code or anything just 1 liners here and there. For small questions while writing your code, what is the best way to get answers asap? Was hoping for a chatbox or irs or something.</p> https://www.lexaloffle.com/bbs/?tid=34807 https://www.lexaloffle.com/bbs/?tid=34807 Mon, 22 Jul 2019 01:34:29 UTC Trying to initiate titlescreens, problem with logic <p>I'm having a really hard time with initiating if statements using multiple booleans. It seems I initiate one but then it stays and I can't figure out how to write them properly if I'm dealing with multiple.</p> <p>In this example I'm trying to set 3 gamescreens with a timer for the 2nd.<br /> The default screen is titlescreen; the initated one on button press is titlescreen1; and then i want gamescreen to happen automatically when the timer finishes.</p> <p>Problem is gamescreen doesn't initiate and I don't understand why.</p> <p>countdown=5<br /> time_diff=0<br /> titlescreen=true<br /> titlescreen1=false<br /> gamescreen=false</p> <p>function _init()<br /> end</p> <p>function time_lapse()<br /> if time() - time_diff &gt; 1 and countdown &gt; 0 then<br /> countdown-=1<br /> time_diff=time()<br /> end<br /> end</p> <p>function _update()<br /> if btn(4) then titlescreen1=true end<br /> if titlescreen1==true then time_lapse()<br /> if countdown==0 then gamescreen=true end<br /> elseif gamescreen==true then<br /> end<br /> end</p> <p>function _draw()<br /> cls()<br /> print(&quot;one is happening&quot;,33,33,14)<br /> if titlescreen1==true then cls() print(countdown,15,15,14)<br /> elseif gamescreen==true then<br /> cls()<br /> print(&quot;gamescreen is active&quot;,33,33,14)<br /> end<br /> end</p> https://www.lexaloffle.com/bbs/?tid=34801 https://www.lexaloffle.com/bbs/?tid=34801 Sun, 21 Jul 2019 08:43:49 UTC Trouble adding sfx to movement <p>Basic movement can be facilitated through:<br /> if btn(0) then x-=1 end</p> <p>But when I add sfx:</p> <p>if btn(0) then x-=1 and sfx(0) end</p> <p>It always generates an error as soon as that button 0 is pressed. Why is that? If x then y and z end. Is there something wrong with that syntax? Or is it related to sfx not working in this way?</p> <p>And why is it when I clarify with brackets it doesn't even run!? Am I clarifying that my syntax is wrong before teh game starts? That's funny.<br /> i.e.<br /> if btn(0) then (x-=1 and sfx(0)) end</p> https://www.lexaloffle.com/bbs/?tid=34792 https://www.lexaloffle.com/bbs/?tid=34792 Sat, 20 Jul 2019 14:59:53 UTC Having hard time initializing for i=a,b statements <p>Edit: not sure how I'm expected to display multiplication using the syntax here, but assume there's a X or star or whatever between 15 and i etc.</p> <p>I was trying to initiate this statement here, which I can do:<br /> for i=1,4 do<br /> print(i, 15<em>i-14, 15</em>i-14, 14)<br /> end</p> <p>But then I wanted to move the diagonal array of 4 numbers with the arrow keys around the screen. I tried the code below but keep getting errors. I'm guessing my argument is setup wrong and I can't call i as the same variable in all these statements and make it work...? Can someone help me understand the immediate problems with the code, and then afterwards if viable suggest an alternative method of doing so. I'm still learning so my immediate concern is figuring out what is wrong here specifically.</p> <p>function _init()<br /> j= {<br /> x=15<em>i-14,<br /> y=15</em>i-14<br /> }<br /> end</p> <p>function _update()<br /> if btn(0) then j.x-=1 end<br /> if btn(1) then j.x+=1 end<br /> if btn(2) then j.y-=1 end<br /> if btn(3) then j.y+=1 end<br /> end</p> <p>function _draw()<br /> cls(0)<br /> for i=1,4 do<br /> print(i,j.x,j.y,14)<br /> end<br /> end</p> <p>Even in the API demo I copy the code for the similar statment, but when i run it on its own it doesn't work. I don't understand why this here doesn't work on its own either:</p> <p>cls()<br /> for i=0,15 do<br /> print(i,x,2,i)<br /> x = x + 6 + flr(i/10)*4<br /> end</p> https://www.lexaloffle.com/bbs/?tid=34748 https://www.lexaloffle.com/bbs/?tid=34748 Tue, 16 Jul 2019 08:50:48 UTC