[codename-alex-dev-commits] src subs.txt,1.9,1.10
Brought to you by:
scriptfellow,
wza
|
From: <wz...@us...> - 2003-03-08 21:05:02
|
Update of /cvsroot/codename-alex/src
In directory sc8-pr-cvs1:/tmp/cvs-serv26344/src
Modified Files:
subs.txt
Log Message:
- fixed some credits
- _init error
- added ensureVersion and isStableRelease subs
- fixed inline coments (hopefuly)
- Rain Dog's wait sub updated
- changed wait commands into sleep commands
Note: meditate and meditateFull might be revamped to use timers like hide and waitForHide ?
Index: subs.txt
===================================================================
RCS file: /cvsroot/codename-alex/src/subs.txt,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** subs.txt 8 Mar 2003 16:15:45 -0000 1.9
--- subs.txt 8 Mar 2003 21:04:58 -0000 1.10
***************
*** 1,6 ****
;===========================================================
; Alexandria Project, a standard subs library.
! ; Copyright (C) 2001-2003 ScriptFellow, LordSiD, Rain Dog,
! ; Roadkill, Smertrios, WarLocke.
;
; This library is free software; you can redistribute it and/or
--- 1,6 ----
;===========================================================
; Alexandria Project, a standard subs library.
! ; Copyright (C) 2001-2003 Cheffe, LordSiD, Rain Dog, Roadkill,
! ; Rolo, ScriptFellow, Smertrios, the.WZA, WarLocke.
;
; This library is free software; you can redistribute it and/or
***************
*** 32,38 ****
; dispatcher stub for sub calls.
;-----------------------------------------------------------
! if %subsInitialized <> 1
{
! set %_param1Fix %1 ; _init parameters fix
set %_param2Fix %2
gosub _init
--- 32,38 ----
; dispatcher stub for sub calls.
;-----------------------------------------------------------
! if %subsInitialized <> #true
{
! set %_param1Fix %1 ; _init parameters fix
set %_param2Fix %2
gosub _init
***************
*** 102,106 ****
set %_SAMETILE 8
;---- Rain Dog's wait sub init -----------------------------
! set %_sCnt2 #sCnt2
;---- hide sub init ----------------------------------------
set %_hideCnt #sCnt2
--- 102,107 ----
set %_SAMETILE 8
;---- Rain Dog's wait sub init -----------------------------
! set %_wait_sCnt2 #sCnt2
! set %_wait_maxDelay 10 ; (unit 0.1 s)
;---- hide sub init ----------------------------------------
set %_hideCnt #sCnt2
***************
*** 109,115 ****
--- 110,124 ----
;---- Standardized delay -----------------------------------
; (might need to be adapted to match connection speed)
+ ;---- wait command (unit 50 ms) ----------------------------
set %_gumpCloseDelay 5
+ set %shortDelay 5
set %_gumpDisplayDelay 20
set %_dropDelay 20
+ ;---- sleep command (unit 1 ms) ----------------------------
+ set %_gumpCloseDelayMs 250
+ set %shortDelayMs 250
+ set %_gumpDisplayDelayMs 1000
+ set %_dropDelayMs 1000
+ ;---- #sCnt2 (unit 0.1 s) ----------------------------
set %_defaultWaitForContTimeout 100
;---- Legacy aliases ---------------------------------------
***************
*** 117,127 ****
set %_FALSE #false
set %delay %_gumpDisplayDelay
- set %shortDelay %_gumpCloseDelay
;---- Don't Move Cursor detect -----------------------------
set %dontMoveCursor #true
click 200 200 n
! wait %shortDelay
click 100 100 n
! wait %shortDelay
if #cursorX = 100 && #cursorY = 100
set %dontMoveCursor #false
--- 126,135 ----
set %_FALSE #false
set %delay %_gumpDisplayDelay
;---- Don't Move Cursor detect -----------------------------
set %dontMoveCursor #true
click 200 200 n
! sleep %shortDelayMs
click 100 100 n
! sleep %shortDelayMs
if #cursorX = 100 && #cursorY = 100
set %dontMoveCursor #false
***************
*** 135,138 ****
--- 143,173 ----
;===========================================================
+ ; Name: ensureVersion
+ ; Parameters: %1 = Major number of required version
+ ; %2 = Minor number of required version
+ ; Purpose: check if subs.txt match required version
+ ; Return: %return (#true or #false )
+ ;-----------------------------------------------------------
+ sub ensureVersion
+ if %subsVerMajor > %1 || ( %subsVerMajor = %1 && %subsVerMinor >= %2 )
+ set %return #true
+ else
+ set %return #false
+ return
+
+ ;===========================================================
+ ; Name: isStableRelease
+ ; Purpose: initialize common static variables:
+ ; %screenResX, %screenResY, %centerX, %centerY
+ ; Return: %return (#true or #false )
+ ;-----------------------------------------------------------
+ sub isStableRelease
+ if RC notIn %subsVerRevision && %subsVerRevision notIn AlphaBeta && %subsVerRevision % 2 = 1
+ set %return #true
+ else
+ set %return #false
+ return
+
+ ;===========================================================
; Name: setGameWndRes
; Parameters: %1 = UO game window width
***************
*** 193,197 ****
if %outsideScreen = #true
goto _openContextMenu
! wait %_gumpDisplayDelay
set %_newCursorX %_cursorX + 40
set %_newCursorY %_cursorY + 18
--- 228,232 ----
if %outsideScreen = #true
goto _openContextMenu
! sleep %_gumpDisplayDelayMs
set %_newCursorX %_cursorX + 40
set %_newCursorY %_cursorY + 18
***************
*** 200,210 ****
{
click %_newCursorX %_newCursorY r
! wait %_gumpDisplayDelay
gosub clickScreenPos #findX #findY 0 %3
! wait %_gumpDisplayDelay
}
set %_newCursorY %_newCursorY + %_menuItemPos
click %_newCursorX %_newCursorY
! wait %_gumpDisplayDelay
if that_is_too_far_away in #sysMsg
set %outsideScreen #true
--- 235,245 ----
{
click %_newCursorX %_newCursorY r
! sleep %_gumpDisplayDelayMs
gosub clickScreenPos #findX #findY 0 %3
! sleep %_gumpDisplayDelayMs
}
set %_newCursorY %_newCursorY + %_menuItemPos
click %_newCursorX %_newCursorY
! sleep %_gumpDisplayDelayMs
if that_is_too_far_away in #sysMsg
set %outsideScreen #true
***************
*** 222,226 ****
;-----------------------------------------------------------
; ToDo: Endless loop if vendor is unreachable (off screen, behind wall, etc)
! ; wait 4s too long?
;-----------------------------------------------------------
sub openBuy
--- 257,261 ----
;-----------------------------------------------------------
; ToDo: Endless loop if vendor is unreachable (off screen, behind wall, etc)
! ; wait 4s (sleep 4000) too long?
;-----------------------------------------------------------
sub openBuy
***************
*** 256,260 ****
; if %_dontMove = #true
}
! ; wait 4s
goto _openBuyNewStyle
}
--- 291,295 ----
; if %_dontMove = #true
}
! ; sleep 4000
goto _openBuyNewStyle
}
***************
*** 265,269 ****
{
move #findX #findY 1 60
! ; wait 2s
goto _openBuyOldStyle
}
--- 300,304 ----
{
move #findX #findY 1 60
! ; sleep 2000
goto _openBuyOldStyle
}
***************
*** 272,276 ****
else
event Macro 3 0 %_vendorName buy
! wait %_gumpDisplayDelay
if #contKind <> %shopContKind
goto _openBuyOldStyle
--- 307,311 ----
else
event Macro 3 0 %_vendorName buy
! sleep %_gumpDisplayDelayMs
if #contKind <> %shopContKind
goto _openBuyOldStyle
***************
*** 286,290 ****
;-----------------------------------------------------------
; ToDo: Endless loop if vendor is unreachable (off screen, behind wall, etc)
! ; wait 4s too long?
;-----------------------------------------------------------
sub openSell
--- 321,325 ----
;-----------------------------------------------------------
; ToDo: Endless loop if vendor is unreachable (off screen, behind wall, etc)
! ; wait 4s (sleep 4000) too long?
;-----------------------------------------------------------
sub openSell
***************
*** 319,323 ****
gosub charMoveAway
}
! ; wait 4s
goto _openSellNewStyle
}
--- 354,358 ----
gosub charMoveAway
}
! ; sleep 4000
goto _openSellNewStyle
}
***************
*** 328,332 ****
{
move #findX #findY 1 60
! ; wait 2s
goto _openSellOldStyle
}
--- 363,367 ----
{
move #findX #findY 1 60
! ; sleep 2000
goto _openSellOldStyle
}
***************
*** 335,339 ****
else
event Macro 3 0 %_vendorName sell
! wait %_gumpDisplayDelay
if #contKind <> %shopContKind
goto openbuysellstyle
--- 370,374 ----
else
event Macro 3 0 %_vendorName sell
! sleep %_gumpDisplayDelayMs
if #contKind <> %shopContKind
goto openbuysellstyle
***************
*** 418,422 ****
set %_buyAmount %2
set %_stopAfterMatch %3
! set %itemNotFound #true ; set error return values
_buyMainLoop:
set %closedUnexpectedly #true
--- 453,457 ----
set %_buyAmount %2
set %_stopAfterMatch %3
! set %itemNotFound #true ; set error return values
_buyMainLoop:
set %closedUnexpectedly #true
***************
*** 431,448 ****
return
}
! ; Did we get a match?
! if #shopItemType in %_buyItemType
{
set %itemNotFound #false
! ; double click item to get it to the shopping list
! click 260 82 d
if %dontMoveCursor = #true
{
! wait %shortDelay
click 260 82 d
! wait %shortDelay
click 260 82 d
}
! wait %shortDelay
if %_buyAmount = 0
set %_buyAmount 10000
--- 466,481 ----
return
}
! if #shopItemType in %_buyItemType ; Did we get a match?
{
set %itemNotFound #false
! click 260 82 d ; double click item to get it to the shopping list
if %dontMoveCursor = #true
{
! sleep %shortDelayMs
click 260 82 d
! sleep %shortDelayMs
click 260 82 d
}
! sleep %shortDelayMs
if %_buyAmount = 0
set %_buyAmount 10000
***************
*** 463,471 ****
return
}
- ; Scroll down
set %_oldShopCurPos #shopCurPos
_buyScrollDown:
! click 390 200
! wait %shortDelay
getShopInfo
if %_oldShopCurPos = #shopCurPos
--- 496,503 ----
return
}
set %_oldShopCurPos #shopCurPos
_buyScrollDown:
! click 390 200 ; Scroll down
! sleep %shortDelayMs
getShopInfo
if %_oldShopCurPos = #shopCurPos
***************
*** 476,485 ****
if %dontMoveCursor = #true
{
! wait %shortDelay
click 366 426
! wait %shortDelay
click 366 426
}
! wait %shortDelay
return
--- 508,517 ----
if %dontMoveCursor = #true
{
! sleep %shortDelayMs
click 366 426
! sleep %shortDelayMs
click 366 426
}
! sleep %shortDelayMs
return
***************
*** 490,494 ****
; %2 = Rune number
; %3 = bail on blocked (#true or #false )
! ; %4 = Time between tries (wait units)
; Purpose: Recalls from a runebook for your choice
; Return: %blocked (#true or #false )
--- 522,526 ----
; %2 = Rune number
; %3 = bail on blocked (#true or #false )
! ; %4 = Time between tries (unit 50 ms)
; Purpose: Recalls from a runebook for your choice
; Return: %blocked (#true or #false )
***************
*** 503,507 ****
; set %_runeNumber %2
set %_bailOnBlocked %3
! set %_time %4
set %blocked #false
set %_page ( %2 + 1 ) / 2
--- 535,539 ----
; set %_runeNumber %2
set %_bailOnBlocked %3
! set %_time %4 * 50
set %blocked #false
set %_page ( %2 + 1 ) / 2
***************
*** 519,523 ****
_recallOpenBook:
set #lObjectID %_runebookID
! ; wait %shortDelay
event Macro 17 0
gosub waitForContKindToOpen %runebookContKind %_defaultWaitForContTimeout
--- 551,555 ----
_recallOpenBook:
set #lObjectID %_runebookID
! ; sleep %shortDelayMs
event Macro 17 0
gosub waitForContKindToOpen %runebookContKind %_defaultWaitForContTimeout
***************
*** 535,539 ****
{
gosub charMoveAway
! wait %_time
goto _recallStart
}
--- 567,571 ----
{
gosub charMoveAway
! sleep %_time
goto _recallStart
}
***************
*** 576,580 ****
set #lObjectID #findID
set %_contType #findType
! ; wait %shortDelay
event Macro 17 0
gosub waitForContTypeToOpen %_contType %_defaultWaitForContTimeout
--- 608,612 ----
set #lObjectID #findID
set %_contType #findType
! ; sleep %shortDelayMs
event Macro 17 0
gosub waitForContTypeToOpen %_contType %_defaultWaitForContTimeout
***************
*** 606,610 ****
click %1 %2 r
; set #findMod %_findMod
! wait %_gumpCloseDelay
return
--- 638,642 ----
click %1 %2 r
; set #findMod %_findMod
! sleep %_gumpCloseDelayMs
return
***************
*** 703,707 ****
gosub drag %1 %4
gosub drop %_x %_y
! wait %_dropDelay
return
--- 735,739 ----
gosub drag %1 %4
gosub drop %_x %_y
! sleep %_dropDelayMs
return
***************
*** 805,809 ****
_meditate:
event Macro 13 46
! wait 280
if concentrate in #sysMsg
goto _meditate
--- 837,841 ----
_meditate:
event Macro 13 46
! sleep 14000
if concentrate in #sysMsg
goto _meditate
***************
*** 821,825 ****
_meditateFull:
event Macro 13 46
! wait 280
if focus in #sysMsg
goto _meditateFull
--- 853,857 ----
_meditateFull:
event Macro 13 46
! sleep 14000
if focus in #sysMsg
goto _meditateFull
***************
*** 867,871 ****
goto _getValueKeyLoop
_getValue:
! wait 20
set %_i 1
_getValueScan:
--- 899,903 ----
goto _getValueKeyLoop
_getValue:
! sleep 1000
set %_i 1
_getValueScan:
***************
*** 911,919 ****
sub setupBackpack
event Macro 9 7
! wait %_gumpCloseDelay
set #nextCPosX %1
set #nextCPosY %2
event Macro 8 7
! wait %_gumpDisplayDelay
set %backpackID #contID
return
--- 943,951 ----
sub setupBackpack
event Macro 9 7
! sleep %_gumpCloseDelayMs
set #nextCPosX %1
set #nextCPosY %2
event Macro 8 7
! sleep %_gumpDisplayDelayMs
set %backpackID #contID
return
***************
*** 926,935 ****
sub setupOverview
event Macro 9 8
! wait %_gumpCloseDelay
event Macro 8 8
event Macro 8 8
! wait %_gumpDisplayDelay
contPos %1 %2
! wait %_gumpDisplayDelay
return
--- 958,967 ----
sub setupOverview
event Macro 9 8
! sleep %_gumpCloseDelayMs
event Macro 8 8
event Macro 8 8
! sleep %_gumpDisplayDelayMs
contPos %1 %2
! sleep %_gumpDisplayDelayMs
return
***************
*** 943,949 ****
sub setupPaperdoll
event Macro 8 1
! wait %_gumpDisplayDelay
contPos %1 %2
! wait %_gumpDisplayDelay
return
--- 975,981 ----
sub setupPaperdoll
event Macro 8 1
! sleep %_gumpDisplayDelayMs
contPos %1 %2
! sleep %_gumpDisplayDelayMs
return
***************
*** 955,961 ****
sub setupStatusBar
event Macro 8 2
! wait %_gumpDisplayDelay
contPos %1 %2
! wait %_gumpDisplayDelay
return
--- 987,993 ----
sub setupStatusBar
event Macro 8 2
! sleep %_gumpDisplayDelayMs
contPos %1 %2
! sleep %_gumpDisplayDelayMs
return
***************
*** 975,982 ****
{
event Macro 8 2
! wait %_gumpDisplayDelay
display ok Drag your status bar to where you want it on your screen$
+ You have 3 seconds
! wait 3s
set %statusBarX #contPosX
set %statusBarY #contPosY
--- 1007,1014 ----
{
event Macro 8 2
! sleep %_gumpDisplayDelayMs
display ok Drag your status bar to where you want it on your screen$
+ You have 3 seconds
! sleep 3000
set %statusBarX #contPosX
set %statusBarY #contPosY
***************
*** 995,1001 ****
{
event Macro 8 2
! wait %_gumpDisplayDelay
contPos %1 %2
! wait %_gumpDisplayDelay
}
return
--- 1027,1033 ----
{
event Macro 8 2
! sleep %_gumpDisplayDelayMs
contPos %1 %2
! sleep %_gumpDisplayDelayMs
}
return
***************
*** 1013,1017 ****
sub _getPaperdollXY
findItem %1
! set %_paperdollX #findX % 65536 ; die bug, die!
set %_paperdollY #findY % 65536
return
--- 1045,1049 ----
sub _getPaperdollXY
findItem %1
! set %_paperdollX #findX % 65536 ; die bug, die!
set %_paperdollY #findY % 65536
return
***************
*** 1030,1034 ****
findItem %1
; set #findMod 142_225
! set %_backpackX ( #findX + 142 ) % 65536 ; die bug, die!
set %_backpackY ( #findY + 225 ) % 65536
return
--- 1062,1066 ----
findItem %1
; set #findMod 142_225
! set %_backpackX ( #findX + 142 ) % 65536 ; die bug, die!
set %_backpackY ( #findY + 225 ) % 65536
return
***************
*** 1079,1083 ****
}
else
! return ; Failed reading backpack content
}
gosub _readNumberEndingWith _items %_journal
--- 1111,1115 ----
}
else
! return ; Failed reading backpack content
}
gosub _readNumberEndingWith _items %_journal
***************
*** 1186,1190 ****
if H in #charStatus
return
! if %_hideCnt > #sCnt2 ; Fix against sub re-entry
goto _hide
if H in #charStatus
--- 1218,1222 ----
if H in #charStatus
return
! if %_hideCnt > #sCnt2 ; Fix against sub re-entry
goto _hide
if H in #charStatus
***************
*** 1206,1219 ****
; Name: wait
; Author: Rain Dog
! ; Purpose: Wait for a minimum of 1 second between calls ??
;-----------------------------------------------------------
sub wait
! set %_sCnt2 #sCnt2 - %_sCnt2
! if %_sCnt2 < 20
{
! set %_sCnt2 20 - ( %_sCnt2 * 2 )
! wait %_sCnt2
}
! set %_sCnt2 #sCnt2
return
--- 1238,1251 ----
; Name: wait
; Author: Rain Dog
! ; Purpose: Wait for a minimum of 1 second between calls
;-----------------------------------------------------------
sub wait
! set %_wait_sCnt2 #sCnt2 - %_wait_sCnt2
! if %_wait_sCnt2 < 10
{
! set %_wait_sCnt2 ( %_wait_maxDelay - %_wait_sCnt2 ) * 100
! sleep %_wait_sCnt2
}
! set %_wait_sCnt2 #sCnt2
return
***************
*** 1241,1245 ****
set %_xDist %_xDist - #findX abs
set %_yDist %_yDist - #findY abs
! set %distBetween 0 ; %_xDist = %_yDist
if %_xDist > %_yDist
set %distBetween %_xDist
--- 1273,1277 ----
set %_xDist %_xDist - #findX abs
set %_yDist %_yDist - #findY abs
! set %distBetween 0 ; %_xDist = %_yDist
if %_xDist > %_yDist
set %distBetween %_xDist
***************
*** 1311,1315 ****
if %4 = AND
{
! if %return = #false ; shortcut
return
set %return #false
--- 1343,1347 ----
if %4 = AND
{
! if %return = #false ; shortcut
return
set %return #false
***************
*** 1320,1324 ****
if %4 = OR
{
! if %return = #true ; shortcut
return
if %5 %6 %7
--- 1352,1356 ----
if %4 = OR
{
! if %return = #true ; shortcut
return
if %5 %6 %7
***************
*** 1352,1356 ****
goto _setupItemTypesStringLoop
findItem #lTargetID
! if #findType notIn %itemTypesString ; prevent dupe
set %itemTypesString %itemTypesString , _ , #findType
goto _setupItemTypesString
--- 1384,1388 ----
goto _setupItemTypesStringLoop
findItem #lTargetID
! if #findType notIn %itemTypesString ; prevent dupe
set %itemTypesString %itemTypesString , _ , #findType
goto _setupItemTypesString
|