Horseman

» Siedler Map Source Forum » Siedler DEdK Script Forum » Horseman

Seiten: 1 2 Nächste Seite

polaster64
#1
02.10.2015 17:00
Beiträge: 184

Horseman

http://screenshooter.net/100248758/dnejwcp how can i enable this on the horseman?

mcb
#2
02.10.2015 17:12
Beiträge: 1472

Hacking GameCallback_GUI_SelectionChanged, checking the EntityType of GUI.GetSelectedEntity(), and call XGUIEng.ShowWidget("Selection_Leader", 1)

polaster64
#3
02.10.2015 22:29
Beiträge: 184

Zitat von mcb:
Hacking GameCallback_GUI_SelectionChanged, checking the EntityType of GUI.GetSelectedEntity(), and call XGUIEng.ShowWidget("Selection_Leader", 1)



Where should i place it?

polaster64
#4
03.10.2015 13:54
Beiträge: 184

Zitat von polaster64:

Zitat von mcb:
Hacking GameCallback_GUI_SelectionChanged, checking the EntityType of GUI.GetSelectedEntity(), and call XGUIEng.ShowWidget("Selection_Leader", 1)



Where should i place it?



HELLO?

MadShadow
#5
03.10.2015 14:51
Beiträge: 372

GameCallback_GUI_SelectionChanged is a function called by the game itself whenever the interface changes.

"Hacking" now means that you want to do something like this:

OldFunction = OriginalSettlersFunction

function OriginalSettlersFunction(_possibleParameters)
  -- call the "original function"
  OldFunction(_possibleParameters)

  -- place your code here
end



That way you are able to call your own code before the original functions code is called. For example:

Zitat von mcb:
checking the EntityType of GUI.GetSelectedEntity(), and call XGUIEng.ShowWidget("Selection_Leader", 1)



Edit: Thanks mcb. I just corrected my mistake.

Dieser Beitrag wurde von MadShadow am 03.10.2015 um 17:52 editiert.

mcb
#6
03.10.2015 17:09
Beiträge: 1472

In this case you have to call the original function before your code, because the original hides Selection_Leader.

polaster64
#7
03.10.2015 20:28
Beiträge: 184

Zitat von MadShadow:
GameCallback_GUI_SelectionChanged is a function called by the game itself whenever the interface changes.

"Hacking" now means that you want to do something like this:

OldFunction = OriginalSettlersFunction

function OriginalSettlersFunction(_possibleParameters)
  -- call the "original function"
  OldFunction(_possibleParameters)

  -- place your code here
end



That way you are able to call your own code before the original functions code is called. For example:

Zitat von mcb:
checking the EntityType of GUI.GetSelectedEntity(), and call XGUIEng.ShowWidget("Selection_Leader", 1)



Edit: Thanks mcb. I just corrected my mistake.




I think i am too stypid. Can u replace it? Im really new in something like that"code".

Zedeg
#8
03.10.2015 21:37
Beiträge: 428

I haven't tested it yet, but this should work:

function FirstMapAction()
    --[...]
    GameCallback_GUI_SelectionChanged_Old = GameCallback_GUI_SelectionChanged --the function "GameCallback_GUI_SelectionChanged_Old" contains the original function now.
    GameCallback_GUI_SelectionChanged = GameCallback_GUI_SelectionChanged_New --whenever the game calls "GameCallback_GUI_SelectionChanged", the function "GameCallback_GUI_SelectionChanged_New" will be called instead.
    --[...]
end

function GameCallback_GUI_SelectionChanged_New() --we define the kew function here
    GameCallback_GUI_SelectionChanged_Old() --firstly, the original function must be called. We only want to modify a few lines, not the whole function.
    local selected = GUI.GetSelectedEntity() --the local variable "selected" gets the value of the ID of the currently selected entity; this ->local<- variable will be deleted at the end of the function automatically.
    --is the selected entity a leader?
    if Logic.IsEntityInCategory(selected, EntityCategories.Leader) == 1 then --yes!
        XGUIEng.ShowWidget("Selection_Leader", 1) --shows the buttons
    else --no!
        XGUIEng.ShowWidget("Selection_Leader", 0) --hide the buttons (e.g. for buildings, serfs etc.)
    end
end



____________________
Journalisten erkundigen sich bei Wissenschaftlern meist nicht nach Grundlagen, sondern eher nach Ergebnissen und Folgerungen. Das erklärt womöglich auch, warum sich Forschungsberichte in den Medien so häufig als feststehende Erkenntnisse lesen, nicht aber als Ideen, Entdeckungen oder Indizien, um die es sich genau genommen in den meisten Fällen handelt. -Axel Bojowski

Dieser Beitrag wurde von Zedeg am 03.10.2015 um 22:25 editiert.

polaster64
#9
03.10.2015 23:16
Beiträge: 184

Zitat von Zedeg:
I haven't tested it yet, but this should work:

function FirstMapAction()
    --[...]
    GameCallback_GUI_SelectionChanged_Old = GameCallback_GUI_SelectionChanged --the function "GameCallback_GUI_SelectionChanged_Old" contains the original function now.
    GameCallback_GUI_SelectionChanged = GameCallback_GUI_SelectionChanged_New --whenever the game calls "GameCallback_GUI_SelectionChanged", the function "GameCallback_GUI_SelectionChanged_New" will be called instead.
    --[...]
end

function GameCallback_GUI_SelectionChanged_New() --we define the kew function here
    GameCallback_GUI_SelectionChanged_Old() --firstly, the original function must be called. We only want to modify a few lines, not the whole function.
    local selected = GUI.GetSelectedEntity() --the local variable "selected" gets the value of the ID of the currently selected entity; this ->local<- variable will be deleted at the end of the function automatically.
    --is the selected entity a leader?
    if Logic.IsEntityInCategory(selected, EntityCategories.Leader) == 1 then --yes!
        XGUIEng.ShowWidget("Selection_Leader", 1) --shows the buttons
    else --no!
        XGUIEng.ShowWidget("Selection_Leader", 0) --hide the buttons (e.g. for buildings, serfs etc.)
    end
end



It says its error. I dont have debug script cuz i cant find it so i dunno where is the mistake

Zedeg
#10
03.10.2015 23:32
Beiträge: 428

Why don't you add this simple " -debugscript" behind the settler shortcut's path? You have made the mistake because my script works perfectly!

____________________
Journalisten erkundigen sich bei Wissenschaftlern meist nicht nach Grundlagen, sondern eher nach Ergebnissen und Folgerungen. Das erklärt womöglich auch, warum sich Forschungsberichte in den Medien so häufig als feststehende Erkenntnisse lesen, nicht aber als Ideen, Entdeckungen oder Indizien, um die es sich genau genommen in den meisten Fällen handelt. -Axel Bojowski

polaster64
#11
04.10.2015 09:11
Beiträge: 184

Zitat von Zedeg:
Why don't you add this simple " -debugscript" behind the settler shortcut's path? You have made the mistake because my script works perfectly!




I copied and pasted and it says error . And where can I add this?

polaster64
#12
04.10.2015 13:05
Beiträge: 184

Zitat von polaster64:

Zitat von Zedeg:
Why don't you add this simple " -debugscript" behind the settler shortcut's path? You have made the mistake because my script works perfectly!




I copied and pasted and it says error . And where can I add this?



I added this -debugscript but nothing showed up. Nothing changed.

mcb
#13
04.10.2015 13:52
Beiträge: 1472

Right-click at the Settlers-schortcut at your desktop and click Properties. In the first text field you append " -debugscript" (without " but with the space).

Zedeg
#14
04.10.2015 15:52
Beiträge: 428

Here is the screenshot polaster64 sent me via PM:

This path seems to be ok so I have totally no idea why it doesn't return an error.

It says its error.

Or has this problem been solved already? Then you probably didn't copied the function correctly. Please post your script in this case.

____________________
Journalisten erkundigen sich bei Wissenschaftlern meist nicht nach Grundlagen, sondern eher nach Ergebnissen und Folgerungen. Das erklärt womöglich auch, warum sich Forschungsberichte in den Medien so häufig als feststehende Erkenntnisse lesen, nicht aber als Ideen, Entdeckungen oder Indizien, um die es sich genau genommen in den meisten Fällen handelt. -Axel Bojowski

mcb
#15
04.10.2015 17:13
Beiträge: 1472

This seems to be the original game. You should add this at the shortcut for the addon you using for your maps.

Kantelo
#16
04.10.2015 18:06
Beiträge: 357

Muss der Ziel Pfad normalerweise nicht eher so aussehen:
Blue Byte\DIE SIEDLER - Das Erbe der Könige - Gold Edition\extra2\bin\settlershok.exe
Oder spielt das keine Rolle?

polaster64
#17
04.10.2015 20:16
Beiträge: 184

Zitat von mcb:
Right-click at the Settlers-schortcut at your desktop and click Properties. In the first text field you append " -debugscript" (without " but with the space).



I did it. And still nothing..

polaster64
#18
04.10.2015 20:16
Beiträge: 184

Zitat von Kantelo:
Muss der Ziel Pfad normalerweise nicht eher so aussehen:
Blue Byte\DIE SIEDLER - Das Erbe der Könige - Gold Edition\extra2\bin\settlershok.exe
Oder spielt das keine Rolle?



Look here http://screenshooter.net/100248758/ovhefdo i did it like that and now notihng happens.

Zedeg
#19
04.10.2015 21:38
Beiträge: 428

It is still the basic game. You have to add this to the shortcuts of the addons' too!

____________________
Journalisten erkundigen sich bei Wissenschaftlern meist nicht nach Grundlagen, sondern eher nach Ergebnissen und Folgerungen. Das erklärt womöglich auch, warum sich Forschungsberichte in den Medien so häufig als feststehende Erkenntnisse lesen, nicht aber als Ideen, Entdeckungen oder Indizien, um die es sich genau genommen in den meisten Fällen handelt. -Axel Bojowski

polaster64
#20
04.10.2015 21:53
Beiträge: 184

Zitat von Zedeg:
It is still the basic game. You have to add this to the shortcuts of the addons' too!



I also did. Nothing still happens.

mcb
#21
05.10.2015 12:23
Beiträge: 1472

Try to add some Code causing an error to test if its work. Maybe this:

assert(false, "If you see this as Dialog, everything works;)")

polaster64
#22
05.10.2015 15:39
Beiträge: 184

Zitat von mcb:
Try to add some Code causing an error to test if its work. Maybe this:

assert(false, "If you see this as Dialog, everything works;)")



http://screenshooter.net/100248758/ycxhidm I did something like that, still errsyntax.

mcb
#23
05.10.2015 18:24
Beiträge: 1472

You should get a Message in a Dialog Box saying what Syntax-Error you have, when you start the map.
Text is something like this:
Error: LUA_ERRSYNTAX:

polaster64
#24
05.10.2015 19:00
Beiträge: 184

Zitat von mcb:
You should get a Message in a Dialog Box saying what Syntax-Error you have, when you start the map.
Text is something like this:
Error: LUA_ERRSYNTAX:




I fucking copied all Zedeg's script even with that FMA and replaced it to script. It says LUA_ERRSYNTAX. There must be a mistake. And can script really begin from "--" ?

mcb
#25
05.10.2015 19:26
Beiträge: 1472

A line starting with -- is a comment. You should really learn some Lua...

Seiten: 1 2 Nächste Seite

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

Impressum