Functions, Variables and Passing Information

Sometimes you need to share your knowledge. This is where you can do it. A place for POL and Script guides.
Post Reply
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Functions, Variables and Passing Information

Post by Austin »

I think this largely touches on most of it: http://docs.polserver.com/pol099/guides ... criptguide
But maybe with questions, we can refine it and make a bigger tutorial. Starting with runecl.exe rather than POL to get into how a lot of concepts work.


I was discussing with someone in #POL tonight who was having an error in his script.
You can test this in runecl.exe

Code: Select all

Program SomeScript()
... some code
var info_a := 20;
var info_b := 40;
var info_c := 20;

var result := Bravo(info_a, info_c);

endfunction

function Bravo(something_n, something_y)
.... some code
if ( something_n == something_y )
     return 1;
else
     return 0;
endif
endfunction
Alpha is sending the variables info_a and info_c to function Bravo.
Once Alpha has stepped into Bravo, the variables will be identified as something_n and something_y - The name is not important, the order of calling Bravo is.
Since info_a and info_b both contain 20, Bravo will return the value 1 to Alpha and result will then contain 1.
mccomb
New User
Posts: 7
Joined: Sun Jul 17, 2011 12:54 am
Location: North Carolina

Re: Functions, Variables and Passing Information

Post by mccomb »

thats a big help to me for sure austin.....been dealing with issues like that as a new scriptor...i needed it put in a way that made sense.....thanks a million for that
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: Functions, Variables and Passing Information

Post by xeon »

Clear as always Austin, but I think that this kind of explanation is more a "programming basic" than a "scripting guide". Me, I would like to see more scripting tips in the tutorial, not programming basics.

:)
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Re: Functions, Variables and Passing Information

Post by Austin »

xeon wrote:Clear as always Austin, but I think that this kind of explanation is more a "programming basic" than a "scripting guide". Me, I would like to see more scripting tips in the tutorial, not programming basics.

:)
Certainly, any questions or areas you wanna see explained ? That would help me focus on what to write about.
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: Functions, Variables and Passing Information

Post by xeon »

Well, here are some of the topics which I had to deepen excavating on the forums, and which I think would be worth including in the scripting guide:

- use of the Error implicit variable & type
- the runaway handling best practices, when you have to do lots of cycles and you don't want to kill your POL using no_runaway
- how to debug a problem when POL crashes (I'm still on 096, bear me)

Now I'm at work and can't open my shard forum, there I've saved many posts for my scripters colleagues :)
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Functions, Variables and Passing Information

Post by Yukiko »

Austin,

I have some "tutorial" like posts made by Marillo. I think he was eventually banned for other reasons but his tutorials were very informative. I'll PM them to you as soon as I finish this post. You might find them useful. I've collected snippets of good advice along the years from others too. I'll send them along. I don't know if this is stuff you need/want but it might have some value.
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Functions, Variables and Passing Information

Post by CWO »

xeon, as for runaways, I posted a somewhat general performance guide http://forums.polserver.com/viewtopic.p ... way#p16432
hildolf
New User
Posts: 1
Joined: Sat Apr 09, 2016 1:00 am

Re: Functions, Variables and Passing Information

Post by hildolf »

thanks
Post Reply