Jump to content

Get value of global?


Lauriel

Recommended Posts

In the debug console, you're able to use GetGlobal("myglobal","GLOBAL") and it'll return the value.  I need something like this in a script.  For instance, if I want to know if the party has more gold than whatever is set in a global, I'd like to use "PartyGoldGT("GetGlobal("myglobal","GLOBAL"))".

Is there any way to do that?

Link to comment
56 minutes ago, Shin said:

You can simulate roughly taking a percentage though, e.g. take X gold if wealth is between Y  and Z, and so on.

K, I'll take 10% of your total earnings... that's a sorta good deal, alright.

Näh, I don't like you .-.. so that's 1000 gold for a 5 minutes when you didn't earn a thing, this was a nice short while it lasted. -wife.

Link to comment

I wonder if it's worth trying to use SetTokenGlobal and using the token like PartyGoldGT(<mytoken>).  It probably returns a string and will crash and burn, but I think I'm going to try it once...just in case...

Edited by Lauriel
Link to comment

The token won't work. Tokens don't do anything but display a bit of text when you need them to, plus you can use them to change and set the names of creatures and area notes. But they aren't good as objects. However, you can use TakeObjectGoldGlobal(S:Name*,S:Area*,O:Object*) and similar actions to manipulate gold; check out the G3 guide to actions. I think these actions exist only for EE, though.

Link to comment
On 3/5/2020 at 10:53 AM, temnix said:

The token won't work. Tokens don't do anything but display a bit of text when you need them to, plus you can use them to change and set the names of creatures and area notes. But they aren't good as objects. However, you can use TakeObjectGoldGlobal(S:Name*,S:Area*,O:Object*) and similar actions to manipulate gold; check out the G3 guide to actions. I think these actions exist only for EE, though.

I know it's been almost 2 months, but I think with TakeObjectGoldGlobal and GiveObjectGoldGlobal, I might be able to work something out.  The take will give me the amount of gold the party has (I assume, since we're talking about player1 ... here's hoping!).  I can give it right back with the 'give' version and I'll have my global set.  Thanks for the point in the right direction, @temnix!

 

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...