Gamemode to Filterscript, Class?
#1

Ok a while ago I realised that pretty much filterscript are independent from the gamemode, unless the function(s) created a publicly declared.

It is still just speculation, but think about it.

Filterscripts are just like classes.

For those who do not know what classes are:
http://en.wikipedia.org/wiki/Class_%...ter_science%29
Although, someone once told me that class functions are different when you call them outside that class.
The place where the function is called simply wants the result and without knowing how it got there.
The function runs in a class and returns a specified value.

A story to unfold the mystery:
Imagine you have 2 rooms.
1 room is a (filterscript) class, the other room is the gamemode calling a filterscript function
The person in charge of gamemode-room asks for the answer on a question asked. ( Let's say a command, /kick ).
The boss of gamemode-room asks for the answer, not how it is done.
Meanwhile, in class-room, the person in charge there is working his ass off getting the function done in time. However, since there is no interference from the gamemode or any other class, this class-room can work much faster because of the variables that are not necessary do get skipped or whatsoever. ( if not, you would be able to use variables and functions without calling remote function). Back on track, the routine job ( function ) is done, and now returns the result.

To make this story more understandable for some of you, imagine that what you asked is a hand crafted star made out of wood.
Imagine you the boss of the gamemode-room. You do not care about what technique and such is behind the crafting of the star. You only want that star.

However, as the boss of gamemode-room, you want to make sure everything your employees do that they do it the correct way. In other words, you need to pay constant attention to your employees.

This is just speculation, but it makes sense to me.
Am I just plainly wrong, or could there be at least a littlebit of truth in here.
If wrong, tell me where and why?

Other than that, why does sa-mp not support "real" classes? Or rather, why doesn't Pawn(o) support classes?

Peace

PS: What does the fact that kye didn't made pawn has to do with the question I asked?
I am just saying. Besides that, you didn't really answered my question.
Reply
#2

Quote:

Pawno

Pawno is the name of a pawn-orient editor, congratulations. The language is actually called "pawn."

As for your question, Kye didn't make pawn. Which is why classes aren't supported, kind of.
Reply
#3

you must be very not paying attention here..

As far I know , filterscripts are like classes (Like the the working or use of it).
Correct me if I'm wrong. So filterscripts could use global functions? Never tested it ,though, but it seems logical to me.

The real question is : Why are the actual CLASSES not supported in pawno ? :P
However..nobody can answer that here, I guess
Reply
#4

Quote:
Originally Posted by Roytjuh
you must be very not paying attention here..

As far I know , filterscripts are like classes (Like the the working or use of it).
Correct me if I'm wrong. So filterscripts could use global functions? Never tested it ,though, but it seems logical to me.

The real question is : Why are the actual CLASSES not supported in pawno ? :P
However..nobody can answer that here, I guess
1) Pawno is not a language, PAWN is. SA:MP has nothing to do with development of Pawn. I won't repeat myself as that's just stupid if you don't understand it the first time.

2) Filterscripts can use global functions (callbacks, etc), yes.
Reply
#5

-
Reply
#6

yet not answered the question, I guess I won't repeat myself either since it's just stupid you didn't understood me the first time.
and yes, filterscripts can call global or public functions. However the question is whether the system checks the progress itself for errors or not. In a main stream it is obvious it does, but inside a class or another filterscript, I never read anything about the results of such test.

I guess to test it, you could create a loop that loops out of the extend of an array. In normal order in main stream, it would return invalid because the variable cannot reach higher than loop value. Thus generating a return zero effect.

Calling it remotely and simply not caring as a class of how the result is made, just a result will be made the command should get a return value of zero as the returned value. ( Or whatever the value is of an invalid code ) but not closing down the command as if it was in the main stream. in other words, if you create command that remotely calls for a loop that oversizes an array, it still should be able to return another value then "invalid". If not, the theory of class is completely off the hook.

In that case, I don't see any usefullness of filterscript except the portability.
I will test this, I will post the results of it later on.
Reply
#7

The results of the test:

The test was: Like a class, does the function calling the other function care what happens inside the called function, regardless of what value is passed backwards?

I found out that this is the case. Therefore, calling functions using calllocalfunction is more efficient and holds back unwanted function shutdowns.

This also means that public functions get called like they are classes. Therefore, the concept of classes exists inside of Pawn. Sadly, the actual code for real classes is not there.

Regardless, I recommend people work in filterscripts regardless the possibility of calling local functions.
The reason behind it is pure reasoning.

Calling functions inside a filterscript makes it more efficient:
This is why:
a script has it's own memory section assigned. therefore, it cannot go out of it's own space. but this also means that finding a variable or function takes less time thus computer power since it only searches its own territory.
Despite the fact that CallRemoteFunction is needed to call these functions, and that ALL public functions with that function name are called, it still is faster.

My recommendation is that small codes should be called as localfunction and placed in the gamemode itself.
While large codes should be called remotely inside a filterscript.

You could call it specializing?
Anyone has anything to say?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)