Author Topic: A problem with storing position as vector.  (Read 3604 times)

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
A problem with storing position as vector.
« on: May 17, 2006, 02:50:04 AM »
Ok as one of my projects involves the transformation of position into an vector so the information can be transferred vias tie, I wrote this little test genome.

Code: [Select]
cond
*.eye5 0 >
start
'the difference between positions of me and target
*.refxpos *.xpos sub
'I calculate if I have to divide trough 100 or 10 to scale it down to 3 digits or smaller and to be smaller than '320
*.refxpos *.xpos sub abs dup *.refypos *.ypos sub abs sub abs add *.refypos *.ypos sub abs add 2 div 100 div 31 sub sgn 1 add sgn 9 mult 1 add 10 mult div
'the first 3 digits are used
1000 mult
'the difference between positions of me and target
*.refypos *.ypos sub
'I calculate if I have to divide trough 100 or 10 to scale it down to 3 digits or smaller and to be smaller than '320
*.refxpos *.xpos sub abs dup *.refypos *.ypos sub abs sub abs add *.refypos *.ypos sub abs add 2 div 100 div 31 sub sgn 1 add sgn 9 mult 1 add 10 mult div
'store it in out1
add *.out1 store
'get the oinformation back from out1 and aim
*.out1 *.out1 1000 mod sub 1000 div *.xpos add *.out1 1000 mod *.ypos add
angle .setaim store
stop
end
« Last Edit: May 17, 2006, 02:50:29 AM by Welwordion »

Offline abyaly

  • Bot Destroyer
  • ***
  • Posts: 363
    • View Profile
A problem with storing position as vector.
« Reply #1 on: May 19, 2006, 02:53:39 AM »
add *.out1 store
should be
add .out1 store
Lancre operated on the feudal system, which was to say, everyone feuded all
the time and handed on the fight to their descendants.
        -- (Terry Pratchett, Carpe Jugulum)

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
A problem with storing position as vector.
« Reply #2 on: May 19, 2006, 09:55:55 AM »
Hmm its seems that still not enough to make it work,also even when removing the scaling down calculations and operating only in small distances it turns strangely.
Maybe it aims before refreshing the refvariables? although that should not really matter that much.
really strange

Added:I am stupid, why I do not just use angle? its also an absolute value.
« Last Edit: May 19, 2006, 04:57:40 PM by Welwordion »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
A problem with storing position as vector.
« Reply #3 on: May 20, 2006, 02:18:03 PM »
Quote
Added:I am stupid, why I do not just use angle? its also an absolute value.

I did kind of wonder that  
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D