UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Run GSC function from CSC

broken avatar :(
Created 9 years ago
by Deleted User
0 Members and 1 Guest are viewing this topic.
6,140 views
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
Hey!
I know basic scripting at best, so bare with me here.
When I reach a certain point in my .CSC script, I'm trying to get it to run a function in a .GSC

I know that for the other way round "setclientsysstate" can be used, but am unsure of any similar way for it to work this way.
I also tried setting a clientDvar in the .csc, but don't know of a way to wait for clientDvar in GSC

If you need me to explain anything better, I can try to, but I'm sure I've already rambled as it is :D
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
I'm pretty sure a 'level notify' works for that, it does work from .gsc to .csc so why not the other way around ( never tried )

Also you can't really wait for a DVAR, but you can obv just run a check in a loop to check when it's value changed and then continue your script.
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
I'm pretty sure a 'level notify' works for that, it does work from .gsc to .csc so why not the other way around ( never tried )

Also you can't really wait for a DVAR, but you can obv just run a check in a loop to check when it's value changed and then continue your script.

level notify doesn't seem to work, I tried it a couple of times today.  :'(
And the Dvar option is a no go, since I can't find a way to check the state of a clientDvar in GSC
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
The only way to go back from CSC to GSC is via dvar values. There is no notify in the engine that GSC will catch from CSC. You can only notify from GSC to CSC.  The only way to get client dvar values outside of CSC is via menu files which then send the data to GSC.
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 5 months ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
GSC -> clientnotify("notifier"); -> level clientnotifiy("notifier");
CSC -> level waittill("notifier");

Examples raw/maps/_zombiemode_tesla.gsc, raw/clientscripts/_zombiemode_tesla.gsc
Should work the same with self notify I think though :/ I'll take a look into clientnotify function.

Edit: Calling clientnotify with no entity before it still acts as level waittill so yeah.
Last Edit: May 19, 2015, 04:05:23 pm by DidUknowiPwn
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
The only way to go back from CSC to GSC is via dvar values. There is no notify in the engine that GSC will catch from CSC. You can only notify from GSC to CSC.  The only way to get client dvar values outside of CSC is via menu files which then send the data to GSC.
Hm, so the only option would be for me to use the Menufile method I'm guessing? :/
GSC -> clientnotify("notifier"); -> level clientnotifiy("notifier");
CSC -> level waittill("notifier");

Examples raw/maps/_zombiemode_tesla.gsc, raw/clientscripts/_zombiemode_tesla.gsc
Should work the same with self notify I think though :/ I'll take a look into clientnotify function.

Edit: Calling clientnotify with no entity before it still acts as level waittill so yeah.
I understand that way of doing it, but I'm trying for the other way round (CSC -> notify and GSC-> waittill)
From what I've tried, with this method reversed it's not possible  :(
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 5 months ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Huge fail on my part :D gimme a bit.

Edit:

Quote
SparkyMcSparks: you can notify on gsc side to kick off csc function, bot(not) other way around
Last Edit: May 19, 2015, 06:40:23 pm by DidUknowiPwn
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I wonder if you could put a struct in radiant with a script_string kvp of "" and then in clientsctript make a function that takes a var and sets that script_string kvp to it. Then in gsc do a while loop, in a while(1) loop, that while struct.script_string == "" loop, but then once it is changed via client to that string, level notify that string on the gsc side, then set it back to ""?
Last Edit: May 20, 2015, 02:09:28 am by MakeCents
Marked as best answer by Deleted User 9 years ago
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
I wonder if you could put a struct in radiant with a script_string kvp of "" and then in clientsctript make a function that takes a var and sets that script_string kvp to it. Then in gsc do a while loop, in a while(1) loop, that while struct.script_string == "" loop, but then once it is changed via client to that string, level notify that string on the gsc side, then set it back to ""?
Unfortunately no, because all spawned csc structs are unique to each client and invisible to GSC, and every other ent (ie Radiant structs or gsc spawned ents) is host-side which means all clients see the same version as the host. No client-specific information could be passed this way, every client would have the same info on the ent because its a host ent.

Like I said the only way I know to do this is what I did with UGX mod which is send the data via setClientDvar in CSC - read the clients dvar from menufile (since menu files are client specific when you use getDvar), then send the info into GSC via scriptMenuResponse. The way you differentiate clients from each other is by adding a player index prefix to the data (ex player_0_dataname, player_1_dataname). Every player then has every other players's data set in their dvars, which hurts nothing and allows you to read any string/int data you want from a specific client. This is how I get all the UGX preferences like FOV etc from clients and set them in GSC. To adapt this to the OP's needs I suppose you would set the dvar to a certain value at the desired time from CSC and have a loop which checks the dvar value on the GSC side ex:

Code Snippet
Plaintext
while(1)
{
    if(getDvar("player_2_notify") == "yes")
    {
        setClientDvar("player_2_notify", "no");
        <do stuff>
    }
    wait 0.1;
}

I assume anyone who uses this method to send data from CSC to GSC will credit me.
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
Huge fail on my part :D gimme a bit.
I wonder if you could put a struct in radiant with a script_string kvp of ""
Like I said the only way I know to do this is what I did with UGX mod which is send the data via setClientDvar in menufile

I assume anyone who uses this method to send data from CSC to GSC will credit me.
I was going to try the struct way just as you posted it too, MakeCents :(
Cheers for the help guys, shame Trems way, although a bit more bulky, seems to be the only way :D

Starting to understand these limitations more each day  :poker:

 
Loading ...