global script ActiveScript
{
void run()
{
SetUpStyles();
StartGhostZH();
Tango_Start();
linkAlreadyTalking=false;
while(true)
{
if(Link->Action==LA_SCROLLING)
linkAlreadyTalking=false;
UpdateGhostZH1();
Tango_Update1();
Waitdraw();
UpdateGhostZH2();
Tango_Update2();
Waitframe();
}
}
}
tango.zh
#181
Posted 06 October 2015 - 10:25 PM
#182
Posted 07 October 2015 - 12:17 AM
Yes they're in there. The way you had it in tangoDemo works. I set it up just like that. It just doesn't work for more than one NPC. If you have two of those NPC's using @talkcount in the tangoDemo you'll see what I mean. The blonde sprite you're using has it counting the nth number of times, and also changes strings after 5 and 10 I believe. But if you put another NPC that calls the same count, it will pick up where the first NPC left off. So its the same in my quest too because I used your code, which doesn't allow for more than 1 NPC to call @talkcount.
But now after we changed the conditions and variables around and added those functions, nothing is displaying in the text field....and we're getting no errors.
So in your code on tangoDemo you get talkcount and return it. And in the set function you set it to the value. So its always increasing!
The new code we're trying to nail down here isn't doing that...from what it looks like, its returning the value of the ffc...which to me I can't make since of LOL. You're the genius on this baby of yours my friend. Every thing seems right to me, but its not displaying. And I'm on a clean save too!
#183
Posted 07 October 2015 - 12:35 AM
const int IDX_TALKCOUNT = 100;
That's being used as an ffc->Misc[] index, so it has to be between 0 and 15. Sorry, I should've been clearer about that.
A variable in Tango code doesn't have to correspond to anything in particular in ZScript, so what we're trying to do here is associate it with an element of ffc->Misc[]. That is, reading or writing @talkcount is actually reading or writing this->Misc[IDX_TALKCOUNT]. It just has to be done in a somewhat roundabout way, storing its ID globally and reloading it later, because there isn't a more straightforward way to identify which FFC displayed the message.
#184
Posted 07 October 2015 - 06:38 AM
Ah, I overlooked this: const int IDX_TALKCOUNT = 100;
And that was the problem! Thanks!
EDIT:
Another Question....in tangoUsage.txt, in the String control codes section, you mention mixing tango code and string code will not work:
@if(@a0 \16\6) will not work.
...well, how would I make it work? I want to give item 6 to Link as shown in the code.
Also, I'm trying to make a custom function that warps Link...but its not working
Edited by xenomicx, 07 October 2015 - 04:02 PM.
#185
Posted 07 October 2015 - 04:57 PM
If you run this code:
int func[]="warplink"; Tango_ConvertFunctionName(func);It will write this to allegro.log:
const float FUNC_WARPLINK = 1940.4746;And that's the number you need.
As for adding an item, that'll take a custom function.
Here:
const float FUNC_WARPLINK = 1940.4746; // @warplink()
const float FUNC_GIVEITEM = 720.9516; // @giveitem()
float __Tango_RunCustomFunction(float function, float args)
{
if(function==FUNC_WARPLINK)
{
Link->Warp(0, 1); // Use args[0] and args[1] if you want it to take arguments
}
else if(function==FUNC_GIVEITEM)
{
int it=args[0];
Link->Item[it]=true;
}
else
{
Tango_LogUndefinedFunction(function);
}
return 0;
}That's both of them. The code would then be:@if(@a0 @giveitem(6))
#186
Posted 07 October 2015 - 06:08 PM
The name of the function or variable needs to be converted to a number.
Tango_ConvertFunctionName() and Tango_ConvertVariableName() will do this
for you; they'll even write the result to allegro.log in a form suitable
to copy and paste directly into a script. If you'd rather do the math
yourself, see the section titled "identifier conversion" in tango.txt.
I always skip the important parts LOL!
Where do you put this code? I read through the "identifier conversion" section and its example is this.
int name[] = "dostuff2"; float value = Tango_ConvertFunctionName(name);
Slightly different from what you put, but I can't get either to compile.
Edited by xenomicx, 07 October 2015 - 08:21 PM.
#187
Posted 07 October 2015 - 08:33 PM
#188
Posted 07 October 2015 - 09:06 PM
You can put it anywhere. At the beginning of the global script is easiest, since it'll just run right away. There's no reason to keep it there permanently, mind; you just do that to get the number you need and then remove it.
Thought so, I just keep getting errors. Either "GLOBAL VARIABLES CAN ONLY BE INITIALIZED TO CONSTANTS OR GLOBALS DECLARED IN THE SAME SCRIPT" when I copy the code straight from the example or "UNEXPECTED IDENTIFIER" if I use your code without "float value"
#189
Posted 07 October 2015 - 10:08 PM
#190
Posted 07 October 2015 - 10:21 PM
Ah, sorry. Anywhere inside a script, I mean.
Yes, it works when you put it within the while(true) loop within the global script. It prints out several times in allegro.txt. Thanks!! Now I can write anything I want!
#191
Posted 09 October 2015 - 12:40 PM
Help with PAY FOR INFO strings,
So I'm trying to recreate the PAY FOR INFO rooms using tango.zh and tango code in my strings. I made a custom function and a custom variable for this:
First I made a Custom Variable called @a2 so I can @set arbitrary values into a 3rd option. (@a0, @a1, and the new @a2)
Next, I made a Custom function to take money from Link when he makes a choice of spending 5, 10, 25 rupees for information:
Here is my string codes which start at String 163:
So my choices work just fine; when I select any of the 3 choices it will tell me the appropriate message. If I cancel out, it will go to STRING 166. It will also subtract the appropriate amount of rupees. The problem is if I don't have enough rupees, it will still display the message. I need help with the logic behind it. SERIOUSLY, my brain is about to explode!
Edited by xenomicx, 09 October 2015 - 12:42 PM.
#192
Posted 09 October 2015 - 12:50 PM
if(function==FUNC_TAKEMONEY)
{
int amount=args[0];
if (Game->Counter[CR_RUPEES] >= amount)
{
Game->Counter[CR_RUPEES] -= amount;
return 1;
}
else
{
return 0;
}
}
And then the strings need to check the value. You can do that this way:@if(@not(@takemoney(5)) @goto(166))Bomb, Slash, Hammer, and Burn behind trees to find new paths!
#193
Posted 09 October 2015 - 01:24 PM
And then the strings need to check the value. You can do that this way:
@if(@not(@takemoney(5)) @goto(166))Bomb, Slash, Hammer, and Burn behind trees to find new paths!
It works now...and just to nitpick, how do I make it subtract one rupee at a time like the original game? Would I just run a loop like this:
do{
Game->Counter[CR_RUPEES] -= 1;
amount--;
Game->PlaySound(18); //I think SFX 18 is the correct sound for rupees decreasing.
}while(amount>0)
...and the last code we worked on above for the @giveitem() function...we could easily convert this to create a shop right?
#194
Posted 09 October 2015 - 01:38 PM
Use Game->DCounter instead of Game->Counter.It works now...and just to nitpick, how do I make it subtract one rupee at a time like the original game?
Sure....and the last code we worked on above for the @giveitem() function...we could easily convert this to create a shop right?
@if(@takemoney(150) @giveitem( 8))
or something like that.
#195
Posted 09 October 2015 - 04:38 PM
Use Game->DCounter instead of Game->Counter.
Sure.
@if(@takemoney(150) @giveitem()
or something like that.
So I'm trying to get something like this going on. I took the working PAY FOR INFO screenshot and photoshopped in some items for sale, and will later tonight make an attempt to accomplish this:
Now what would be easier: 1) just create a new style with a complex background and add those 3 item tiles into a frame -or- 2) maybe create another function or just variables (@bombsale, @magicsale, @arrowsale...or maybe just @saleitem()) having it display either a combo or tile of the item.
If its the latter, I might need help doing it.
Edited by xenomicx, 09 October 2015 - 04:39 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


