ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: TrailMyx on December 30, 2008, 11:53:37 AM
-
I answered your question in the chat box @ WinUO regarding booleans, but I got yapping and ate the response:
It returns EUOs implementation of a boolean. #FALSE = 0 and #TRUE = -1
So your example "if ! #RESULT" would be true
I hate the chatbox for this reason. Good information gets forgotten.
-
I second that about the chat box trailmyx. I always look at it but only ever can find 1/4 of the good info then it is like puzzle tryign to put back together everything.
-
I just caught it but thanks for this follow-up here as well!
After seeing your response I figured out what I was doing wrong and had to laugh. Here's an example, see how quickly you figure it out. It is looking for a mapmakers pen in the pack, if none found it gosubs to a restock sub, if no pens are found in the resource container it returns #FALSE, if it returns #FALSE it should display a message and halt. The message and halt wouldn't display:
gosub restock Pens
if ! #RESULT
display message and halt
else
return to main loop
sub restock
find pens
if not found
return #FALSE
else restock pens
return
How quickly can you find my stupid mistake lol?
XII
-
I can't see it. Does it come through in your psudocode?
-
sub
restock
is this it 12x?
-
Wait, my example is fine isn't it? Ok now I'm confused but I can't find the version I fixed. I'll see if I can break it again and repost the actual script instead of my pseudoscript hehe.
Here is the actual code that wasn't working correctly, note that this is still WiP code:
;################################################
; SUB MAKEMAP
;################################################
sub MakeMap
repeat
{
finditem !BlankScrollTypes C_ , #BackPackID
if #findkind = -1
{
gosub Restock !BlankScrollTypes !Secure !ScrollAmount
if ! #RESULT
{
Display You seem to be out of scrolls. Please restock and start again. Script Halting!
halt
}
}
finditem !PenTypes C_ , #BackPackID
if #findkind = -1
{
gosub Restock !PenTypes !Secure 1
if ! #RESULT
{
Display You seem to be out of Mapmaker Pens. Please restock and start again. Script Halting!
halt
}
}
finditem !PenTypes C_ , #backpackid
set #lobjectid #findid
event macro 17
wait !sWait
gosub ClickNWait 28 91 #TRUE
if %CurrentMap = LocalMap
gosub ClickNWait 235 70 #TRUE
if %CurrentMap = CityMap
gosub ClickNWait 235 90 #TRUE
if %CurrentMap = SeaChart
gosub ClickNWait 235 110 #TRUE
if %CurrentMap = WorldMap
gosub ClickNWait 235 130 #TRUE
if %CurrentMap = WallMapSouth
gosub ClickAndWait 235 150 #TRUE
if %CurrentMap = WallMapEast
gosub ClickAndWait 235 170 #TRUE
finditem !MapTypes C_ , #backpackid
wait !sWait
}
until #findkind <> -1
return
;################################################
; SUB RESTOCK
;################################################
; %1 ItemType to restock
; %2 Container to restock from
; %3 Number of items to take
sub Restock
set %Item2Stock %1
set %Container %2
set %Amount2Stock %3
finditem %Item2Stock C_ , %Container
if #findkind = -1
Return #FALSE
if #findstack < %Amount2Stock
set %Amount2Stock #findstack
exevent drag #findid %Amount2Stock
wait !sWait
exevent dropc #backpackid
wait !sWait
return
This code should be fine, right? However, I was actually running through without displaying "Out of mapmaker pens" when the return from the restock sub was #FALSE until I changed the line "IF ! #RESULT" to "IF #RESULT = #FALSE" but these two lines should mean the exact same thing, correct? I must have missed something else.
X