EPR files & T.ed

Community Forums/Developer Stations/EPR files & T.ed

Aussie(Posted 2008) [#1]
Gday everyone.

Can anyone help.

I am useing T.ed & was wandering if anyone knows where to find a tutorial on useing .epr files & costom properties in B3d.
Thanks.


D4NM4N(Posted 2008) [#2]
There is a complete world loader on the ted homepage :)

You can re load your world using the include files and a few lines of code in your program. The includes are well commented and configurable.


Aussie(Posted 2008) [#3]
I have downloaded the demo of Ice_Cold & have been able to load my scene & i understand how to set collisions to objects. So far :)

I was reading that you could assign properties to an object to be used as a door, lift, particle effect, etc etc.

How would this be done?

I know how to edit the costom properties for an object in T.ed but don't know how to acess them in B3d.

I am prety new to programming & know that epr files are ment for advanced users but i figure You gota start somewhere.


D4NM4N(Posted 2008) [#4]
If you look in the public section you will see this bit:

;-------------------------------------------------------------------------------------------------------------------------------------------
;"Process_Custom_Inits" is a place you can perform custom load tasks such as loading environment sounds, an intro, 
;change characters clothing etc. Basically, anything you want.
;The format is: cmd=value,value,value,va......
;advanced programmers could even use this method to write scripts (take a look at my load chunks in private and the whole epr loader)
;it is processed from the Inits chunk of the epr file and is configured within ted, or as a text file (epr)
;NOTE: If you are using this section to load anything dont forget to keep track of them and free them when you 
;clear the map to load a new one. 
;-------------------------------------------------------------------------------------------------------------------------------------------
Function Parse_Custom_Inits(key$,file)
		
		;here is where you can put any condition you would like to be checked from the init script in ted.	
		If Instr(key$,"[CUSTOM]")
			Repeat
				lines$=ReadLine(file)
				DebugLog lines
				If lines<>"" And lines<>"[/CUSTOM]"
					cmd$=Lower(misc_usv(lines,1,"="))
					values$=misc_usv(lines,2,"=")
					;Custom conditions can go here-------------------------------------------------------
					;for example:
					;If cmd="atmospheresound"
					;	filename$=misc_usv(values$,1,"=") 	;first comma sep value could be filename to load sound
					;	volume=Float(misc_usv(values$,2,"=")); second could be volume, third could be... etc
					;EndIf
					;------------------------------------------------------------------------------------
				EndIf
				If Eof(file) misc_error(1,"ERROR IN CUSTOM") 
			Until Instr(lines,"[/CUSTOM]")
		EndIf 

End Function


This can be used to set up anything you like. If you are setting up stuff for characters etc then you can add the data straight into your defined vars for them.

Notice at the top there are lots of arrays starting "INS_" these contain all the data from the EPR file for all instances in the world. If you are using these arrays provided for things like dynamic trees etc, then you can add a new array to the list, call it " Dim INS_Custom (0) " and fill it with the data for use later on.


Aussie(Posted 2008) [#5]
Thanks.

I will have a play around & see what i can do.

The help is very much appreciated.


Aussie(Posted 2008) [#6]
Ok not having much luck.

Here is the code for the reference cube in the epr file.
[INS]
TED_Id=131104-633429
TED_Name=refrence_cube
TED_Type=Static Mesh
TED_Selected=0
TED_Visible=1
TED_Blend=1
TED_Fx=0
TED_Shading=1
TED_Sprite_View_Mode=4
TED_Anim_Mode=1
TED_Anim_Speed=0.5
TED_Entity_RGBA=100,100,100,1.0
TED_Fade_Range_NF=99999.0,99999.0
TED_Cull_Range=1000.0
TED_Specular=0.0
TED_Shadows=1
TED_Pos_XYZ=261.884,200.203,277.48
TED_Rot_XYZ=0.0,0.0,0.0
TED_Sca_XYZ=1.0,1.0,1.0
[CUSTOM]
HideEntity
Type=smoker
smokespeed=.5
smokealpha=1
[/CUSTOM]
[/INS]


I have tried to use the code in the public section to load a sprite & the sprite dosn't appear to load, the cube is also still visable. When i loaded the sprite in b3d & used the command
( Moveentity smoke,0,smokespeed,0 ) after the epr file has been read the sprite dosn't move.

What am i doing wrong.


D4NM4N(Posted 2008) [#7]
where are you telling blitz that smokespeed=0.5
Those things you assign in custom need To be parsed by you into whatever variable is in your game.


For example, using the code above, you would simply use the same technique as used for loading all the other data into the arrays.

eg:

Function Parse_Custom_Inits(key$,file)

;here is where you can put any condition you would like to be checked from the init script in ted.	
If Instr(key$,"[CUSTOM]")
	Repeat
		lines$=ReadLine(file)
		DebugLog lines
		If lines<>"" And lines<>"[/CUSTOM]"
			cmd$=Lower(misc_usv(lines,1,"="))
			values$=misc_usv(lines,2,"=")
			;Custom conditions can go here-------------------------------------------------------
			;for example:
			If cmd="type"
				
				;for each type do something like this:
				If value="smoker"
					;assuming you have a datastructure/array for this kind of object:
					s.smoker=New smoker
					;because we now know it is a smoke Object we can now extract the Data:
					Repeat
						scriptnext$=ReadLine(file)
						If Lower(misc_usv(scriptnext,1,"="))="smokespeed" s.smokespeed# = misc_usv(scriptnext,2,"=")
						If Lower(misc_usv(scriptnext,1,"="))="smokealpha" s.smokealpha# = misc_usv(scriptnext,2,"=")
						;etc....
						
					Until Lower(scriptnext)="endtype" ;<-use whatever you like to terminate your type
				EndIf
				
				filename$=misc_usv(values$,1,"=") 	;first comma sep value could be filename to load sound
				volume=Float(misc_usv(values$,2,"=")); second could be volume, third could be... etc
			EndIf
			;------------------------------------------------------------------------------------
		EndIf
		If Eof(file) misc_error(1,"ERROR IN CUSTOM") 
	Until Instr(lines,"[/CUSTOM]")
EndIf 

End Function



When doing it like this (ie using your own daya arrays/structures instead of ted's, its also a good idea to save the instance's handle to the data structure as well so its nicely contained in your own system.


-----------------
Alternatively you can just add your own arrays to the ted style ones for use within the system eg.

INS_type() <- could contain a simple type constant or string to identify it
INS_ScriptCommands(0,10) <- saves the 10 lines of script so you can access it easily.

You would fill these in the same way as above and as all the other arrays get their data. This is preferable for dynamic style objects as you can then process the data in realtime rather than at loadtime.
(but dont forget to add them to the object removal code, so they get freed when an instance gets deleted!)

-------------------------------------------

PS:
dont be confounded by that weird looking USV function, it is simply userdefined-separated-values. It is a little function i whipped up to split a string by a number and a separator. EG:

USV("Hi-my-name-is-dan", "-", 3)

would return the third item, "name". Its a very useful little routine :)


Aussie(Posted 2008) [#8]
Ahhhh. I think i am starting to understand it now. :)
I will have a try when i get a chance.

Thanks heaps.


Aussie(Posted 2008) [#9]
I have been unable to get the chance to do any work with T.ed & b3d for the past week & probably wont get the chance for a while now. I have a few assignments that i have to do for work & they have been takeing up a fair bit of my time. I will probably have a few more questions when i finish my assignments. :)

Thanks for the help.