creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
borg teleport code errors, help pls   
raimian

raimian



  7/16/2016

hi ive been working on the borg scripts and found the bug with teleporting, but am unsure how to fix it.

there is 2 points at which it does a room check but doe'snt have any loop back to start for output being 0.

the 2 check points are;
doif tmvt va04 va05 eq 1
doif tmvf va00 va01 eq 1

if either of the 2 lines "eq 0" the agent crashes as there is no code telling it what to do.

as far as I can tell it needs 2 elsif that take the code back to co-ordinates acquisition, if those lines eq 0.

I hope someone can help with this

heres the code;


*Subroutine Teleport Main*
subr teleM
doif targ ne null
setv va00 posr
setv va01 posb
subv va01 10
rtar 2 3 56515
doif targ ne null *** needs to loop to here, I think
setv va04 va00
setv va05 va01
subv va04 116
subv va05 152
doif tmvt va04 va05 eq 1

targ mv00
doif targ ne null
doif tmvf va00 va01 eq 1

setv va02 posx
setv va03 posy
gsub teleA
gsub teleB
wait 5
mvsf va00 va01
chem 214 -1
subv mv08 200
doif mv07 eq 2
setv va00 0
loop

addv va00 1
wait 3
untl va00 eq 100
endi
endi
endi
endi
endi
endi
retn

 
raimian

raimian



  7/18/2016

post updated with more info
 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  7/18/2016

ELSE would be a better condition to use, because it's a catch-all. How do you plan to solve the problem of the 0 cases - try again, wait a while, ??? Try building from this:

*Subroutine Teleport Main*
subr teleM
doif targ ne null
setv va00 posr
setv va01 posb
subv va01 10
rtar 2 3 56515
doif targ ne null
setv va04 va00
setv va05 va01
subv va04 116
subv va05 152
doif tmvt va04 va05 eq 1

targ mv00
doif targ ne null
doif tmvf va00 va01 eq 1

setv va02 posx
setv va03 posy
gsub teleA
gsub teleB
wait 5
mvsf va00 va01
chem 214 -1
subv mv08 200
doif mv07 eq 2
setv va00 0
loop

addv va00 1
wait 3
untl va00 eq 100
endi
*Alternative to TMVF goes here
else
snde "rckl"
endi
endi
*Alternative to TMVT goes here
else
snde "buzz"
endi
endi
endi
retn


My TCR Norns
 
raimian

raimian



  7/19/2016

I don't know, I need it to loop back to "doif targ ne null" after the "rtar" line which picks the creature.

it could be;

else tmvt va04 va05 eq 0 loop

else tmvf va00 va01 eq 0 loop

but I'm not sure where those loops go back to.

 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  7/19/2016

else is a failsafe used to denote any other condition, so it's not valid to specify a condition after else. loop looks like it's supposed to be at the beginning of a code block, not the end. What should 'break' the loop condition?

The following adds in an eternal loop to the check:

*Subroutine Teleport Main*
subr teleM
doif targ ne null
setv va00 posr
setv va01 posb
subv va01 10
rtar 2 3 56515
doif targ ne null
setv va04 va00
setv va05 va01
subv va04 116
subv va05 152
*Loop this part of the code.
loop
doif tmvt va04 va05 eq 1

targ mv00
doif targ ne null
doif tmvf va00 va01 eq 1

setv va02 posx
setv va03 posy
gsub teleA
gsub teleB
wait 5
mvsf va00 va01
chem 214 -1
subv mv08 200
doif mv07 eq 2
setv va00 0
loop

addv va00 1
wait 3
untl va00 eq 100
endi
*Alternative to TMVF goes here
else
snde "rckl"
endi
endi
*Alternative to TMVT goes here
else
snde "buzz"
endi
*Keep doing this loop forever and ever
ever
endi
endi
retn


My TCR Norns
 
raimian

raimian



  7/20/2016

the loop needs to end when the location checks eq 1, so would it be;

untl tmvt va04 va05 eq 1

but also needs to check;

untl tmvf va00 va01 eq 1

if both eq 1 then should continue to teleport,

 
raimian

raimian



  7/21/2016

is this right??

*Subroutine Teleport Main*
subr teleM
doif targ ne null
setv va00 posr
setv va01 posb
subv va01 10
rtar 2 3 56515
doif targ ne null
*Loop this part of the code.
loop
setv va04 va00
setv va05 va01
subv va04 116
subv va05 152

doif tmvt va04 va05 eq 1

targ mv00
doif targ ne null
doif tmvf va00 va01 eq 1

setv va02 posx
setv va03 posy
gsub teleA
gsub teleB
wait 5
mvsf va00 va01
chem 214 -1
subv mv08 200
doif mv07 eq 2
setv va00 0
loop

addv va00 1
wait 3
untl va00 eq 100
endi
*Alternative to TMVF goes here
else
**** go back to start of loop
endi
endi
*Alternative to TMVT goes here
else
******go back to start of loop
endi
*Keep doing this loop until room check eq 1
untl tmvt va04 va05 eq 1 and tnvf va00 va01 eq 1
endi
endi
retn



for the "else" I'm don't know how to send it to the start of the loop

 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  7/24/2016

Could you please walk me through your code in English? What do you want to happen if the initial teleport doesn't work?

My TCR Norns
 
raimian

raimian



  7/24/2016

the problem it having is it trying to teleport to locations outside of the map. if the initial teleport doest work, I want it to loop the co-ordinates acquisition until it gets a valid location,
 
Allekha

Allekha


 visit Allekha's website: Hello, Robotto blog
  7/24/2016

How are the teleportation co-ordinates set in the first place? Is it done in a few lines of code, or is there a subroutine for it? If it's just a few lines of code, you're allowed to copy-paste them into your else blocks. Because of the loop untl, if when running it goes into one of those else blocks, then the code will be read again from the loop statement and be tested against the doif statements again, and this will repeat until the untl condition is fulfilled - in your case, it will check if the co-ordinates are good until it passes your checks, and if they aren't, then your else statements should generate new co-ordinates to be checked on the next pass.

What I would do, actually, is put only the testing and selection of room co-ordinates in that loop-untl block, and then put the code dealing with teleportation after the untl statement. As you said, "if both [statements] eq 1 then should continue to teleport", but it looks like you're running your teleport subroutines and code already within your loop, not after it. I think it should work as you have it, but it would help the organization of your code to keep the lines related what happens if your checks pass after the loop rather than within it.

Here is how I would structure it:
loop
setv va04 va00
setv va05 va01
subv va04 116
subv va05 152

doif tmvt va04 va05 eq 1

targ mv00
doif targ ne null
doif tmvf va00 va01 ne 1
**what do you do if tmvf va00 va01 doesn't equal 1? (if it does, then the loop will end
**and you can go ahead and teleport)
**** go back to start of loop
endi
endi
*Alternative to TMVT goes here
else
******go back to start of loop
endi
untl tmvt va04 va05 eq 1 and tmvf va00 va01 eq 1
[code doing the actual teleport here]

 
raimian

raimian



  7/25/2016

your code seems to pose me the same question I started with,
**what do you do if tmvf va00 va01 doesn't equal 1

the co-ordinates acquisition is at the start of the code.

I Never wrote the origional borg coding I just trying to get the bits missing filled in, so that it doesn't crash if the room check eq 0.


 
Papriko
Peppery One

Papriko



  7/25/2016

The new code makes use of LOOP and UNTL. These two work slightly different than DOIF. When the condition in UNTL is false, it jumps back to the first line that comes after LOOP.
It keeps trying again and again and again until (UNTL - until, get it?) the condition at the end is fulfilled. That means with this piece of code you are basically guaranteed that the TMVTs are all 1 when you come out at the end.


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
raimian

raimian



  8/29/2016

please please can somebody fix this code.

this code has been broken since the maker first released it 15 years ago.

I am not the original maker, I'm just trying to get it updated and working

 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  8/29/2016

Have you tried allekas proposed fix?

My TCR Norns
 
raimian

raimian



  8/30/2016

no because it still has unaswerd questions in the code, and I don't what what other code it needs to work,

I'm having to relearn caos from scratch as it been too long since I last coded.

I need somebody experienced to say her is the code you need it should work

I don't understand how the teleport code works, so part fixes don't help.

 
raimian

raimian



  10/26/2016

ok ive rewritten the code and borrows a subroutine from the random teleporter. but I'm now getting a inject error of; "unresolved label" "getcoords"

can anyone help??



*Subroutine Teleport Main*
subr teleM
doif targ ne null

rtar 2 3 56515

doif targ ne null
gsub getcoords

doif tmvt va90 va91 eq 0
gsub getcoords

elif tmvt va90 va91 eq 1

targ mv00
doif targ ne null

doif tmvf va90 va91 eq 0
gsub getcoords


elif tmvf va90 va91 eq 1


gsub teleA
gsub teleB
wait 5
mvsf va90 va91
chem 214 -1
****teleport chem****
subv mv08 200
****battery variable****
doif mv07 eq 2
setv va00 0
loop
addv va00 1
wait 3
untl va00 eq 100
endi
endi
endi
endi
endi
endi
retn



**** get co-ordinates****

subr getcoords

setv va00 gmap posl post
doif va00 eq -1
enum 1 1 227
mesg writ targ 1001
next
stop
endi
* get information string
sets va01 mloc va00

setv va99 1
reps 3
* turn into int
setv va02 stoi va01
doif va99 eq 1
setv mv00 va02
elif va99 eq 2
setv mv01 va02
elif va99 eq 3
setv mv02 va02
endi
* get length of it
setv va03 strl vtos va02
* now chop down the information string
setv va04 strl va01
setv va05 va04
subv va05 va03
addv va03 2
subv va05 1
sets va06 subs va01 va03 va05
doif va99 eq 3
setv mv03 stoi va06
endi
sets va01 va06
addv va99 1
repe



* now use ov00, ov01, ov02, ov03 to give coords to chose between
* make ov02 the right most coord
addv mv02 mv00
* make ov03 the left most coord
addv mv03 mv01

* now chose coords
setv va90 rand mv00 mv02
setv va91 rand mv01 mv03

* dbg: outs "GETCOORDS - va90 is"
* dbg: outv va90
* dbg: outs "GETCOORDS - va91 is"
* dbg: outv va91

retn


endm


 
Allekha

Allekha


 visit Allekha's website: Hello, Robotto blog
  10/26/2016

Strange - I tried copy/pasting your code into CAOS tool, took out the gsub lines to the teleA/teleB subroutines, and injected it - it injected fine, no errors. And I think 'unresolved label' means 'you referenced a subroutine that doesn't exist', but that clearly isn't the case here.
 
raimian

raimian



  12/22/2016

here is the files for the test build that has a bug;

decompiled files; https://1drv.ms/f/s!ArcnTbTRlhorga1SqnBn60F_8mb57g

compiled test agent; https://1drv.ms/u/s!ArcnTbTRlhorga1UseGGvtOIREnIuw


could someone test and debug for me please??
ive probly made a simple error somewhere

 
raimian

raimian



  12/29/2016

the error I'm getting on injection is;
script 12 2 5655 9 unresolved label "getcoords" at token " ... f targ ne null gsub @ getcoords doif lmvt va90 va91 ...

 


downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
0 online
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki