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: 612
Joined: Wed Jan 25, 2006 2:30 am
Contact:

Functions, Variables and Passing Information

Post by Austin » Mon Aug 01, 2011 10:57 pm

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.
-Austin

mccomb
New User
Posts: 6
Joined: Sun Jul 17, 2011 12:54 am
Location: North Carolina
Contact:

Re: Functions, Variables and Passing Information

Post by mccomb » Mon Aug 01, 2011 11:11 pm

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: 333
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy
Contact:

Re: Functions, Variables and Passing Information

Post by xeon » Wed Aug 03, 2011 9:57 am

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.

:)
Scripter Xeon | Zulu Hotel Italia 7th Age | www.zhi.it
Image

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

Re: Functions, Variables and Passing Information

Post by Austin » Wed Aug 03, 2011 10:39 am

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.
-Austin

xeon
Forum Regular
Posts: 333
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy
Contact:

Re: Functions, Variables and Passing Information

Post by xeon » Thu Aug 04, 2011 12:18 am

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 :)
Scripter Xeon | Zulu Hotel Italia 7th Age | www.zhi.it
Image

Yukiko
Distro Developer
Posts: 2487
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Functions, Variables and Passing Information

Post by Yukiko » Sat Aug 06, 2011 10:29 pm

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.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

User avatar
CWO
POL Expert
Posts: 1140
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA
Contact:

Re: Functions, Variables and Passing Information

Post by CWO » Tue Aug 09, 2011 9:18 am

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 » Sat Apr 09, 2016 1:04 am

thanks

Post Reply