It is currently Sat May 25, 2013 6:26 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [Solved] How do I write this Event Loop conditional?
PostPosted: Tue Mar 13, 2012 5:06 pm 
Offline
Addict
Addict

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
Hi,

I've spent the better part of an hour trying and testing various things to do what I want to accomplish, and I finally got close by moving things into the Event Loop, and then trying to have it done under 1 single Case..

I need to check for events on 4 different StringGadgets, and I don't want to duplicate code... I have gotten pretty far I think. but I can't get any farther than getting Case to compare 2 values.. it won't accept more than that..

The actual concatenation is not the final formula I want to use, but just keeping it simple for testing purposes.. The goal is for it to check 4 different input forms for changed data, then when it fires that event, it will pull data from all the fields and concatenate them into the final value (I will insert some delimiter characters later on).

Right now it will only work up to Input_Area and Input_RoomX - anything beyond that does not work.. I've written and rewritten this several times and can't seem to engineer a way to properly check them all.. Am I just stupid or is it not possible?

Code:
Case #PB_Event_Gadget
      Select EventGadget()
        Case Input_Area|Input_RoomX|Input_RoomY|Input_RoomZ
          Select EventType()
            Case #PB_EventType_Change
              tmp_Area  = GetGadgetText (Input_Area)
              tmp_RoomX = GetGadgetText (Input_RoomX)
              tmp_RoomY = GetGadgetText (Input_RoomY)
              tmp_RoomZ = GetGadgetText (Input_RoomZ)
             
              tmp_RoomID  = tmp_Area  +   tmp_RoomX + tmp_RoomY + tmp_RoomZ
              SetGadgetText(Input_RoomID, tmp_RoomID)
          EndSelect
      EndSelect

_________________
Image


Last edited by Zach on Tue Mar 13, 2012 10:13 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: How do I write this Event Loop conditional?
PostPosted: Tue Mar 13, 2012 5:20 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 09, 2011 7:57 am
Posts: 276
replace Case Input_Area|Input_RoomX|Input_RoomY|Input_RoomZ with
Case Input_Area, Input_RoomX, Input_RoomY, Input_RoomZ

_________________
http://www.mediafire.com/pbstuff


Top
 Profile  
 
 Post subject: Re: How do I write this Event Loop conditional?
PostPosted: Tue Mar 13, 2012 5:22 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
What if you write the case as only Input_RoomY,Input_RoomZ. Does that work? If not, then the issue is probably elsewhere in your code. It is hard to see what you are doing because the snippet does not standalone.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: How do I write this Event Loop conditional?
PostPosted: Tue Mar 13, 2012 5:25 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jul 25, 2005 3:51 pm
Posts: 2401
Location: Utah, USA
Something like this:
Code:
Case #PB_Event_Gadget
  Select EventGadget()
    Case Input_Area, Input_RoomX, Input_RoomY, Input_RoomZ
      Select EventType()
        Case #PB_EventType_Change
          tmp_Area  = GetGadgetText (Input_Area)
          tmp_RoomX = GetGadgetText (Input_RoomX)
          tmp_RoomY = GetGadgetText (Input_RoomY)
          tmp_RoomZ = GetGadgetText (Input_RoomZ)
         
          tmp_RoomID  = tmp_Area  +   tmp_RoomX + tmp_RoomY + tmp_RoomZ
          SetGadgetText(Input_RoomID, tmp_RoomID)
      EndSelect
  EndSelect


@Edit: I mustn't stop to breathe, came in 3rd ... :)

_________________
Image


Top
 Profile  
 
 Post subject: Re: How do I write this Event Loop conditional?
PostPosted: Tue Mar 13, 2012 10:12 pm 
Offline
Addict
Addict

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
Thanks guys that did the trick!

I didn't even think to try commas, or even know we could do that :oops:

Sorry the snippet didn't stand alone, I was kind of assuming the problem was my syntax and not the code itself... 8)

Hopefully I can get the delimiters inserted without crawling back to this post on my knees :P

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye