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

Help with string parsing and, &&1 to users use button

broken avatar :(
Created 12 years ago
by MakeCents
0 Members and 1 Guest are viewing this topic.
2,984 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
  • How to I fix the Error without changing everything to a string? [Worked Around]
  • Can I get the players use button? [Sovled]
  • Help with function that knows when the player is looking at a trigger [Moving to new thread]

I have made a script that takes the SetHintString() and makes it a Hud instead. My hud shows up with Press and hold &&1 to, blah blah blah, so I want to change that to the players use button. I have been trying to parse the string by turning it into tokens and then concatenate it back together, but StrTok with not work on this:
Code Snippet
Plaintext
    &"ZOMBIE_WEAPON_PPSH_2000"
If I print
If I change the above to something like "Press &&1 to buy ppsh", then I am only left with trying to figure out what the users USE button is. I tried:
Code Snippet
Plaintext
    usekey = getKeyBinding("+activate");
but am having no luck with that either.

I can get a string, that I pass in, to parse and I replaced &&1 with USE, but this isn't really what I set out to do.
Code Snippet
Plaintext
    //I thread FixHint("Press &&1 to buy ppsh") and it works like I want except for use button.

    FixHint(hint_string){
        tokens = StrTok(hint_string," ");
        new_hint = "";
        for(i=0;i<tokens.size;i++){
            if(tokens[i] == "&&1"){
                new_hint = new_hint + " USE";
            }else{
                new_hint = new_hint + " " + tokens[i];
            }
        }
        return new_hint;

    }
Above comes out, Press USE to buy ppsh, for the strings, but when it is &"ZOMBIE_WEAPON_PPSH_2000", it crashes the map to the menu screen and says Error: Attempted to overrun string in call to va().

Edit: Removed part about looking at to close this thread
Last Edit: June 25, 2014, 12:19:35 pm by MakeCents
Marked as best answer by MakeCents 12 years ago
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years 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.
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
  • How to I fix the Error without changing everything to a string?
  • Can I get the players use button?
  • Help with function that knows when the player is looking at a trigger

I have made a script that takes the SetHintString() and makes it a Hud instead. My hud shows up with Press and hold &&1 to, blah blah blah, so I want to change that to the players use button. I have been trying to parse the string by turning it into tokens and then concatenate it back together, but StrTok with not work on this:
Code Snippet
Plaintext
    &"ZOMBIE_WEAPON_PPSH_2000"
If I print
If I change the above to something like "Press &&1 to buy ppsh", then I am only left with trying to figure out what the users USE button is. I tried:
Code Snippet
Plaintext
    usekey = getKeyBinding("+activate");
but am having no luck with that either.

I can get a string, that I pass in, to parse and I replaced &&1 with USE, but this isn't really what I set out to do.
Code Snippet
Plaintext
    //I thread FixHint("Press &&1 to buy ppsh") and it works like I want except for use button.

    FixHint(hint_string){
        tokens = StrTok(hint_string," ");
        new_hint = "";
        for(i=0;i<tokens.size;i++){
            if(tokens[i] == "&&1"){
                new_hint = new_hint + " USE";
            }else{
                new_hint = new_hint + " " + tokens[i];
            }
        }
        return new_hint;

    }
Above comes out, Press USE to buy ppsh, for the strings, but when it is &"ZOMBIE_WEAPON_PPSH_2000", it crashes the map to the menu screen and says Error: Attempted to overrun string in call to va().

Lastly, I was trying to use:
Code Snippet
Plaintext
player isLookingAt(trigger);
but it kept return 0, even when I was looking at the trigger. Any help with a function that works like that one sounds like it should, or what I may be doing wrong?
Press [{+activate}] to blegh.
Edit: That string error, have you precached the string as well as set it in a str file and then included in your map's ff patch?
Last Edit: June 24, 2014, 04:46:13 am by DidUknowiPwn
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
y are u trying to make it a hud? isnt a hintstring good enough?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
Press [{+activate}] to blegh.
Edit: That string error, have you precached the string as well as set it in a str file and then included in your map's ff patch?

Thank you so much for the first part!!! +1 for you!
The second part:
    I am taking the _zombiemode_weapons.gsc and taking the strings that are there already as a variable passed into my new function.
Code Snippet
Plaintext
    hint_string = get_weapon_hint(self.zombie_weapon_upgrade);

   //which returns
   return level.zombie_weapons[weapon_name].hint;
If this is setup as a string when it is added in:
Code Snippet
Plaintext
    add_zopmbie_weapon("zombie_ppsh", "Press and hold &&1 to buy PPSH [Cost: 2000]", 2000, "vox_ppsh", 5);
then everything is perfect. But if it is one of those &"ZOMBIE_WEAPON_PPSH_2000" ones, I get that error when I try to
Code Snippet
Plaintext
    StrTok(hint_string, " ");
It iprintlnbold like it is a string, perfectly. But it is not a string. Can I type cast it or something? I didn't find a str()-like method anywhere.

I'm sorry if I still didn't answer the question. Thanks again for your assistance.

Post Merge: June 24, 2014, 05:07:53 am
y are u trying to make it a hud? isnt a hintstring good enough?

I am working on a hint string to hud replacement script. When I made my last map I ran into a tremendous amount of frustration because of the limitations with hint strings. Also, I have watched people play my map and depending on how they play it, some hint strings never get a chance to show, and it can be confusing then. I removed so many hint strings but I don't like that answer. I like the hints and I want more of them. Someone recommended I make them a hud. I have done that, but now I want to make my script more useful, and I decided to start with the weapons, since they take up 2 hint strings. I will be moving onto perk machines and then just a generic hint string hud. I intend to handle all of these with one script, thus taking some of the load off of the SetHintString() function. I know the hud has its limits too since I have also passed them, but they are easier to work around for me.
Last Edit: June 24, 2014, 05:07:53 am by MakeCents
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years 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.
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
[edit]ignore me[/edit]
will check when I'm awake again ~10 hours
Last Edit: June 24, 2014, 05:17:17 am by DidUknowiPwn
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
[edit]ignore me[/edit]
will check when I'm awake again ~10 hours

Lol, its cool. I think I have a work around, but it would be nicer not to have to. I might just take the weapon name and remove zombie from it if it is in it. Not as pretty, but it is getting the job done. If you think of anything, let me know.

Edit: The more I use this work around, the more I reinvent the wheel. Hope there is some way to make this a string or replace the &&1 with the players use button.

Thanks again.
Last Edit: June 24, 2014, 01:20:50 pm by MakeCents

 
Loading ...