Script Syntax

Pygar

EQ2Bot Specialist
Feel like a noob asking this but not having much luck getting this syntax right.

I have a function that does some stuff and has several return codes (success, error1, error2, error3). I want to call this then run a switch/case on the results if it returns anything other than success.
Code:
Call myfunction var1 var2

If myfunction.return.value != success
{
     switch myfuntion.return.value
          {
                case error1
                       do some stuff
                       break
                case error2
                       do some other stuff
                       break
           }
}
So whats the proper syntax for above 'metacode'? I'm sure I've missed something simple in my attempts to get this working.

I know there's an arguement of just have the function call something else on the error and try to get to a return success, but there are some conditional differences that makes me want to evaluate it this way.

Thanks.
 

Karye

Active Member
Code:
Call myfunction var1 var2

     switch ${Return}
          {
                case error1
                       do some stuff
                       break
                case error2
                       do some other stuff
                       break
                case success
                       break
                case Default
                       break
           }
 

Pygar

EQ2Bot Specialist
Can I specify the return of a specific function, or can I only access the return of the most recent one?

And thanks for the assistance.
 

Mandrake

Active Member
Using standard functions, as far as i know you are indeed limited to just the most recent ${return}

However, make that a member of an object, and you can access speciffic instances of specific functions (if that makes sense in the grand scheme of your script)
 

Pygar

EQ2Bot Specialist
Roger that.

Still working thru exactly how I want to approach the problem I'm trying to script. Understanding the environment better obviously helps me identify possible solutions.

Thanks
 
Top Bottom