Step 2: Startup
Once you have a menu in place, you need to have a start up so that the script knows what to do and where to start.
I plan on having my scripts flow as much as possible in the same order that the script moves. This makes it easier for me to set them up and hopefully makes it easier for others wanting to learn from my scripts or adjust them to fit their needs. I know that I get frustrated looking at some scripts because I have to hop all over the script looking for things that seem to placed in there randomly. I am also willing to concede that as I progress, I may find that it is near impossible to write a script in an easy to follow order.

Here goes nothing! *dives in head first*
;===================================================================
sub setup
menu delete scriptstatus
Menu Font BGColor Black
menu Font Color Lime
menu text scriptstatus 95 100 Setting Up Script
;open backpack
Finditem * C_ , #BackpackID
event macro 8 7
wait 10 #BackpackID
contpos %backpackx %backpacky ;This will be at the top of the script set for manual adjustments
wait 20
; hiding option
chooseskill Hidi
finditem #charid
if #skill >= 200 || #findtype notin AV_XU_OCB_NCB ;Human JOAT = 20 Hiding
{
display yesno Hide while training?$
if #dispRes = yes
set %ToHide yes
if #dispRes = no
set %ToHide no
}
wait 10
; locate/open resource secure
str len %ResourceSecure
if ( N/A notin %ResourceSecure ) && ( #strres > 0 )
{
finditem %ResourceSecure
if #findkind <> -1
goto _openres
}
_selres:
display Ok Select your Resource Container.
set #targcurs 1
while #targcurs = 1
wait 10
set %ResourceSecure #ltargetid
_openres:
set #lobjectid %ResourceSecure
event macro 17 0
wait 10
contpos %resourcex %resourcey ;This will be at the top of the script set for manual adjustments
; locate/open storage secure
str len %StorageSecure
if ( N/A notin %StorageSecure ) && ( #strres > 0 )
{
finditem %StorageSecure
if #findkind <> -1
goto _openstore
}
_selstore:
display Ok Select your Storage Container.
set #targcurs 1
while #targcurs = 1
wait 10
set %StorageSecure #ltargetid
_openstore:
set #lobjectid %StorageSecure
event macro 17 0
wait 10
contpos %storex %storey ;This will be at the top of the script set for manual adjustments
; locate trash barrel
str len %Trashbarrel
if ( N/A notin %Trashbarrel ) && ( #strres > 0 )
{
finditem %Trashbarrel
if #findkind <> -1
goto _openbar
}
_selbar:
Display Ok Select the Trash Barrel.
set #targcurs 1
while #targcurs = 1
wait 10
set %Trashbarrel #ltargetID
wait 10
contpos %trashx %trashy ;This will be at the top of the script set for manual adjustment
set %initialized #true
return
;===================================================================
This is my beginning to set the containers, and hide. I looked at a lot of different codes to open containers and I made this quite a while ago. I do not remember or maybe I never knew what this one part meant and did and I am hoping someone can help me out with it. I know and understand all the other commands
str len %ResourceSecure
if ( N/A notin %ResourceSecure ) && ( #strres > 0 )
What does the
str len do? Is it just telling the script that it is going to set that?
if ( N/A notin %ResourceSecure ) does this say if there is no resource secure selcted?
&& ( #strres > 0 ) The && stands for OR correct and it says or the container is not found?
What else can you tell me about what I have? Is it good, bad, better way of doing it?
EDIT: I found that str len is to start a string and how long it will be http://wiki.easyuo.com/index.php?title=Str_(command)
I still don't quite understand that though on why it would be there for a setting and opening a secure or bag. The strres seems to help line up the string maybe?