Author Topic: Command help  (Read 6560 times)

0 Members and 1 Guest are viewing this topic.

Offline insandTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Activity:
    0%
  • Reputation Power: 1
  • insand has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Command help
« on: December 05, 2011, 07:48:58 PM »
0
Hello everyone,
I just recently got into writing my own scripts because what i need is not available anywhere, so far anyways.

I just have  a few questions about my script. There are a few commands i was not able to find, or figure out.

I would like to know how i could "open" a runebook by "name" and then pick a chosen number then use sacred journey to that location. I have searched previous scripts that use this similar style but everything jumps back and forth so many times i have no idea what's going on anymore.
( Example:
      if #weight > 400
     open book X
     sacred journey to X
     open bank
     dump ore, leather into bank )

My second question is how do i go about and completely empty my inventory, secure or chest of a chosen object (ore, wood, leather, cloth, etc...) into the bank or even into another chest for example?

Waiting anxiously to add codes to my script   :D

Offline seeriusly

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #1 on: December 05, 2011, 08:04:52 PM »
0
Luckily these have been made available for us to use.

Trailmyx's Runebook/Spellcast Subs:  http://www.scriptuo.com/index.php?topic=18.0

EN's GENERIC MOVE ITEM/S TO CONTAINER  http://www.scriptuo.com/index.php?topic=2454.15

Offline seeriusly

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #2 on: December 05, 2011, 08:35:51 PM »
0
here's more to play with

Code: [Select]

set %MAXstones 400
set %runebookid XXXXXX

sub checkweight
  if #weight > #maxweight - 50 || #weight >= %MAXstones
  gosub bankrun  ; if using TM travel subs ( gosub TM_TravelFromRunebook SJ 2 2 %runebookid  )  2 2  starting with rune 2 and ending at rune 2
return
;------------------------

sub openbank

msg bank$
    wait 20
    if #contsize = 180_240  ;<<< bank box gump size
    {
    return
    }
    else
    {
    display ok Cannot locate bank, open bank and press play
    pause
    }
    return
;-----------------------------


sub DUMPLOOT

set %dragspeed 10
set %dropbox XXXXXXX  ; box in bank to drop loot set at beginning of script
set %droploot XXX_YYY_ZZZ_  ; ID's to dump

  repeat
    finditem %droploot C_ , #backpackid
    exevent drag #findid #findstack
    wait %dragspeed
    exevent dropc %dropbox
    wait 15
  until #findkind = -1
return

Offline camotbik

  • Sr. Member
  • *
  • Posts: 349
  • Activity:
    0%
  • Reputation Power: 3
  • camotbik has no influence.
  • Gender: Male
  • Hello! I'm a UO addict.
  • Respect: +38
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #3 on: December 06, 2011, 01:45:33 PM »
0
Code: [Select]
 repeat
    finditem %droploot C_ , #backpackid
    exevent drag #findid #findstack
    wait %dragspeed
    exevent dropc %dropbox
    wait 15
  until #findkind = -1
This is wrong. What happens if finditem = x(nothing found) ? --  it drags an non existing item ( well atleast send a packet to drag it and drop it )

I would use a while loop there or something similar...

Anyway, you would want to use something like this..
Code: [Select]
set %storage QWERTY
set %stuff LOOT_LOOT_ZLK_POF

Mainloop:
if #weight > ( #maxweight - 50 )
{
  gosub Recall_from_named_book ORE 1 r 5 ; Recalling to home
  gosub unload
  gosub Recall_from_named_book ORE 2 r 5 ; Recalling back to cave
}
goto Mainloop

; gosub travel_named_book ore number r(for recal)/c(for sacred) retries
Sub Recall_from_named_book
  finditem MPF C_ , #backpackid
  for #FINDINDEX 1 #FINDCNT
  {
    event property #FINDID
    if %1 in #PROPERTY
    {
      gosub recall #findid %2 %3 %4
      return
    }
  }
  display your named book was not found.
  stop
return

Sub Unload
  finditem %stuff C_ , #backpackid
  for #FINDINDEX 1 #FINDCNT
  {
    exevent drag #findid #findstack
    exevent dropc %storage
    wait 30
  }
return

Note that this is fastly writen for freddy's recalling sub, but as it seems he has withdrawn all his scripts, including the fastest recalling sub out there.. If you ask freddy he may still give it to you.
« Last Edit: December 06, 2011, 01:52:56 PM by camotbik »
What you witness -- is whatver..
uogamers hybrid.

Offline insandTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Activity:
    0%
  • Reputation Power: 1
  • insand has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #4 on: December 06, 2011, 03:09:33 PM »
0
Excellent i will try these out and see what i can come up with. So far i checked out TM's recalling and there's way too much stuff in there. I was hoping for something plain and simple. My success chance will be 100% so i do not need failure retries.

Let you know how i do.

Offline insandTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Activity:
    0%
  • Reputation Power: 1
  • insand has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #5 on: December 08, 2011, 04:35:15 PM »
0
I am still trying to figure out how to use the recall sub from TM --> http://www.scriptuo.com/index.php?topic=18.0

I'm hoping I know how to use the actual recall sub, i chose the TM_TravelFromNamedRunebook

and i would write this as:

gosub TM_TravelFromNamedRunebook SJ 1 1 BOOKONE ( use book named BOOKONE, choose rune range from 1 to 1, using sacred journey )

I assume that for this particular gosub, it does not require the declaration of a sub in the "SUBS" section

The last part im not sure how to do, which is to add the following:

;   gosub TM_AddUnderscore #CHARNAME
;   set %charname #RESULT

Somewhere in the script. I'm also not sure how to edit this line, and or, if it even requires modification.

So far when i push the play button nothing happens, lol

I'm curious to know how to get this to work in a very, very small script. I need to see this work in the form of "push play, execute recall, finished" before attempting to include it into any other scripting.
« Last Edit: December 08, 2011, 04:38:33 PM by insand »

Offline seeriusly

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #6 on: December 08, 2011, 06:57:30 PM »
0

Offline insandTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Activity:
    0%
  • Reputation Power: 1
  • insand has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #7 on: December 08, 2011, 08:19:15 PM »
0
Yea not so helpful, anybody else have any ideas?

I can't even find it in there.

I don't know much about this, so this is like giving a map to a blind person.

Is it even possible to put this recall sub into a 2-10 lines maximum? Seems you need over 200 lines to make this work...?
« Last Edit: December 08, 2011, 08:22:56 PM by insand »

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Command help
« Reply #8 on: December 09, 2011, 02:28:41 AM »
0
Yea not so helpful, anybody else have any ideas?

I can't even find it in there.

I don't know much about this, so this is like giving a map to a blind person.

Is it even possible to put this recall sub into a 2-10 lines maximum? Seems you need over 200 lines to make this work...?
Depending how good the security checks should be in your script.

Repeat until 2 lines
Get Property 1 Line
String manipulation 2-4 Lines
Gosub Call the Book 1 Line (and xxx lines behind depending on your scriptcode how you open book, checks, etc)

So without the real code behind, you can make it in 8 Lines:)

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Command help
« Reply #9 on: December 09, 2011, 04:34:53 AM »
0
Quote
I assume that for this particular gosub, it does not require the declaration of a sub in the "SUBS" section
You Assumed WRONG ...  All SUBS must be declared in the same file as you are using them in.  You can access externally declared code by use of the call command. I believe that particular piece of TMs fine code is designed for inclusion not calling.

If you want a called piece of code you can use my subs... which i just uploaded. http://www.scriptuo.com/index.php?topic=9016.0

Or as chrome mentioned above you can create your own work... but just getting the runebook id from a name will take you more than 10 lines of code.  (ps my code doesnot currently include that function).
« Last Edit: December 09, 2011, 04:38:56 AM by Endless Night »
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline seeriusly

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #10 on: December 09, 2011, 04:04:46 PM »
0
There needs to be a sub, for every time you use gosub.

So all you need to do is add TM's subs in the bottom of the script.  That lets you do " gosub TM_TravelFromNamedRunebook SJ 1 1 BOOKONE " whenever you need to in the script, using only the one line.

When you "gosub" in the top ( or whenever you use it) , it does those actions that are in the bottom.

you then add this:
 
Code: [Select]
;  gosub TM_AddUnderscore #CHARNAME
;   set %charname #RESULT
in the top of your script.
 

Offline insandTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Activity:
    0%
  • Reputation Power: 1
  • insand has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #11 on: December 09, 2011, 04:39:53 PM »
0
This is what I have:

gosub TM_AddUnderscore #CHARNAME
set %charname #RESULT

;***************************************************



repeat

if #mana > 10
wait 1
gosub TM_TravelFromNamedRunebook SJ 1 1 BOOKONE

until #CharGhost = YES
while #CharGhost = YES
  wait 1

;************************************************

; %1 method
; %2 starting index
; %3 ending index
; %4 runebook name
sub TM_TravelFromNamedRunebook
  namespace push
  namespace local TFNR
  set !method %1 SJ
  set !start_index %2 1
  set !end_index %3 1
  set !runbook_name %4 BOOKONE
  if !method notin RE_GA_SJ
  {
    namespace pop
    return #TRUE
  }
  if !start_index notin 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16
  {
    namespace pop
    return #TRUE
  }
  if !end_index notin 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16
  {
    namespace pop
    return #TRUE
  }
  locatenamedrunebook:
    finditem ZBN C_ , #BACKPACKID
    if #FINDKIND <> -1
    {
      event property #FINDID
      if !runbook_name in #PROPERTY
      {
        gosub TM_TravelFromRunebook !method !start_index !end_index #FINDID ; recall to location
      }
      else
      {
        ignoreitem #FINDID rbook
        goto locatenamedrunebook
      }
    }
    else
    {
      display ok Cannot locate specified runebook named , #SPC , !runbook_name
      stop
    }
  ignoreitem reset rbook
  namespace pop
return


For starters, i have no clue how to edit these lines, but even without edit it should still give me an error or something when i push play? I get nothing

Offline seeriusly

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #12 on: December 09, 2011, 04:59:03 PM »
0
do not edit his sub at all, you don't need to.

and add this to the bottom also:

Code: [Select]

;-------------------------------------------------------------------------------
; %1 - string to mung
sub TM_AddUnderscore
  namespace push
  namespace local AU
  set !tempstring %1
  AddUnderscore_loop1:
    str pos !tempstring #SPC
    if #STRRES <> 0
    {
      set !val #STRRES - 1
      str left !tempstring !val
      set !left #STRRES
      set !val !val + 1
      str del !tempstring 1 !val
      set !tempstring !left , _ , #STRRES
      goto AddUnderscore_loop1
    }
  set #RESULT !tempstring
  namespace pop
return #RESULT


I forgot, the addUnderscore sub is not in his travel subs you downloaded.
« Last Edit: December 09, 2011, 05:23:19 PM by seeriusly »

Offline insandTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Activity:
    0%
  • Reputation Power: 1
  • insand has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #13 on: December 09, 2011, 05:32:23 PM »
0
Ah excellent i forgot about that

Well now i'm slowly making progress. I'm up to the point where it states that it cannot find runebook named n/a.
So now i just need to figure out how to change this.

Offline seeriusly

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Command help
« Reply #14 on: December 09, 2011, 05:45:57 PM »
0
paste his sub into your script again, this time don't edit ANYTHING!  the only thing you will edit is in red...

gosub TM_TravelFromNamedRunebook SJ 1 1 BOOKONE


Code: [Select]
repeat

if #mana > 10
 gosub TM_TravelFromNamedRunebook SJ 1 1 BOOKONE

until #CharGhost = YES

you don't need the "while" stuff in there.
This script as is, will just recall to that spot, then keep trying to recall to that spot, but it will be blocked cause you are standing at that runes location. unless you die, then it will stop



Tags: