How to add a new option?

Asked by Riug74

I have created some progress bar packs and I want to make a function of choice a pack in the "Options" screen. But I cannot add my own option (called "ProgressBarType") to the list in "preferences.lua".

A fragment from "stratagus.lua":

if (preferences == nil) then
  preferences = {
    ...
    ProgressBarType = 0,
  }
end.
...
SetProgressBarType(preferences.ProgressBarType) // if I add this line to the code, Wargus crashes - this option doesn't exists.

Question information

Language:
English Edit question
Status:
Solved
For:
Wargus Edit question
Assignee:
Pali Edit question
Solved by:
Pali
Solved:
Last query:
Last reply:
Revision history for this message
Best Pali (pali) said :
#1

You need native C/C++ function SetProgressBarType in Stratagus and export it to Lua in Stratagus too. Or you can create Lua function and add it to some Wargus lua scripts.

Revision history for this message
Riug74 (riug-74) said :
#2

Thanks Pali, that solved my question.

Revision history for this message
Rodrigo Pereira (rodrigodefreitas12) said :
#3

Where can I find theses native C/C++ functions?

Revision history for this message
Pali (pali) said :
#4

SetProgressBarType does not exists.

All functions are in Stratagus source code (and exported in files src/stratagus/script.cpp and src/tolua/*.pkg)