Извините, ничего не найдено.

Не расстраивайся! Лучше выпей чайку!
Регистрация
Справка
Календарь

Вернуться   forum.boolean.name > Программирование игр для компьютеров > Blitz3D > 2D-программирование

2D-программирование Вопросы, касающиеся двумерного программирования

Ответ
 
Опции темы
Старый 10.06.2007, 02:33   #16
Leito
Танчики Developer
 
Регистрация: 29.01.2007
Сообщений: 539
Написано 16 полезных сообщений
(для 23 пользователей)
Re: Скрипты и скриптовые ролики.

вот отрывок кода из пиратов, может поможет))(тут не вся скриптовая система)

Function LoadScriptsCommand()
file=ReadFile("DATA\text\scripts.txt")
QSC=0
QHS=0
While Not Eof(file)
	QSC=QSC+1
	ScriptsCommand$(QSC)=ReadLine(file)
	If Left(ScriptsCommand$(QSC),11)="beginscript"
		QHS=QHS+1
		HeadScripts(QHS,1)=Int(Right(ScriptsCommand$(QSC),Len(ScriptsCommand$(QSC))-12))
		HeadScripts(QHS,2)=QSC
	End If
Wend
CloseFile(file)
End Function


Function ScriptsControl()
ScriptsControlStatus=1
For i=1 To QSL
	For j=1 To QHS
		If HeadScripts(j,1)=ScriptsList(i)
			a=HeadScripts(j,2)
			k=a+1
			QTS=0
			While ScriptsCommand$(k)<>"endscript"
				TempScripts$(k-a)=ScriptsCommand$(k)
				k=k+1
				QTS=QTS+1
			Wend
			If QTS<>0
				ScrLet=1
				For k=1 To QTS
					If ScrLet=1
						GameScript(TempScripts$(k))
					Else
						GameScript("!"+TempScripts$(k))
					End If					
				Next
			End If
		End If
	Next
Next
ScriptsControlStatus=0

For i=1 To QTARS
	If TempAddRemoveScripts(i,2)=1
		gamescript("addscript."+Str(TempAddRemoveScripts(i,1)))
	Else
		gamescript("removescript."+Str(TempAddRemoveScripts(i,1)))
	End If
Next
QTARS=0
End Function

Function ControlCondition(Condition$)
e=0
a$=""
b=1
c$=""
d$=""
p1=0
p2=0
While e=0
	c$=c$+a$
	a$=Mid(Condition$,b,1)
	b=b+1
	If a$="=" Or a$="<" Or a=">" Or a="!" Or a="\" Or a="/" e=1
Wend
d$=Mid(Condition$,b,Len(Condition$)-b+1)

p1=CalcExp(c$)
p2=CalcExp(d$)

Select a$
Case "=" If p1=p2 Return 1 Else Return 0
Case "<" If p1<p2 Return 1 Else Return 0
Case ">" If p1>p2 Return 1 Else Return 0
Case "!" If p1<>p2 Return 1 Else Return 0
Case "\" If p1>=p2 Return 1 Else Return 0
Case "/" If p1<=p2 Return 1 Else Return 0
End Select
End Function

Function TransVar#(var$)
check=0
Select var$
Case "QH"
	Return QH
	check=1
Case "gamescr"
	Return GameScr
	check=1	
Case "millisecs"
	Return MilliSecs()
	check=1
End Select

If Right(var$,1)="#"
	Return ScriptsVar#(Int(Left(var$,Len(var$)-1)))
End If
		
If Left(var$,10)="searchitem" Then
	b=11
	e=0
	a$=""
	c$=""
	d$=""
	g$=""
	While a<>"."
		b=b+1
		g$=g$+a$
		a$=Mid(var$,b,1)
	Wend
	a$=""
	While a<>"."
		b=b+1
		c$=c$+a$
		a$=Mid(var$,b,1)
	Wend
	a=""
	d$=Mid(var$,b+1,Len(var$)-b)
	If g$="hero"
		For i=1 To Qthings
			If inventory(i)\ID=Int(c$) And inventory(i)\quantity>=Int(Float(d$))
				e=1
			End If
		Next		
	Else
		f=0
		For i=1 To QN
			If NPC(i)\ID$ = g$
				f=i
			End If
		Next	
		If f<>0
			For i=1 To NPC(f)\Qthings
				If NPC(f)\inv[i]\ID=Int(c$) And NPC(f)\inv[i]\quantity>=Int(Float(d$))
					e=1
				End If
			Next
		Else
			For i=1 To QC
				If Cont(i)\ID$ = g$
					f=i
				End If
			Next
			If f<>0
				For i=1 To cont(f)\Qthings
					If cont(f)\inv[i]\ID=Int(c$) And cont(f)\inv[i]\quantity>=Int(Float(d$))
						e=1
					End If
				Next				
			End If
		End If	
	End If
	Return e
	check=1	
End If

If Left(var$,5)="equip"
	b=7
	c$=""
	a$=""
	d$=""
	While a$<>"."
		c$=c$+a$
		a$=Mid(var$,b,1)
		b=b+1
	Wend
	d$=Mid(var$,b,Len(var$)-b+1)
	e=0
	If Int(c$)=0 
		If equip(0)\ID=Int(d$) e=1
	Else
		If equip(1)\ID=Int(d$) e=1
	End If
	Return e
	check=1
End If

If Left(var$,8)="opencont"
	d$=Right(var$,Len(var$)-9)
	e=0
	If GameScr=12
		If cont(Menu12NTC)\ID$=d$ e=1
	End If
	Return e
	check=1
End If

If Left(var$,8)="tradeNPC"
	d$=Right(var$,Len(var$)-9)
	e=0
	If GameScr=11
		If NPC(Menu11NTN)\ID$=d$ e=1
	End If
	Return e
	check=1
End If

If Left(var$,10)="visibility"
	visib#=constant("visibility_degrees")
	b=12
	a$=""
	c$=""
	d$=""
	f=0
	While a$<>"."
		c$=c$+a$
		a$=Mid(var$,b,1)
		b=b+1
	Wend
	d$=Mid(var$,b,Len(var$)-b+1)

	For i=1 To QN
		If NPC(i)\ID$=c$ f=i
	Next
	px1#=EntityX#(NPC(f)\mesh1,1)
	pz1#=EntityZ#(NPC(f)\mesh1,1)
	pyaw#=EntityYaw#(NPC(f)\mesh1,1)
	plook#=NPC(f)\look

	If d$="hero"
		px2#=EntityX#(player(0)\mesh1,1)
		pz2#=EntityZ#(player(0)\mesh1,1)
	Else
		For i=1 To QN
			If NPC(i)\ID$=d$ f=i
		Next
		px2#=EntityX#(NPC(f)\mesh1,1)
		pz2#=EntityZ#(NPC(f)\mesh1,1)
	End If	
	
	dist#=Sqr((px1#-px2#)*(px1#-px2#)+(pz1#-pz2#)*(pz1#-pz2#))
	If dist<plook#
		rot#=180+rotate(px1#,pz1#,px2#,pz2#)
		pyaw1#=pyaw# - visib#/2
		pyaw2#=pyaw# + visib#/2
		If pyaw2#>=180 And rot#<0 rot#=rot# + 360
		If pyaw1#<-180 And rot#>0 rot#=rot# - 360
		
		If pyaw1#<rot# And pyaw2#>rot#
			Return 1
		Else
			Return 0
		End If
	Else
		Return 0
	End If
	check=1
End If

If Left(var$,3)="NPC"
	b=5
	a$=""
	c$=""
	d$=""
	f=0
	While a$<>"."
		c$=c$+a$
		a$=Mid(var$,b,1)
		b=b+1
	Wend
	d$=Mid(var$,b,Len(var$)-b+1)
	For i=1 To QN
		If NPC(i)\ID$ = c$
			f=i
		End If
	Next
	Select d$
	Case "usetalk" Return NPC(f)\UseTalk
	Case "anim" Return NPC(f)\Anim
	Case "typeai" Return NPC(f)\TypeAI
	Case "dam" Return NPC(f)\Dam
	Case "asp" Return NPC(f)\Asp
	Case "speed" Return NPC(f)\Speed#
	Case "def" Return NPC(f)\Def
	Case "realhp" Return NPC(f)\realhp
	Case "maxhp" Return NPC(f)\MaxHp
	Case "crit" Return NPC(f)\Crit
	Case "distat" Return NPC(f)\distat
	Case "ex" Return NPC(f)\Ex
	Case "look" Return NPC(f)\look
;	Case "number" Return NPC(f)\Number	
	Case "weight" Return NPC(f)\weight
	Case "scalex" Return NPC(f)\ScaleX#
	Case "scaley" Return NPC(f)\ScaleY#
	Case "scalez" Return NPC(f)\ScaleZ#
	Case "yaw" Return NPC(f)\Yaw#
	Case "alive" Return NPC(f)\Alive
	Case "maintalk" Return NPC(f)\maintalk
	Case "qt" Return NPC(f)\QT
	Case "qthings" Return NPC(f)\Qthings
	Case "x" Return EntityX#(NPC(f)\mesh1)
	Case "y" Return EntityY#(NPC(f)\mesh1)
	Case "z" Return EntityZ#(NPC(f)\mesh1)
	End Select
	check=1
End If

If Left(var$,4)="cont"
	b=6
	a$=""
	c$=""
	d$=""
	f=0
	While a$<>"."
		c$=c$+a$
		a$=Mid(var$,b,1)
		b=b+1
	Wend
	d$=Mid(var$,b,Len(var$)-b+1)
	For i=1 To QC
		If cont(i)\ID$ = c$
			f=i
		End If
	Next
	Select d$
	Case "scalex" Return cont(f)\ScaleX#
	Case "scaley" Return cont(f)\ScaleY#
	Case "scalez" Return cont(f)\ScaleZ#
	Case "yaw" Return cont(f)\Yaw#
	Case "x" Return EntityX#(cont(f)\mesh)
	Case "y" Return EntityY#(cont(f)\mesh)
	Case "z" Return EntityZ#(cont(f)\mesh)
	End Select
	check=1
End If

If Left(var$,4)="mesh"
	b=6
	a$=""
	c$=""
	d$=""
	f=0
	While a$<>"."
		c$=c$+a$
		a$=Mid(var$,b,1)
		b=b+1
	Wend
	d$=Mid(var$,b,Len(var$)-b+1)
	For i=1 To Qmesh
		If Omesh(i)\ID$ = c$
			f=i
		End If
	Next
	Select d$
	Case "scalex" Return Omesh(f)\ScaleX#
	Case "scaley" Return Omesh(f)\ScaleY#
	Case "scalez" Return Omesh(f)\ScaleZ#
	Case "yaw" Return Omesh(f)\Yaw#
	Case "x" Return EntityX#(Omesh(f)\mesh)
	Case "y" Return EntityY#(Omesh(f)\mesh)
	Case "z" Return EntityZ#(Omesh(f)\mesh)
	End Select
	check=1
End If

If Left(var$,4)="hero"
	d$=Mid(var$,6,Len(var$)-5)

	Select d$
	Case "anim" Return Player(0)\Anim
	Case "st" Return Player(0)\St
	Case "con" Return Player(0)\con
	Case "dex" Return Player(0)\dex
	Case "sd" Return Player(0)\sd
	Case "gd" Return Player(0)\gd
	Case "la" Return Player(0)\la
	Case "ha" Return Player(0)\ha
	Case "ac" Return Player(0)\ac
	Case "ev" Return Player(0)\ev
	Case "tr" Return Player(0)\tr
	Case "dam" Return Player(0)\dam
	Case "asp" Return Player(0)\asp
	Case "speed" Return Player(0)\speed#
	Case "def" Return Player(0)\def
	Case "realhp" Return Player(0)\realhp
	Case "maxhp" Return Player(0)\maxhp
	Case "crit" Return Player(0)\crit
	Case "weight" Return Player(0)\weight
	Case "wed" Return Player(0)\wed
	Case "wec" Return Player(0)\wec
	Case "was" Return Player(0)\was
	Case "wet" Return Player(0)\wet
	Case "ard" Return Player(0)\ard
	Case "art" Return Player(0)\art
	Case "distat" Return Player(0)\distat
	Case "dac" Return Player(0)\dac	
	Case "dev" Return Player(0)\dev
	Case "ex" Return Player(0)\Ex
	Case "lvlexp" Return Player(0)\lvlexp
	Case "level" Return Player(0)\Level
	Case "charpoints" Return Player(0)\CharPoints
	Case "skillpoints" Return Player(0)\SkillPoints
	Case "deadmovietime" Return Player(0)\DeadMovieTime
	Case "movetype" Return Player(0)\MoveType
	Case "qthings" Return Qthings
	Case "x" Return EntityX#(Player(0)\mesh1)
	Case "y" Return EntityY#(Player(0)\mesh1)
	Case "z" Return EntityZ#(Player(0)\mesh1)	
	Case "scalex" Return Player(0)\ScaleX#
	Case "scaley" Return Player(0)\ScaleY#
	Case "scalez" Return Player(0)\ScaleZ#
	Case "yaw" Return Player(0)\Yaw#
	End Select	
	check=1
End If
If check=0 Return Float#(var$)
End Function
(Offline)
 
Ответить с цитированием
Старый 10.06.2007, 23:01   #17
Horror
Бывалый
 
Регистрация: 09.09.2006
Сообщений: 656
Написано 54 полезных сообщений
(для 110 пользователей)
Re: Скрипты и скриптовые ролики.

JohnK а вот мне тоже хочется поглядеть этот туториал) и что мне терь
40 сообщенией писать?
Скрытый блок, вам нужно написать 200 сообщений, вы написали 159.:
Вам запрещено просматривать содержимое этого блока
[хнык-хнык] попровь если можешь (40 раз флудить не охото)) )
(Offline)
 
Ответить с цитированием
Старый 10.06.2007, 23:14   #18
johnk
Легенда
 
Регистрация: 01.10.2006
Сообщений: 3,705
Написано 296 полезных сообщений
(для 568 пользователей)
Re: Скрипты и скриптовые ролики.

Поправил
(Offline)
 
Ответить с цитированием
Старый 11.06.2007, 00:42   #19
Horror
Бывалый
 
Регистрация: 09.09.2006
Сообщений: 656
Написано 54 полезных сообщений
(для 110 пользователей)
Re: Скрипты и скриптовые ролики.

JohnK - пасибо огромное , интересно почитать)
(Offline)
 
Ответить с цитированием
Ответ


Опции темы

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
проработанные скриптовые языки под диалоги из современных игр Leito 2D-программирование 2 27.01.2009 23:54
Flash ролики в БМ snikers BlitzMax 4 29.10.2008 19:16
php скрипты Lelick Основной форум 18 23.07.2008 16:28
Ролики SERGO Болтовня 3 10.09.2005 17:54


Часовой пояс GMT +4, время: 02:40.


vBulletin® Version 3.6.5.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Перевод: zCarot
Style crйe par Allan - vBulletin-Ressources.com