SpeedUp

» Siedler Map Source Forum » Siedler DEdK Script Forum » SpeedUp

Seiten: 1

unstoppened
#1
27.05.2011 19:32
Beiträge: 112

SpeedUp

hy,

kann mir evtl jmd helfen, mich an die SpeedUp per buttonklick fuction zu erinnern....sowas wie "if Button1press then SpeedUp()"; iwie sowas in die richtung, hab lang nichts mehr gemacht und kann mich deswegen auch nicht wirklich dran erinnern...

MfG

unstoppened (wie abwesend war ich denn da als ich den namen erstellt hab <.<

____________________
You become what you hate or you hate what you become!

Flodder
#2
27.05.2011 20:46
Beiträge: 2608

function GroupSelection_SelectTroops ( _count )
	mySpeed = mySpeed or 0
	if _count == 1 then
		if mySpeed < 200 then
			Game.GameTimeSpeedUp()
			mySpeed = mySpeed + 1
			Message(mySpeed)
		end
	elseif _count == 2 then
		if mySpeed > -16 then
			Game.GameTimeSlowDown()
			mySpeed = mySpeed - 1
			Message(mySpeed)
		end
	elseif _count == 10 then 
		Game.GameTimeReset()
		mySpeed = 0
	end 
end 


Zifferntaste eins beschleunigt jeweils und Zifferntaste zwei verringert jeweils den speed. Zifferntaste null setzt auf Normalspeed zurück. Falls Du eins und zwei nicht nutzen möchtest, einfach bei "if _count == 1 then" und "elseif _count == 2 then" andere Ziffern einsetzen.

Zitat von unstoppened:
hy,
kann mir evtl jmd helfen, mich an die SpeedUp per buttonklick fuction zu erinnern....sowas wie "if Button1press then SpeedUp()"; iwie sowas in die richtung, hab lang nichts mehr gemacht und kann mich deswegen auch nicht wirklich dran erinnern...

MfG

unstoppened (wie abwesend war ich denn da als ich den namen erstellt hab <.<



____________________
Take a Nudelholz und hau it on the Kopp of a bekloppt Person .... to give you a better Gefühl than vorher.

totalwarANGEL
#3
27.05.2011 23:30
Beiträge: 2123

SpeedUp per Knopfdruck

Aktuelle Version meines Online Help Hacks zur Spielbeschleunigung. Der ?-Knopf wird mit der Uhr aus dem Statistikmenü ausgewechselt und die OnlineHelp wird überschrieben. Es werden auch STRG und ALT abgefragt. Probiers ja, ich denke, das ist das was du meinst.

-- # # # # # # # # # # FIRST MAP ACTION # # # # # # # # # # --
function FirstMapAction()
	gvQuest = {}
	gvQuest.GameTime = 0
	GlobalColors()
	GameSpeed()
end
-- # # # # # # # # # # COLORS # # # # # # # # # # --
function GlobalColors()
	Blau	 = "@color:153,210,234" --hellblau
	Weiss	 = "@color:255,255,255" -- weiß
	Rot		 = "@color:255,32,32" -- rot
	Gelb  	 = "@color:244,184,0" -- gelb
	Gruen	 = "@color:173,255,47" --hellgruen
	Orange 	 = "@color:255,127,0" --orange
	Mint 	 = "@color:0,255,255" --mint
	Grau	 = "@color:180,180,180" --grau
end
-- # # # # # # # # # # GAME SPEED # # # # # # # # # # --
function GameSpeed()
XGUIEng.TransferMaterials("StatisticsWindowTimeScaleButton", "OnlineHelpButton" )
	XGUIEng.SetWidgetPositionAndSize("OnlineHelpButton",200,2,35,35)
	
	GUIAction_OnlineHelp = function()
		if XGUIEng.IsModifierPressed( Keys.ModifierShift )== 1 and XGUIEng.IsModifierPressed( Keys.ModifierControl )== 0 then
			if Game.GameTimeGetFactor() > 0.54 then
				Game.GameTimeReset()
				gvQuest.GameTime = 0.54
				Game.GameTimeSetFactor( gvQuest.GameTime )
				GUI.ClearNotes()
			end
		elseif XGUIEng.IsModifierPressed( Keys.ModifierShift )== 0 and XGUIEng.IsModifierPressed( Keys.ModifierControl )== 0 then
			if Game.GameTimeGetFactor() < 3 then
				if Game.GameTimeGetFactor() < 1 then
					Game.GameTimeReset()
					gvQuest.GameTime = 3
					Game.GameTimeSetFactor( gvQuest.GameTime )
					GUI.ClearNotes()
					gvQuest.GameTime = Game.GameTimeGetFactor()
				else
					gvQuest.GameTime = 3
					Game.GameTimeSetFactor( gvQuest.GameTime )
					GUI.ClearNotes()
					gvQuest.GameTime = Game.GameTimeGetFactor()
				end
			end
		elseif XGUIEng.IsModifierPressed( Keys.ModifierShift )== 0 and XGUIEng.IsModifierPressed( Keys.ModifierControl )== 1 then
			Game.GameTimeReset()
			GUI.ClearNotes()
			gvQuest.GameTime = Game.GameTimeGetFactor()
		end
	end
	StartBriefing_OrigGS = StartBriefing
	StartBriefing = function( _briefing )
        Game.GameTimeReset()
		GUI.ClearNotes()
        StartBriefing_OrigGS( _briefing )
    end
	Briefing_ExtraOrigGS = Briefing_Extra
	Briefing_Extra = function( _v1, _v2 )
		Game.GameTimeReset()
		GUI.ClearNotes()
		Briefing_ExtraOrigGS( _v1, _v2 )
	end
	if StartCutscene then StartCutscene_OrigGS = StartCutscene end
	if StartCutscene then
        StartCutscene = function( _Cutscene, _EscapeMode )
            Game.GameTimeReset()
			GUI.ClearNotes()
            StartCutscene_OrigGS( _Cutscene, _EscapeMode )
        end
    end
	
	GUITooltip_Generic_OrigGS = GUITooltip_Generic
	GUITooltip_Generic = function(a)
	local newString,numberOfChanges = string.gsub( a, "MenuMap/", "" )
	if newString == "OnlineHelp" then
		if numberOfChanges == 1 then
			if XGUIEng.IsModifierPressed( Keys.ModifierShift )== 1 and XGUIEng.IsModifierPressed( Keys.ModifierControl )== 0 then
				XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, Umlaute(" @color:180,180,180 Spiel verlangsamen"))
				XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "")
			elseif XGUIEng.IsModifierPressed( Keys.ModifierShift )== 0 and XGUIEng.IsModifierPressed( Keys.ModifierControl )== 1 then
				XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, Umlaute(" @color:180,180,180 Normalgeschwindigkeit"))
				XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "")
			elseif XGUIEng.IsModifierPressed( Keys.ModifierShift )== 0 and XGUIEng.IsModifierPressed( Keys.ModifierControl )== 0 then
				XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, Umlaute(" @color:180,180,180 Spiel beschleunigen @color:255,255,255 @cr \"Shift\" verlangsamen @cr \"Strg\" Normalgeschwindigkeit"))
				XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "")
			end
		end
	else
		GUITooltip_Generic_OrigGS(a)
	end
	end
	
	Mission_OnSaveGameLoaded_OrigGS = Mission_OnSaveGameLoaded
	Mission_OnSaveGameLoaded = function()
		Mission_OnSaveGameLoaded_OrigGS()
		Game.GameTimeSetFactor( gvQuest.GameTime )
		GUI.ClearNotes()
		XGUIEng.TransferMaterials("StatisticsWindowTimeScaleButton", "OnlineHelpButton" )
		XGUIEng.SetWidgetPositionAndSize("OnlineHelpButton",200,2,35,35)
	end
end



____________________
Die Welt ist arschlochförmig und wir leben in der Mitte.

Dieser Beitrag wurde von totalwarANGEL am 28.05.2011 um 01:06 editiert.

unstoppened
#4
28.05.2011 00:00
Beiträge: 112

danke euch beiden =)

____________________
You become what you hate or you hate what you become!

unstoppened
#5
28.05.2011 16:42
Beiträge: 112

okay, eine frage hätte ich dann doch noch...wie ruft man die funktion denn dann auf? weil bei nem schlichten aufruf bekomm ich sowas hier:

[ 2011/05/28 16:39:34 ] ERROR: DEBUG ERROR!

Error: LUA_ERRRUN: [string "Data\Script\Interface\groupselection.lua"]:62: attempt to compare nil with number

____________________
You become what you hate or you hate what you become!

totalwarANGEL
#6
29.05.2011 22:42
Beiträge: 2123

Zitat von unstoppened:
[ 2011/05/28 16:39:34 ] ERROR: DEBUG ERROR!

Error: LUA_ERRRUN: [string "Data\Script\Interface\groupselection.lua"]:62: attempt to compare nil with number


Interessant...
Die Meldung gibt's in meiner Map nicht. Vermutlich hab ich was vergessen zu kopieren. Ich schau mir das mal an.

____________________
Die Welt ist arschlochförmig und wir leben in der Mitte.

unstoppened
#7
31.05.2011 18:06
Beiträge: 112

hab auch ersma nur flodders funktion genommen....aus dem schlichten grund dass meine maus momentan buggt sodass schlichtes kopieren schon zur qual wird also kürzer = besser

____________________
You become what you hate or you hate what you become!

Flodder
#8
01.06.2011 13:04
Beiträge: 2608

Zitat von unstoppened:
hab auch ersma nur flodders funktion genommen....aus dem schlichten grund dass meine maus momentan buggt sodass schlichtes kopieren schon zur qual wird also kürzer = besser


Ahh...! Betrifft also die von mir gepostete Funktion...

Die musst Du nur komlett in die FMA kopieren. Bitte ohne weiteren "Extraaufruf" der Funktion!

Muster:

function FirstMapAction()
    LocalMusic.UseSet = EUROPEMUSIC
    ActivateBriefingsExpansion()
    Einleitung()
    --evtl. weitere Aufrufe
--**********Speeduptool start*********--	
function GroupSelection_SelectTroops ( _count )
	mySpeed = mySpeed or 0
	if _count == 1 then
	if mySpeed < 200 then
		Game.GameTimeSpeedUp()
		mySpeed = mySpeed + 1
		Message(mySpeed)
	end
	elseif _count == 2 then
	if mySpeed > -16 then
		Game.GameTimeSlowDown()
		mySpeed = mySpeed - 1
		Message(mySpeed)
	end
	elseif _count == 10 then 
	Game.GameTimeReset()
        mySpeed = 0
   end 
end 
--**********Speeduptool ende**********--	
end


...dann sollte es auch ohne jegliche Fehlermeldung klappen.

____________________
Take a Nudelholz und hau it on the Kopp of a bekloppt Person .... to give you a better Gefühl than vorher.

unstoppened
#9
01.06.2011 13:35
Beiträge: 112

da war also der fehler
oaky danke werds gleich mal testen

--klappt--

____________________
You become what you hate or you hate what you become!

totalwarANGEL
#10
02.06.2011 13:30
Beiträge: 2123

Zitat von unstoppened:
kürzer = besser


Na ja, das ist Ansichtssache. Floders Funktion ist eine Testerfunktion. Meine ist für den Einsatz im fertigen Spiel gedacht.

____________________
Die Welt ist arschlochförmig und wir leben in der Mitte.

AdeBont
#11
04.01.2013 18:01
Beiträge: 666

Hi totalwarANGEL

Your solution is quite fancy, but it has one disadvantage; you need to move your mouse to pause the screen.

I already made a game speed function on the F12 key (as sound control is already met in many other ways...)
I combined my solution with yours, making all functions possible via key strikes.

function FirstMapAction()
  ToggleSound=assert(KeyBindings_ToggleSound)gvQuest={}gvQuest.GameTime=0 Game.GameTimeSetFactor(1)SetGameSpeedUpButton()
  KeyBindings_TogglePause()Game.GameTimeSetFactor(1)Stream.Pause(false)Sound.Pause3D(false)GUI.ClearNotes()
end

function SetGameSpeedUpButton()--Set F12 for game speed up function
  KeyBindings_ToggleSound=function()
    if Game.GameTimeGetFactor()==0 then
      SpeedUpGame()
      GUI.ClearNotes()
      Message("Extreme slow motion")
    elseif Game.GameTimeGetFactor()<0.5 then
      gvQuest.GameTime=0.5
      Game.GameTimeSetFactor(gvQuest.GameTime)
      GUI.ClearNotes()
      gvQuest.GameTime=Game.GameTimeGetFactor
      Message("Slow motion")
    elseif Game.GameTimeGetFactor()<1 then
      gvQuest.GameTime=1
      Game.GameTimeSetFactor(gvQuest.GameTime)
      GUI.ClearNotes()
      gvQuest.GameTime=Game.GameTimeGetFactor
      Message("Normal game speed")
    elseif Game.GameTimeGetFactor()<16 then
      gvQuest.GameTime=(Game.GameTimeGetFactor()*2)
      Game.GameTimeSetFactor(gvQuest.GameTime)
      GUI.ClearNotes()
      gvQuest.GameTime=Game.GameTimeGetFactor
      Message("Game speed "..Game.GameTimeGetFactor().." times faster")
    else
      gvQuest.GameTime=(Game.GameTimeGetFactor()*2)
      Game.GameTimeSetFactor(gvQuest.GameTime)
      GUI.ClearNotes()
      gvQuest.GameTime=Game.GameTimeGetFactor
      Message("Maximum game speed ("..Game.GameTimeGetFactor().." times faster)")
    end
  end
end

function KeyBindings_TogglePause()--Pause key adjusted
  local Speed=Game.GameTimeGetFactor()
    if Speed==0 then
      Game.GameTimeSetFactor(1)
      Stream.Pause(false)
      Sound.Pause3D(false)
      GUI.ClearNotes()
      Message("Normal game speed")
  else
      Game.GameTimeSetFactor(0)
      Stream.Pause(true)
      Sound.Pause3D(true)
  end
end


With this, at each change in game speed or after releasing pause all notes are removed and functional game speed is displayed.

Pressing F12 speeds up the game
Pressing Pause twice returns game speed to normal
Pressing F12 while game is paused resumes game in extreme slow motion.
Pressing F12 again sets game speed to slow motion, pressing F12 a third time sets game speed to normal.

____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1

totalwarANGEL
#12
04.01.2013 19:35
Beiträge: 2123

Speed it Up

This is the version, I wrote some time after I post my old function:

function ColorTextNamen()
	orange = "@color:255,127,0"
	gelb = "@color:255,215,0"
	rot  = "@color:255,0,0"
	blau = "@color:0,0,255"
	lila = "@color:180,82,205"
	hGelb = "@color:238,221,130"
	hBlau = "@color:99,184,255"
	weiss = "@color:255,255,255"
	hGruen = "@color:173,255,47"
	grau = "@color:180,180,180"
end


function GameSpeed()
	XGUIEng.TransferMaterials("OnlineHelpButton", "Research_Gilds" )
	XGUIEng.TransferMaterials("StatisticsWindowTimeScaleButton", "OnlineHelpButton" )
	XGUIEng.SetWidgetPositionAndSize("OnlineHelpButton",200,2,35,35)
	GUIAction_OnlineHelp = function()
		if Game.GameTimeGetFactor() < 3 then
			Game.GameTimeSpeedUp()
			Game.GameTimeSpeedUp()
			gvMission.GameTime = Game.GameTimeGetFactor()
			GUI.ClearNotes()
		else
			Game.GameTimeReset()
			gvMission.GameTime = Game.GameTimeGetFactor()
			GUI.ClearNotes()
		end
	end
	GUITooltip_Generic_OrigGS = GUITooltip_Generic
	GUITooltip_Generic = function(a)
	local newString,numberOfChanges = string.gsub( a, "MenuMap/", "" )
	if newString == "OnlineHelp" then
		if numberOfChanges == 1 then
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, Umlaute(grau.." Game Speed: "..weiss.." "..gvMission.GameTime.." "))
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts, "")
			XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomShortCut, "")
		end
	else
		GUITooltip_Generic_OrigGS(a)
	end
	end
	Mission_OnSaveGameLoaded_OrigGS = Mission_OnSaveGameLoaded
	Mission_OnSaveGameLoaded = function()
		Mission_OnSaveGameLoaded_OrigGS()
		Game.GameTimeSetFactor( gvMission.GameTime )
		GUI.ClearNotes()
		Message( "Spielstand geladen!" )
		XGUIEng.TransferMaterials("OnlineHelpButton", "Research_Gilds" )
		XGUIEng.TransferMaterials("StatisticsWindowTimeScaleButton", "OnlineHelpButton" )
		XGUIEng.SetWidgetPositionAndSize("OnlineHelpButton",200,2,35,35)
	end
end


You can speed up the game to factor 3 then it is reset to factor 1. First call "ColorTextNamen" then "GameSpeed". Also the function "Umlaute" is used by the code. It must be ad. Hope I forgot nothing.

Normaly the game is paused with the "Pause" key on the keyboard. I think an english keyboard can pause the game too.

____________________
Die Welt ist arschlochförmig und wir leben in der Mitte.

AdeBont
#13
04.01.2013 21:12
Beiträge: 666

Hi TWA

Still I prefer my (new) function...
With that I can increase gamespeed with 5 increments (2x, 4x, 8x, 16x and finaly max speed of 20x)
Also two slow motion speeds are available (and more could be coded easily, but I think that to be superfluous)

But even more important for me is that the controlls are on keys instead of on screen buttons.
This way there is more control to speedup when desired, but to resume to normal speed quickly when needed. C
ontrols via keys also alow speeding, slow motioning and resuming to normal speed during (CutScene) briefings

____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1

totalwarANGEL
#14
04.01.2013 21:29
Beiträge: 2123

Zitat von AdeBont:
Hi TWA

Still I prefer my (new) function...
With that I can increase gamespeed with 5 increments (2x, 4x, 8x, 16x and finaly max speed of 20x)
Also two slow motion speeds are available (and more could be coded easily, but I think that to be superfluous)

But even more important for me is that the controlls are on keys instead of on screen buttons.
This way there is more control to speedup when desired, but to resume to normal speed quickly when needed. C
ontrols via keys also alow speeding, slow motioning and resuming to normal speed during (CutScene) briefings


What do you do with the speed up can knock out some older pc easily. It's realy to heavy to set the speed on 20x. Also I decide that a slow down is useless too (because of no one use it).

To put it on hot keys is of course a advantage but I would lock it in cutscenes.

____________________
Die Welt ist arschlochförmig und wir leben in der Mitte.

AdeBont
#15
04.01.2013 22:00
Beiträge: 666

Zitat von totalwarANGEL:
Also I decide that a slow down is useless too (because of no one use it).

Not quite true, somtimes it is fun to see things like battles in slomo... But generally it's not very usefull indeed...

Zitat von totalwarANGEL:
To put it on hot keys is of course a advantage but I would lock it in cutscenes.

No! I want to have it available especially for CutScene briefings!
If you have to replay a map, or a portion of it, then it is really pleasant to be able to run quickly through the briefings, which you have already seen...
Or is there another way to shortcut CutScene briefings (Escape doesn't work here like in normal briefings)

____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1

MadShadow
#16
05.01.2013 16:20
Beiträge: 372

Du kannst das verlangsamen auch dazu hernehmen, laggs zu simulisieren. Das funktioniert natürlich nicht bei allem.

AdeBont
#17
05.01.2013 16:27
Beiträge: 666

Zitat von MadShadow:
Du kannst das verlangsamen auch dazu hernehmen, laggs zu simulisieren. Das funktioniert natürlich nicht bei allem.

sorry, don't get what you're saying here

____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1

MadShadow
#18
06.01.2013 02:05
Beiträge: 372

to slow down the game can also be used to simulate multiplayer laggs. with lag i mean a short moment in the game the other players to wait for the slowest computer

mundn
#19
23.11.2018 20:54
Beiträge: 83

Bei der Benutzung von TWA's "Speed it up" bekomme ich hier leider nen Fehler... Was fehlt?

Error: LUA_ERRRUN: [string "maps\user\-----------027.lua"]:472: attempt to concatenate 

field `GameTime' (a nil value)
Additional info: Game turn 201 (0:20)



folgendes habe ich in meiner FMA

	GameSpeed()


(ColorTextNamen hab ich ausgetauscht)

____________________
Scripten bei Master pewe in DEdK Script-Wiki gelernt ich habe.

mcb
#20
23.11.2018 21:29
Beiträge: 1472

Sieht so aus, als wäre da ne Variable nicht initialisiert worden. Ich vermute es ist gvMission.GameTime.

mundn
#21
23.11.2018 21:36
Beiträge: 83

hab grad folgendes vorher in der FMA aufgerufen:

gvMission = {}
gvMission.GameTime = 0


leider stürzt nun das game einfach ab :/

____________________
Scripten bei Master pewe in DEdK Script-Wiki gelernt ich habe.

mundn
#22
23.11.2018 22:08
Beiträge: 83

hab den Fehler gefunden:
gvMission ist schon initialisiert gewesen...
musste lediglich gvMission.GameTime = 1 eintragen

____________________
Scripten bei Master pewe in DEdK Script-Wiki gelernt ich habe.

Seiten: 1

SiteEngine v1.5.0 by nevermind, ©2005-2007
Design by SpiderFive (www.siedler-games.de) - English translation by juja

Impressum