Code snippet
								
								Sauter à la navigation
				Sauter à la recherche
				
					
								
							
		Sommaire
HOTSPOT
2D
Boite englobante
HOTSPOT2 0, 0 HOTSPOT2 a, 0 HOTSPOT2 0, b HOTSPOT2 a, b
HOTSPOT2 -a/2, -b/2 HOTSPOT2 a/2, -b/2 HOTSPOT2 -a/2, b/2 HOTSPOT2 a/2, b/2
Déplacements
Sur l'axe X
HOTSPOT2 0, 0, unID, a, 1+128 : unID=unID+1 HOTSPOT2 -1, 0, unID, a, 3 : unID=unID+1 HOTSPOT2 a, 0, unID, a, 2 : unID=unID+1
Sur l'axe Y
HOTSPOT2 0, 0, unID, b, 1+128 : unID=unID+1 HOTSPOT2 0, -1, unID, b, 3 : unID=unID+1 HOTSPOT2 0, b, unID, b, 2 : unID=unID+1
Sur les deux axes en même temps
HOTSPOT2 0, b, unID, a, 1+128 : unID=unID+1 HOTSPOT2 -1, b, unID, a, 3 : unID=unID+1 HOTSPOT2 a, b, unID, a, 2 : unID=unID+1 HOTSPOT2 a, 0, unID, b, 1+128 : unID=unID+1 HOTSPOT2 a, -1, unID, b, 3 : unID=unID+1 HOTSPOT2 a, b, unID, b, 2 : unID=unID+1
Rotation
HOTSPOT2 0, 0, unID, angle, 6 : unID=unID+1 HOTSPOT2 A, 0, unID, angle, 4+128 : unID=unID+1 HOTSPOT2 A*COS(angle), A*SIN(angle), unID, angle, 5 : unID=unID+1
3D
Déplacements
Sur l'axe X
HOTSPOT 0, 0, 0, unID, a, 1+128 : unID=unID+1 HOTSPOT -1, 0, 0, unID, a, 3 : unID=unID+1 HOTSPOT a, 0, 0, unID, a, 2 : unID=unID+1
Sur l'axe Y
HOTSPOT 0, 0, 0, unID, b, 1+128 : unID=unID+1 HOTSPOT 0, -1, 0, unID, b, 3 : unID=unID+1 HOTSPOT 0, b, 0, unID, b, 2 : unID=unID+1
Sur l'axe Z
HOTSPOT 0, 0, 0, unID, ZZYZX, 1+128 : unID=unID+1 HOTSPOT 0, 0, -1, unID, ZZYZX, 3 : unID=unID+1 HOTSPOT 0, 0, ZZYZX, unID, ZZYZX, 2 : unID=unID+1
HOTLINE
Boite englobante
HOTLINE2 0, 0, a, 0 HOTLINE2 a, 0, a, b HOTLINE2 0, b, a, b HOTLINE2 0, 0, 0, b
Gestion de l'affichage
Affichage différent en fonction de l'étage d'implantation
- L'objet placé doit être paramétré en "Visible sur tous les étages"
zz = REQUEST ("Story", "", index1, story_name) ! Étage affiché
zz = REQUEST ("Home_story", "", index2, home_story_name) ! Étage d'implantation de l'objet
IF index1 > index2 THEN
	!Symbole 2D affiché au dessus de l'étage d'implantation
ENDIF
IF index1 = index2 THEN
	!Symbole 2D affiché sur l'étage d'implantation
ENDIF
IF index1 < index2 THEN
	!Symbole 2D affiché en dessous de l'étage d'implantation
ENDIF
Orientation 2D
MUL2 1 - 2 * SYMB_MIRRORED, 1
r = request ("View_Rotangle", "", _angleViewRot)
! Actual rotation of the 2D symbol:	
_totalRotate	= (SYMB_ROTANGLE + _angleViewRot) MOD 360
! Count the number of transformations of the 
! coordinate system in different cases
_nTrans = 0
Toujours horizontal
rot2 _totalRotate * (SYMB_MIRRORED - not(SYMB_MIRRORED)) _nTrans = _nTrans + 1
Lisible
IF (_totalRotate > (90 + 90*SYMB_MIRRORED + EPS) & _totalRotate < (270 + 90*SYMB_MIRRORED + EPS)) THEN
    ROT2 180
    _nTrans = _nTrans + 1
ENDIF
Script interface
ui_dialog `Paramètres personnalisés`,444,266
Checkbox (texte cliquable)
ui_infield{3} "bool-parameter", 240, 30, 110, 15,
7, "",
2,
1, 20, 20, 20, 20,
0, "Texte", 0,
1, "Texte", 1
Liste de polices
dim fontnames[]
n = REQUEST ("FONTNAMES_LIST", "", fontnames)
ui_outfield `Police`,		10, 14, 100, 15 
ui_custom_popup_infield "sampleName", 	115, 10, 150, 20,
	0, 0, 1, "", fontnames
On peut aussi récupérer la liste directement en utilisant ces noms de paramètres (type texte) :
- fontType
- fontType2
- fontType3
Liste des images chargées en bibliothèques
En utilisant ces noms de paramètres (type texte) :
- gs_picture_name
- gs_picture_name_2D
Icones mise en forme de texte
Pour avoir les icônes Gras, Italique, Souligné et Barré qui gère automatiquement la valeur du code pour mettre en forme un texte dans un style :
ui_textstyle_infield "styleTexte", 1+2+4+128, x, y, buttonWidth, buttonHeight, buttonOffsetX
("styleTexte" est un paramètre de type entier)
define style name fontType, size, anchor, styleTexte
Macros
Suis-je une macro ?
nameM=""
sts=REQUEST("name_of_main","",nameM)
IF NOT(nameM="") THEN
  PRINT nameM+" is CALLing me!"
ELSE
  PRINT "I am free!"
ENDIF
Mathématiques
Comparaisons
ABS( A - B )>EPS ! A<>B ABS( A - B )<EPS ! A=B A - B < EPS ! A<=B A - B < -EPS ! A<B B - A > EPS ! A<B B - A < EPS ! A>=B B - A < -EPS ! A>B A - B > EPS ! A>B
Trucs & astuces divers
Transformer POLY_B{5} en PRISM_ à l'aide d'une recherche REGEX
Dans un éditeur de texte supportant les recherches REGEX (Regular Expression) :
Chercher : (?-s)^\t*poly2_b\{5\} *([0-9]+),(?s).*? 0, $
Remplacer par : PRISM_ \1, b,
 
					