Author Topic: Boolean information for 12X  (Read 3180 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Boolean information for 12X
« on: December 30, 2008, 11:53:37 AM »
0
I answered your question in the chat box @ WinUO regarding booleans, but I got yapping and ate the response:
Quote
    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.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Masscre

  • Gran Master Jester !!
  • Scripthack
  • *
  • Posts: 4615
  • Activity:
    0%
  • Reputation Power: 55
  • Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!
  • Gender: Male
  • Air Guitar Commander !!
  • Respect: +144
  • Referrals: 1
    • View Profile
Re: Boolean information for 12X
« Reply #1 on: December 30, 2008, 12:06:20 PM »
0
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.

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Boolean information for 12X
« Reply #2 on: December 30, 2008, 01:03:04 PM »
0
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:

Code: [Select]
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
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Boolean information for 12X
« Reply #3 on: December 30, 2008, 01:18:52 PM »
0
I can't see it.  Does it come through in your psudocode?
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Masscre

  • Gran Master Jester !!
  • Scripthack
  • *
  • Posts: 4615
  • Activity:
    0%
  • Reputation Power: 55
  • Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!
  • Gender: Male
  • Air Guitar Commander !!
  • Respect: +144
  • Referrals: 1
    • View Profile
Re: Boolean information for 12X
« Reply #4 on: December 30, 2008, 02:17:47 PM »
0
sub restock

is this it 12x?

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Boolean information for 12X
« Reply #5 on: December 30, 2008, 02:31:03 PM »
0
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:

Code: [Select]
;################################################
;               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
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Tags: