Author Topic: SDK Questions  (Read 3768 times)

SDK Questions
« on: May 06, 2013, 07:34:40 am »
I'm making this topic to keep the answers to my questions organized, also I may ask more questions than originally posted, and re-edit this post to mark as solved and or understood , and obviously thanks the kind souls that may hold the answers to my questions  :D

I thank you all for any response and precious time lost in this.

  • How to properly create new commands and  place them in the Player access check (player_allowcommand) in main.fos?
  • How to integrate Xenom's Global map hunting script?
  • Client Gui mod version v0.4C ?

That's it for now :D

Notes:

So I integrated client gui mod version 0.4b, that is for rev 356, the revision of my local copy of the sdk is rev 404 :3 so that is probably the cause of not working... But!

After installing Client Gui Mod v0.4b you need to use new radio script.
You can take it with gui mod here: http://netload.in/dateiNNgzS2SShq/client_gui_mod_v04c_368.zip.htm

I do get an error on the radio module that came with the Gui mod, but i cant find this update anywhere!

the error I get (after Client Gui Mod integration)
Code: [Select]
[02:869] Script message: client_screen_radio : Info : Compiling bool TextboxChannel::OnKeyPress(uint8, uint8) : 11941, 1.
[02:869] Script message: client_screen_radio : Error : No conversion from 'string@&' to 'uint' available. : 11947, 45.
[02:869] Script message: client_screen_radio : Error : No matching signatures to 'string::resize(uint)' : 11947, 58.
[02:872] Script::LoadScript - Unable to Build module<client_screen_radio>, result<-1>.
[02:873] FOServer::ReloadClientScripts - Unable to load client script<client_screen_radio>.
[02:905] Script message: client_screen_test_2 : Info : Compiling void ShowButton::OnMouseClick(int, int) : 1275, 1.
[02:905] Script message: client_screen_test_2 : Error : 'CLIENT_SCREEN_TEST_2' is not declared : 1277, 14.
[02:906] Script message: client_screen_test_2 : Info : Compiling void InitTestScreen2() : 1282, 1.
[02:906] Script message: client_screen_test_2 : Error : 'CLIENT_SCREEN_TEST_2' is not declared : 1293, 18.
[02:906] Script message: client_screen_test_2 : Error : Illegal operation on 'const int' : 1294, 1.
[02:907] Script::LoadScript - Unable to Build module<client_screen_test_2>, result<-1>.
[02:907] FOServer::ReloadClientScripts - Unable to load client script<client_screen_test_2>.
[02:907] Script::BindImportedFunctions - Fail to bind imported functions, module<client_main>, error<-19>.

I didn't ask xenom about the script integration because the last time he was active in this forum was 2 months ago...
So much for activity .. AND probably because there is someone out there that knows how to do it, I tried, but I failed.
His comments on the code are a bit confusing, at least to me and there isn't much information on his topic.


xenom last active @
March 14, 2013, 05:10:58 pm

Thanks to all that read this topic to help, good luck to those who read this topic in search of answers for the same questions!
Special Thanks to:
« Last Edit: May 07, 2013, 09:43:08 am by lithiumfury »

Offline Gob

  • The Good
Re: SDK Questions
« Reply #1 on: May 06, 2013, 10:06:01 pm »
You need the custom gui mod or chracter class menu in order for that script to work. I think I've seen it on fonline.ru but it was before the forum got deleted or smth. You should PM him there if you still have his account or go on his YT account http://www.youtube.com/user/ThePankracy?feature=watch

this is the lastest video of the mod which he made for me a long time ago

http://www.youtube.com/watch?v=jZMUbapCASU&list=UUuHd9rCBPkSgeoQ66wX9KSg&index=8
its easy to follow

if you are making another server maybe you should think again. better make a single player one since there ain't none arround well none that is good in any case.

and as for new commands you have to write them in debug.fos here is an example of the kill command:

Code: [Select]
void kill( Critter& player, int param0, int param1, int param2 )
{
    Critter@ target = GetCritter( param0 );
    if( not valid( target ) )
        return;
    target.Say( SAY_NETMSG, "Кара небесная поразила вас!" );  // this is the message the player gets when he will be killed by the command
    target.ToDead( def( param1, ANIM2_DEAD_PULSE_DUST ), player ); // this is the type of the death animation he will play
    // target.SetTimeout(TO_REPLICATION, 3); // this is the replication time he will get after he dies by the command. delete the // behind it to enable the replication time
}

its easy to add them, just put the new command between the others. make sure you write them correctly otherwise shit might go south and the server will not start. hope this helped you a bit
« Last Edit: May 06, 2013, 10:33:08 pm by Gob »

Offline Wipe

  • Rotator
  • Random is god
Re: SDK Questions
« Reply #2 on: May 06, 2013, 10:48:02 pm »
How to properly create new commands and  place them in the Player access check (player_allowcommand) in main.fos?
player_allowcommand handle hardcoded commands only, if you want to create own server-specific commands, it would need a bit of work.

One way is to create set of ~runscript commands which will perform custom actions, that's what vanilla is doing - you can see it perfectly in its debug module, which is nothing else than new commands. Ofc, it have limitations, as you can must pass 3 integers as arguments, no matter if code actually use it or not. Sure you can pass strings in there as well but it's tedious and - imho - not worth a time.

Second way is "catching" command inside client script and pass them to server via RunServerScript and unsafe_ functions. You check what client is typing into chat, and if it's your command, send it whole to server and parse it there; at same time inform client engine to not process a line any further. I'd strongly recommend to make all checks server-side, starting from checking access level. Or even better - make basic checks inside clients (but remember that originally client never know what access current char is using) but always re-check them server-side. I've already seen servers with poor 'commands' implementations (client-based), allowing to perform actions which *REALLY* should be forbidden for ACCESS_CLIENT. It all may sound bit paranoic and/or useless (i'm not aware of the scale of your server), but one rule stands... never trust the client :)
« Last Edit: May 06, 2013, 10:50:22 pm by Wipe »
Games are meant to be created, not played...

Re: SDK Questions
« Reply #3 on: May 07, 2013, 02:56:30 am »
Thanks for both of your replies, about the Gui mod, I am registered at the newfmc  forum I know it's Polish, but it just a google translation away for it to be readable to me, and yes I have everything ready to add the gui mod, it was one thing i was to be certain to do eventually. I didn't know xenom's script needed it anyhow...  He really doesn't specify such thing.. and from the error log on the server in my attempts it seams  I'm missing some code he has used in the script, strangely enough that script has nothing or almost nothing to do with a gui since it has to be made or I could just use a command to run it (that's what he said in the topic) and I tried to initialize it in client_main with a simple "text command" because as is i don't think it would need any access check, and for simplicity sakes to test it.

As for the commands with the checks I'll mess around with the debug.fos and see what I get, I honestly overlooked that script, notepad ++ has to many scripts open already haha.
I'll try to follow all of your indications, although i understand none of them are "specific" because there is no actual way of answer a "solution", this hole process have been a bit of a pain because I honestly don't know AS, It's readable since I have some programming knowledge not sure that is enough though.
Maybe I just have to get used to the API and then at least for me will be easier, because how can I program something in a language if I don't know the API o the application I'm writing to? xD

Thanks Again for your replies. I'll get to work.