Just to make it clear, :NORMAL is implied if nothing if specified, so "A" is identical to "A:NORMAL", so don't use NORMAL.
In addition to shandolums answer on question two.
@persist (as you might've understood) specifies that a value is persistent, this is done for a number of reasons, one reason is that this allows the compiler to tell you if you are using a variable that does not exist (aka misspellt) which can be very helpful.
[a possiility is that I add a "@persist all" option that makes all variables persistent (aka egate1 style), we'll see]
It is also because the compiler now needs to know the type of variables, although it can deduce types itself, the type of a variable could potentially change during the execution. So this is a way of also forcing you to specify that.
Another reason is that it is very common for people to forget to reset variables on each execution which causes previous value to persist. This makes sure that this does not happen.
Currently, you are not allowed to use variables which are not guaranteed to be initialized (or persistent), this will probably be relaxed to allow use of variables which are potentially initialized to simplify the language slightly and because it is probably very very useful/common aswell.
Code:if(...) { A = 0 } else { A = 1 } B = A // A is guaranteed to be initializedCode:if(...) { A = 0 } B = A // A is potentially initialized (currently not allowed, but probably will be)(Also, ~Variable is implemented in the latest revision)Code:B = A // A is never initialized (never allowed unless A is persistent)
Last edited by Syranide; 08-31-2008 at 06:10 PM.
there is another question:where can i found a list of the error??
because now i got
and this is my line...Code:expected symbol(rpa) near variable (Xi) at line 204
edit: I found where i can see what was the error but I'm not able to fix mine...Code:O=sqrt((Ox-Xi)^2)
thanks you for your help Syranide and shandolums
Edit(Again):is the sin function was there?most precisely asin?
and is sqrt work or no?
Last edited by taz_doh; 08-31-2008 at 07:22 PM.
VIVE LE QUEBEC
sorry if I write some non-existent words
questions. why is there no "save as" button and, is += added ? cause as soon as i try to use it i get
add: what is the shortcut to open the editor? if i right click i get thisCode:entities\gmod_wire_expression2\core/init.lua:912: attempt to call field '?' (a nil value)
Code:entities/gmod_wire_expression2/init.lua:167: attempt to concatenate global 'outputs' (a nil value)
you need to update your svn and you need to do 2click on the gate you want to edit
VIVE LE QUEBEC
sorry if I write some non-existent words
i have latest svn, but when i get the exp tool out, if youu look at the description thing it says secondary: open expression gate in editor, but when i right click all i get is that error
edit add: turns out that you cant bunch up anything with - cause i tried to do F-S and it got that error so it seams that you have to space out the - in any case this is error "entities\gmod_wire_expression2\core/init.lua:944: attempt to concatenate field '?' (a nil value)"
did you try to do double click in the menu, on the gate you want to edit?
and did you got the output/input when you spawn your gate?
Last edited by taz_doh; 08-31-2008 at 09:41 PM.
VIVE LE QUEBEC
sorry if I write some non-existent words
yea i can reopen the menu, but im saying that the secondary mouse function is missing. you should be able to reopen the editor with second mouse click but it doesn't work
add: just finished my first big exp2 code and im happy how it turned out
its a calculator that takes numbers by a 10 button keypad and then saves it to some VRAM inside the exp2 and then saves the second set of numbers AND the button for add subtract mul and divide and saves that to a different ram location "V2" for the arithmetic VRAM and then pessing EQUAL will save the final to "V3" and then display the data in "V3" and it doesent let you divide by 0 lol. ide say not too bad for just starting out about 3 hours ago :PCode:@name CALC V2 @inputs ZERO ONE TWO THREE FOUR FIVE SIX SEVEN EIGHT NINE R @inputs PLUS MINUS DIVIDE MULTIPLY EQUAL CLEAR @outputs SCREEN V V1 V2 V3 @persist V V1 V2 V3 if(ZERO){V=V*10} if(ONE){V=V*10+1} if(TWO){V=V*10+2} if(THREE){V=V*10+3} if(FOUR){V=V*10+4} if(FIVE){V=V*10+5} if(SIX){V=V*10+6} if(SEVEN){V=V*10+7} if(EIGHT){V=V*10+8} if(NINE){V=V*10+9} if(R){V=0} if(V>=9999999){V=9999999} if(PLUS){V1=V V=0 V2=1} if(MINUS){V1=V V=0 V2=2} if(DIVIDE){V1=V V=0 V2=3} if(MULTIPLY){V1=V V=0 V2=4} if(EQUAL&V2==1){SCREEN=V3=V V=V1+V}else{SCREEN=V} if(EQUAL&V2==2){SCREEN=V3=V V=V1 -V} if(EQUAL&V2==3){SCREEN=V3=V V=V1/V} if(EQUAL&V2==4){SCREEN=V3=V V=V1*V} if(EQUAL&V2==3&V3==0){CLEAR=1} if(CLEAR){V=0 V1=0 V2=0 V3=0 SCREEN=0}
You are correct, the special assignments are not implemented, I'll try to have them fixed today.
EDIT: These are now available in the latest revision, thanks!
I don't think there is a shortcut right now, but I'm not sure, shandolum knows.
Last edited by Syranide; 09-01-2008 at 03:19 AM.
As for the first, there seems to be some error in the parser, add spaces around the minus for now, it currently interprets it as something else right now for some reason. Adding spaces fixes it. (EDIT: Now fixed! There was an internal conflict that had accidentally got the same name as the subtract-rule)
Can't really understand what you are saying last, sin works, asin is there as well and sqrt should work.
EDIT: line 204 :lol:
Last edited by Syranide; 09-01-2008 at 03:13 AM.
Bookmarks