Rapid Fire (Sliding Type)

View previous topic View next topic Go down

Rapid Fire (Sliding Type)

Post by DarkGrim312 on Thu Aug 05, 2010 6:00 am

for some reason it works super smooth in Rigidchips Designer but it just jams in Rigidchips...
Can someone help me please??
its so annoying

Code:

// [RCD]
Val
{
   GUN1(default=0, step=1000000000)
   GUN2(default=0, step=1000000000)
   GUN3(default=0, step=1000000000)
   SWITCH(default=0, max=1)
   SWITCH2(default=0, max=1)
   SWITCH3(default=0, max=1)
   SWITCH4(default=0, max=1)
   SWITCH5(default=0, max=1)
   SWITCH6(default=0, max=1)
   VAR1(default=90, max=90)
   VAR2(default=180, max=180)
   VAR3(default=90, max=90)
   VAR4(default=180, max=180)
   VAR5(default=90, max=90)
   VAR6(default=180, max=180)
}
Key
{
}
Body
{
   Core() {
      E:Chip() {
         S:Chip() { }
      }
      N:Chip() {
         E:Chip() { }
      }
      W:Chip() {
         N:Chip() { }
      }
      S:Chip() {
         W:Chip() { }
      }
      S:Chip(angle=-150) {
         S:Frame(angle=-30) {
            S:Frame(angle=VAR3) {
               S:Frame(angle=-VAR4) {
                  S:Frame(angle=VAR3) {
                     S:Arm(power=GUN2, option=100000) { }
                  }
               }
            }
            S:Frame(angle=VAR1) {
               S:Frame(angle=-VAR2) {
                  S:Frame(angle=VAR1) {
                     S:Arm(power=GUN1, option=100000) { }
                  }
               }
            }
            S:Frame(angle=VAR5) {
               S:Frame(angle=-VAR6) {
                  S:Frame(angle=VAR5) {
                     S:Arm(power=GUN3, option=100000) { }
                  }
               }
            }
         }
      }
   }
}
Script
{if _KEY(4){
SWITCH=1}

if _KEY(5){
SWITCH=0
SWITCH2=0
SWITCH3=0
Switch4=0
switch5=0
switch6=0
var1=var1+3
var2=var2+6
var3=var3+3
var4=var4+6
var5=var5+3
var6=var6+6
}

if switch=1{
Var1=var1-6
var2=var2-12}

if Var2=0&var1=0{
Switch=0
switch2=1
gun1=100000
}

if Switch2=1{
Var1=var1+7
var2=var2+14
switch3=1}

if switch3=1{
var3=var3-6
var4=var4-12
}

if var3=0&var4=0{
switch4=1
switch3=0
switch2=0
gun2=100000
}

if switch4=1{
var3=var3+7
var4=var4+14
switch5=1
}

if var3=90&switch4=1{
switch4=0
}

if switch5=1{
var5=var5-6
var6=var6-12
}

if Var5=0&var6=0{
Switch5=0
switch6=1
gun3=100000
}

if Switch6=1{
Var5=var5+7
var6=var6+14}

if switch6=1&var5=90{
switch6=0
}

if switch6=1{
switch=1
}


}
avatar
DarkGrim312
Car
Car

Posts : 17
Join date : 2010-07-27
Age : 21
Location : Philippines

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by DarkGrim312 on Fri Aug 13, 2010 5:00 am

PLEASE HELP confused Question Question confused
avatar
DarkGrim312
Car
Car

Posts : 17
Join date : 2010-07-27
Age : 21
Location : Philippines

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by JHaskly on Fri Aug 13, 2010 6:21 am

I'll help.

*Gets the model*

EDIT: I'm sorry, I can't pick through that script.

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by DarkGrim312 on Thu Aug 19, 2010 5:50 am

DARN... why whats the problem with the script? scratch
avatar
DarkGrim312
Car
Car

Posts : 17
Join date : 2010-07-27
Age : 21
Location : Philippines

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by JHaskly on Fri Aug 20, 2010 1:00 am

A lot of repetition, a lot of ambiguously named variables. It could've been done in under 20 lines of lua, possible under ten. (I'm used to compact code).

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by T-Bouw on Fri Aug 20, 2010 1:23 am

The timing of the arms are off. When one fires, another is already overlapping the firing one.

Yes, the code could use a little cleaning up, even in script. But it's true that you can more easily track down the problem with a script written more clearly. I can't pinpoint the exact problem.
avatar
T-Bouw
Car
Car

Posts : 22
Join date : 2010-07-22
Age : 34
Location : The Netherlands

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by DarkGrim312 on Fri Aug 20, 2010 7:51 am

... I should reallly learn LUA... but how?? scratch Question
avatar
DarkGrim312
Car
Car

Posts : 17
Join date : 2010-07-27
Age : 21
Location : Philippines

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by Point.Blank on Fri Aug 20, 2010 5:05 pm

First, learn how to type it properly: it's Lua, not LUA.

To start off, you can take a look at some Lua tutorials (try Google-ing it), or you could look at some of Bwansy's or JHaskly's (Juz30, I presume?) code from models they made, and try to make sense of it. It depends on how you learn, really. I just look at code examples, and go "Oh, so you need this to do this..." and "why is this here? Is it because of this?"; you may learn differently, and if you don't understand anything, I'm sure JHaskly or Bwansy wouldn't mind clarifying.
avatar
Point.Blank
Car
Car

Posts : 24
Join date : 2010-08-11
Age : 23
Location : Ontario, Canada

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by JHaskly on Fri Aug 20, 2010 6:04 pm

Point.Blank - You presume well Very Happy

I personally learned Lua by looking through other peoples' models. (Not the complex ones though Razz )

There is a collaborative tutorial that some of us put together... I'll post it soon.

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by DarkGrim312 on Sat Aug 21, 2010 7:24 am

Point.Blank - Sorry... got used to it Very Happy... Unrelated question, do you by any chance play incredibots??

JHaskly - Oh so you used to be juz30, i always presumed you were a new member Very Happy... is there any non-complex models with Lua here??
avatar
DarkGrim312
Car
Car

Posts : 17
Join date : 2010-07-27
Age : 21
Location : Philippines

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by Point.Blank on Sat Aug 21, 2010 8:05 am

DarkGrim312 wrote:Unrelated question, do you by any chance play incredibots??
Now what on earth gave you that ridiculous idea? I tried it out before, but lost interest and forgot about if for several months. It's like phun, but with challenges.

DarkGrim312 wrote:Oh so you used to be juz30, i always presumed you were a new member Very Happy... is there any non-complex models with Lua here??
And you didn't notice the admin tag? More on focus, it really depends on how you define 'complex'. Even the most complex scripts are made, piece by piece. Just look at it one function (or line) at a time, and you'll eventually figure out some things. Others, you might have to ask, as they could be confusing without a proper introduction.
avatar
Point.Blank
Car
Car

Posts : 24
Join date : 2010-08-11
Age : 23
Location : Ontario, Canada

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by JHaskly on Sun Aug 22, 2010 1:41 am

There are simple, Lua--driven models out there, but they aren't as common. If people want, I could make up some simple models, and have two of each model, one drivel with KEY and one with Lua, to show some basic stuff.

Oh, and the tutorial can be found here.

It has a fair few code examples in it.

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by DarkGrim312 on Sun Aug 22, 2010 5:35 am

Point.Blank - Because there was like a group of players that had the name Point Blank. I thought you were their leader or somethin. Honest Mistake Smile

JHasky - That would actually be useful, because i was looking for a key map so i know wich key coresponds to wich letter. Whenever i open my guide on my RC it always freezes T_T

Oh yeah thanks for the tutorial Very Happy Really gonna help me learn Lua
avatar
DarkGrim312
Car
Car

Posts : 17
Join date : 2010-07-27
Age : 21
Location : Philippines

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by Fox Explorer on Fri Aug 26, 2011 11:16 pm

I know these posts are a little over a year old but here is a sliding type gun that I made. Hope this will be able to help you.

Code:

// [RCD]
Val
{
   Q1(default=0, max=361)
   Q2(default=60, max=361)
   Q3(default=120, max=361)
   Q4(default=180, max=361)
   TRIM(default=0, min=-360, max=360)
   TURN(default=90, min=60, max=120)
   W1(default=0, max=100000, step=100000)
   W2(default=0, max=100000, step=100000)
   W3(default=0, max=100000, step=100000)
   W4(default=0, max=100000, step=100000)
}
Key
{
   0:TURN(step=1)
   1:TURN(step=-1)
   2:TRIM(step=1)
   3:TRIM(step=-1)
   4:Q1(step=10), Q2(step=10), Q3(step=10), Q4(step=10)
}
Body
{
   Core() {
      N:Frame(angle=Q1, option=1) {
         N:Frame(angle=-Q1, option=1) {
            N:Frame(angle=-Q1, option=1) {
               N:Arm(angle=Q1, power=W1, option=100000) { }
            }
         }
      }
      N:Frame(angle=Q2, option=1) {
         N:Frame(angle=-Q2, option=1) {
            N:Frame(angle=-Q2, option=1) {
               N:Arm(angle=Q2, power=W2, option=100000) { }
            }
         }
      }
      N:Frame(angle=Q3, option=1) {
         N:Frame(angle=-Q3, option=1) {
            N:Frame(angle=-Q3, option=1) {
               N:Arm(angle=Q3, power=W3, option=100000) { }
            }
         }
      }
      N:Frame(angle=Q4, option=1) {
         N:Frame(angle=-Q4, option=1) {
            N:Frame(angle=-Q4, option=1) {
               N:Arm(angle=Q4, power=W4, option=100000) { }
            }
         }
      }
      S:Chip(angle=TURN) {
         S:Trim(angle=TRIM) {
            S:Weight(angle=90, option=8) {
               E:Weight(option=8) { }
               W:Weight(option=8) { }
               S:Weight(option=8) {
                  E:Weight(option=8) { }
                  W:Weight(option=8) { }
               }
            }
            S:Weight(angle=-90, option=8) {
               E:Weight(option=8) { }
               W:Weight(option=8) { }
               S:Weight(option=8) {
                  E:Weight(option=8) { }
                  W:Weight(option=8) { }
               }
            }
         }
      }
   }
}
Script
{
   if trim=360 {trim=0}
   if trim=-360 {trim=0}

   if Q1=361 {Q1=0}
   if Q2=361 {Q2=0}
   if Q3=361 {Q3=0}
   if Q4=361 {Q4=0}

   if Q1=0 {W1=100000}
   if Q2=0 {W2=100000}
   if Q3=0 {W3=100000}
   if Q4=0 {W4=100000}

   print(0),"Arrow keys to aim"
   print(1),"Hold Z to fire"}

avatar
Fox Explorer
Plane
Plane

Posts : 25
Join date : 2011-06-08

View user profile

Back to top Go down

Re: Rapid Fire (Sliding Type)

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum