Welcome To Darwinbots > Newbie

custom labels? noob problem

(1/1)

zerodexter:
hi everyone, Db is great!  

I just started programming my first bots from scratch, but I have a problem with custom labels as they don't seem to be 'accessible' to me?

here's a very short example of the code:

'ZDbot

def NF 1

cond
  *.eye1 0 =
  *.eye2 0 =
  *.eye3 0 =
  *.eye4 0 =
  *.eye5 0 =
  *.eye6 0 =
  *.eye7 0 =
  *.eye8 0 =
  *.eye9 0 =
start
  314 .aimdx store
  1 .NF add store
stop

cond
  *.NF 5 >
start
  10 .up store
  1 .NF store
stop

end

what I'm trying to do is simple: let the bot do a 360° scan and if it doesn't find anything, let it move a bit and do another scan.
problem is, the NF variable is never increased and I've got no idea why  

any ideas?

kenstauffer:
replace:


--- Quote ---1 .NF add store
--- End quote ---

with


--- Quote ---1 *.NF add .NF store
--- End quote ---

PurpleYouko:
Also try to use memory locations that are not already taken by existing sysvars (sysem variables)
You chose 1 as your memory location for NF. 1 is already used by .up so it will obey various criteria laid down for that sysvar.
First, any value placed in memory location 1 will be acted upon by making yoour bot accelerate forward by that values
Second, memory location 1 is wiped at the end of every cycle so your value will be lost.

Try opening up the sysvars2.21.txt file (in your DB root directory) with notepad and look at the list of sysvars and their associated memory locations then use a free location for your custom variables.

zerodexter:
thank you  

Numsgil:
50 is the traditional custom variable.

Welcome to DB

Navigation

[0] Message Index

Go to full version