UOGamers Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • To obtain new Razor updates, please reinstall Razor from our new website.

UOSteam conditions question

Sevenz

Wanderer
I have a mining script I modified from the very nice one @MB posted (http://www.uogamers.com/community/index.php?threads/564098/) and bits and parts I found elsewhere. It is working great for me, but this one little error checking issue is bothering me. Hopefully someone can shed light on it.

This script assumes the following:
  • Using magery
  • No pet
  • Tools are already made

Line 57 works correctly even though it looks like the syntax coloring has issues with it.


However if I add in the third condition the script fails:


Does anyone see something syntax-wise I'm missing there? Or maybe you can't have more than one 'or' in a statement in UOSteam?

Full code below for reference (don't laugh, I'm new at using this!)
Code:
if not @findobject 'Toolbox'
  promptalias 'Toolbox'
endif
if not @findobject 'Home'
  promptalias 'Home'
endif
if not @findobject 'OreBookOne'
  promptalias 'OreBookOne'
endif
if not @findobject 'OreBookTwo'
  promptalias 'OreBookTwo'
endif
if not @findobject 'OreBookThree'
  promptalias 'OreBookThree'
endif
if not listexists 'OreBook'
  createlist 'OreBook'
  pushlist 'OreBook' 'OreBookOne'
  pushlist 'OreBook' 'OreBookTwo'
  pushlist 'OreBook' 'OreBookThree'
endif
if not listexists 'Runes'
  createlist 'Runes'
  pushlist 'Runes' 5
  pushlist 'Runes' 11
  pushlist 'Runes' 17
  pushlist 'Runes' 23
  pushlist 'Runes' 29
  pushlist 'Runes' 35
  pushlist 'Runes' 41
  pushlist 'Runes' 47
  pushlist 'Runes' 53
  pushlist 'Runes' 59
  pushlist 'Runes' 65
  pushlist 'Runes' 71
  pushlist 'Runes' 77
  pushlist 'Runes' 83
  pushlist 'Runes' 89
  pushlist 'Runes' 95
endif
//run through each rune on each runebook
For 0 to 'OreBook'
For 0 to 'Runes'
pause 500
clearjournal
pause 500
useobject OreBook[]
waitforgump 0x554b87f3 5000
replygump 0x554b87f3 Runes[]
//tells you which rune you are on, see runelist above
sysmsg 'Rune' 33
sysmsg Runes[] 33
pause 2000
//set starting facing direction
turn 'North'
while not @injournal 'no metal here'
  if @injournal "You can't mine there" or @injournal "You can't mine that"
    //east
    if direction == 0
      turn 'east'
      clearjournal
      pause 500
      //south
    elseif direction == 2
      turn 'south'
      clearjournal
      pause 500
      //west
    elseif direction == 4
      turn 'west'
      clearjournal
      pause 500
      //north
    elseif direction == 6
      turn 'north'
      clearjournal
      pause 500
    endif
  endif
  pause 200
  //use pickaxe or shovel to tile you are facing until specified weight is reached or we run out of ore or have no tool
  pause 300
  //shovel 0xf39, pickaxe 0xe86
  if not @findobject 'tool'
    if @findtype 0xf39 2419 'any' 'backpack'
      @setalias 'tool' 'found'
    elseif @findtype 0xf39 'any' 'backpack'
      @setalias 'tool' 'found'
    elseif @findtype 0xe86 2419'any' 'backpack'
      @setalias 'tool' 'found'
    elseif @findtype 0xe86 'any' 'backpack'
      @setalias 'tool' 'found'
    else
      headmsg "No tools in backpack" "33"
      @unsetalias 'tool'
      pause 1000
      //Go home to get more tools
      useobject 'Home'
      waitforgump 0x554b87f3 5000
      replygump 0x554b87f3 5
      pause 2500
      useobject 'toolbox'
      pause 2000
      if @findtype 0xf39 2419 'toolbox' 'any'
        movetype 0xf39 'toolbox' 'backpack' 0 0 0 2419 1
        pause 1000
        @setalias 'tool' 'found'
      elseif @findtype 0xf39 0 'toolbox' 'any'
        movetype 0xf39 'toolbox' 'backpack' 0 0 0 0 1
        @setalias 'tool' 'found'
      elseif @findtype 0xe86 2419 'toolbox' 'any'
        movetype 0xe86 'toolbox' 'backpack' 0 0 0 2419 1
        @setalias 'tool' 'found'
      elseif @findtype 0xe86 0 'toolbox' 'any'
        movetype 0xe86 'toolbox' 'backpack' 0 0 0 0 1
        @setalias 'tool' 'found'
      else
        headmsg "No tools in toolbox" "33"
        sysmsg "Make more tools" "33"
        @unsetalias 'tool'
        stop
      endif
      pause 600
      //recall back to where you were
      useobject OreBook[]
      waitforgump 0x554b87f3 5000
      replygump 0x554b87f3 Runes[]
      pause 2000
    endif
  else
    useobject 'tool'
    waitfortarget '5000'
    targettilerelative 'self' 1 'false'
    pause 600
    @unsetalias 'tool'
  endif
  // once weight is reached go home, if getting overweight, raise it
  if diffweight < 30
    useobject 'Home'
    waitforgump 0x554b87f3 5000
    replygump 0x554b87f3 5
    pause 2500
    // organizer to put up ore
    organizer 'Ore'
    pause 8000
    //recall back to where you were
    useobject OreBook[]
    waitforgump 0x554b87f3 5000
    replygump 0x554b87f3 Runes[]
    pause 2000
  endif
endwhile
endfor
endfor
//recall home at end
useobject 'Home'
waitforgump 0x554b87f3 5000
replygump 0x554b87f3 5
pause 2000
//put everything away
organizer 'Ore'
pause 8000
 

MB

Knight
UOS is limited to two conditionals on a line. To add a third, you have to next another line. This is trickier with OR conditions because you have to repeat all the code compared to AND.

If @injournal "you can't mine there" or "you can't mine that"
Code
Endif
If @injournal 'cannot be seen'
Code
Endif

Whereas 3 ANDs would be

if @injournal 'cat' and 'dog'
If @injournal "goat'
Code
Endif
Endif

Luckily for you, you can just combine your first two statements into one by shortening to "you can't mine"
 

Sevenz

Wanderer
Thanks MB, that worked a treat! I appreciate you listing the examples also for future reference. +1 for Ilya video.
 
Top