Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Search and teleport (theory)

  1. #11
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Quote Originally Posted by Maniac View Post
    Considering that hes been invisible half the time I doubt you actually know how much he is actually on..
    Well he changed his contact info and added different interests XD

    Oh and, I might be able to do this by myself, I've just never really spent any time on it XD
    It's actually quite simple, kinda

    Divide by 16, for each time it has 16, add 2000 to the y coordinate, then add remainder multiplied by 0x2000 to the x coordinate

    Then, also, since there 4 of these "blocks" on each row, do another check to divide by those blocks, etc

  2. #12
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Okay Here's what I found

    Code:
    Set a register for your x and y coordinates (make it start off as 20FD7 for each of them)
    When you do a search for the item, set a register to #0, then each time the search loops, you add 1 to the value in that register
    
    when it detects the item...
    
    first 
    
    divide by 1024? (total item slots for the first row of acres)
    
    multiply the answer by #0x2000 then by #16 and add that to the y coordinates
    
    then divide by 256, number of "blocks" 
    multiply that by #0x2000 and add that to the x coordinates
    
    
    then with the remainder, divide that by #16, multiply the answer by #0x2000 and add that to the y coordinates
    
    and with the remainder of that, multiply by #0x2000 and add that to the x coordinates
    That should work, although there might be an easier way
    But that would work for sure.

    Tell me if you see anything wrong with this source. I haven't tested it yet but it should work

    Code:
    FAIL source XD
    Edit: When I try that code, it works the opposite of how I want it XD well, not exactly opposite

    If the item is to the right on the left side of an acre, it teleports me instead to the right on the left side of the acre (like, the opposite side of town)

    By the way it works in a few places, like it takes me directly on top of the item

    But for others, it puts me on the exact opposite side of town, like
    I type in the hex for a Museum, and it acts like a mirror, it puts me in the exact opposite side of town as my Museum

  3. #13
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Got it working

    Source (text activated version, znxxxx)
    Code:
    ldrh r5,Activator
    ldrh r4,Done
    
    @convert to thumb
    add r2,pc,#1
    bx r2
    .thumb
    
    @[Text to Item] = r5
    ldr r1, text
    
    ldrh r2,[r1]
    cmp r2,r5
    bne End
    strh r4,[r1]
    add r1,#2
    mov r5,#0x0
    mov r0,#0xC
    mov r2,#0xF
    loop:
    ldrb r3,[r1]
    add r1,#1
    cmp r3,#0x3A
    blt number
    add r3,#9
    number:
    and r3,r2
    lsl r3,r0
    add r5,r3
    sub r0,#0x4 
    bpl loop
    
    @[Item Address] = r2
    ldr r2, Map 
    ldr r4, =0x10
    lsl r4, #0x8
    sub r4, #0x1 
    maploop:
    ldrh r3, [r2] 
    cmp r3, r5 
    beq Move
    notreplace: 
    add r2, #0x2 @add 2 to the map address, thus going to the next spot
    sub r4, #0x1 @subtract 1 from r5, this is howmany times the loop repeats
    bpl maploop 
    b End
    
    @[Calculations..]
    Move:
    ldr r1,Corner@r1 X coordinate
    ldr r5,Corner@r5 Y coordinate
    ldr r3, Map
    sub r2, r3
    mov r3,#0x20
    lsl r3,#8
    lsr r2,#1
    mov r4,#2
    lsl r4,#7
    mov r0,#0
    
    @Box Number
    Div1:
    cmp r2,r4
    blt Add1
    sub r2,r4
    add r0,#1
    b Div1
    
    Add1:
    mov r4,r0
    mov r0,#0
    
    @Row number
    Div2:
    cmp r4,#4
    blt Next
    sub r4,#4
    add r0,#1
    b Div2
    
    Next:
    @r0 holds row number
    @r4 holds box number
    @r2 holds slot number
    
    mul r0,r3
    lsl r0, #4
    add r5,r0
    mul r4,r3
    lsl r4,#4
    add r1,r4
    
    mov r0,#0
    
    Div3:
    cmp r2,#16
    blt Finish
    sub r2,#16
    add r0,#1
    b Div3
    
    Finish:
    mul r0,r3
    add r5,r0
    
    mul r2,r3
    add r1,r2
    
    
    ldr r0,Pointer
    ldr r0,[r0]
    ldrh r2,=0x548
    sub r0,r2
    str r1,[r0]
    str r5,[r0,#8]
    End:
    bx lr
    
    .arm
    Map:
    .long 0x021E3124
    text:
    .long 0x022AF136
    Pointer:
    .long 0x21C6DEC
    Corner:
    .long 0x00020FD7
    Activator:
    .ascii "zn"
    Done:
    .ascii "$$"
    Compiled code (1.0)
    Code:
    023FF090 012FFF11
    E0000000 000000C0
    E1DF5BB0 E1DF4ABE
    E28F2001 E12FFF12
    880A4926 D14542AA
    3102800C 200C2500
    780B220F 2B3A3101
    3309DB00 40834013
    380418ED 4A1CD5F5
    02242410 88133C01
    D00342AB 3C013202
    E02BD5F9 4D194919
    1AD24B15 021B2320
    24020852 200001E4
    DB0242A2 30011B12
    1C04E7FA 2C042000
    3C04DB02 E7FA3001
    01004358 435C182D
    19090124 2A102000
    3A10DB02 E7FA3001
    182D4358 1889435A
    68004805 1A804A07
    60856001 00004770
    021E3124 022AF136
    021C6DEC 00020FD7
    24246E7A 00000548
    023FF090 E3520003

  4. #14
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Just want everyone to know, I used parts of Toenailed's RTWE in this.



    I'm thinking of making a new "Search/teleport" code except for 2 differences

    one, I use all my own coding, and two, it doesn't teleport you to the item, it slowly drags your character toward the item (I dunno I just think that's fun XD)

    First it'll search, store the item's coordinates in free memory, set a byte to a 1,
    then the code will load your coordinates, check what they are in relation to the items coordinates, then start "correcting" them slowly (like, adding #0x20 to the x coordinates until they're equal to the item's and setting the byte to 2, then adding #0x20 to the y coordinates until they're equal to the item's and resetting the byte to 0)
    I can also make it so you can activate it with one button press (not having to hold) and then deactivate it if you want at any time with a different button combo


    Once I get that working, I'll make it change the direction your player is facing to the direction he/she is sliding
    Code:
    Address at pointer minus #0x516 is direction player is facing
    
    0000 is down
    4000 is right
    8000 is up
    C000 is left
    (I found that myself)

  5. #15

    Default

    and north west say?

    Remember to always click the thanks button of those who help you! It makes them feel wanted:

  6. #16
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Quote Originally Posted by Area51_Hacker2 View Post
    and north west say?
    In between those

  7. #17
    J.P. (Global Moderator) Maniac's Avatar
    Join Date
    Sep 2007
    Location
    Ohio, USA
    Posts
    2,083
    Blog Entries
    5

    Default

    .... I can guess what number it is..but anywho. Make sure if you slowly change it that you do greater then or equal to.. Not just equal to

    Say what you mean, mean what you say, and let your actions speak for you.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •